Combining (not addition) Two Arrays

Hello, I am new to Matlab programming & I have a question about arrays; Here is my problem:
Let's say, I have an array P with 7 elements, I would like to estimate the 8th point using the first 7 elements and store the new value in another array...
Next I need to take the new set of 7 elements including the newly found value and starting the second value of my previous array... (ex. A=[1;2;3;4] --> A=[2;3;4;5]) for 200 times.
What I have as code only outputs the new set of P with 7 elements and the loop is not working; I need to compare the predicted values to my actual values and find the error!
Can anyone help me please? Much appreciated,
%%================================%%
T=[0.015;0.03;0.045;0.06;0.075;0.09;0.105];
P=[17;18.5;20.35;22.4;22.68;23.55;24.1];
for i=1:200
T_i= T + 0.015;
xfit = linspace(0,0.12,50);
coeffs5 = polyfit(T, P, 5);
new_P=polyval(coeffs5,T_i);
end
%%================================%%

Réponses (0)

Cette question est clôturée.

Question posée :

le 29 Mai 2012

Clôturé :

le 20 Août 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by