Domanda

I have this image taken from user Li-aung Yip, in his response: Is there a way to do a linear best fit from one point to another in a matrix multiple times in order to detrend a series, MatLab?

enter image description here

I would like to know given several time series how MatLab can do this.

Best, Abid

È stato utile?

Soluzione

Assuming that the original plots (red,green,black,blue) are of variables a,b,c,d, each of which has a point for each t:

figure;
hold on
plot(t,c,'-k'); %# black line
plot(t,c+b,'-g'); %# green line added to previous
plot(t,c+b+a,'-r'); %# red line added to previous
plot(t,c+b+a+d,'-b'); %# blue line added to previous

Altri suggerimenti

In the case where x is your vector of dates, and B is your black line,

plot(x,A) % the NR plot
hold on
plot(x,B,'k')
plot(x,C+B,'g')
plot(x,D+B,'r')    
hline(1.2)
hline(1.0)
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top