我从用户Li-aung Yip那里拍摄了这张照片: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?
我想知道几个时间序列MatLab如何做到这一点。
最佳, 阿比德
答案 0 :(得分:5)
假设原始图(红色,绿色,黑色,蓝色)是变量a,b,c,d
,每个变量都有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
答案 1 :(得分:0)
如果x
是您的日期向量,B
是您的黑线,
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)