Clear Filters
Clear Filters

Info

This question is closed. Reopen it to edit or answer.

Fitting line through data points

1 view (last 30 days)
Ede gerlderlands
Ede gerlderlands on 6 Nov 2012
I want to fit the three intermediate series data seriesI have so that I will have long time series data. Each of the data contain 26 values(total of 78) at different time and I want to extend (fit) these data upto hTime= 25000.
The three data I have, which contains 26 values are in equation form
i-2.327+0.6.*(1:25) %% starts at time , tni= 11707
ii-1.492+ 0.46.*(1:25) %% starts at time , tmi= 16400
iii-1.2+ 0.3.*(1:25) %% starts at time , tgi= 23200
Here is the script I tried to work upon and failed.
hTime=linspace(1,1,25000);
time=linspace(1,1,25);
for rr= 1:length(time);
tni= 11707; tmi=16400; tgi=23200;
tnii=tni:(tni+24);tmii=tmi:(tmi+24);tgi=tgi:(tgi+24);
p=polyfit([tnii tmii tgi],[(2.327+0.6.*(rr)) (1.492+ 0.46.*(rr)) (1.2+ 0.3.*(rr))]);
[cofp,sts]=polyval(p,1:length(hTime));
end
Any help is highly appreciated.

Answers (0)

This question is closed.

Community Treasure Hunt

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

Start Hunting!