1

i have two time series data with 8280X1 dim each recorded with 10 minutes interval, and i want to calculate offset(y-intercept) and slope(m) of two time series in successive interval(every 24hrs) in easy way. Is there matlab code for that. so far i did this

polyfit(wl1, wl2, 1)           % wl1 and wl2 is matrix column of time series 

ans =

    1.0184   -4.3500

but this take whole data. to do manual every 72 row can take weeks.

help

Poly piter
  • 31
  • 4

2 Answers2

1

Anyway,

i try this it work.! but i would be very happy if it give the answer in matrix format, i guess i have to work on it.

clc
A = (wl1)';                                 %wl1 is 8280x1 dim
B = reshape(A,72,115);
AA= (wl2)';                                 %wl2 is 8280x1 dim
BB= reshape(AA,72,115);

for i=1:115
   [con]= [polyfit(B(:,i),BB(:,i),1)]

end
Poly piter
  • 31
  • 4
1

Using your solution, this way con is a matrix.

for i=1:115
   [con(i,1:2)]= [polyfit(B(:,i),BB(:,i),1)]
end

Or skip the reshape part en do the following:

for i=1:115
   temp = (i-1)*72;
   [con(i,1:2)] = polyfit(wl1(temp+(1:72)),wl2(temp+(1:72)),1);
end
S Geurts
  • 118
  • 7