Abid
Abid

Reputation: 270

MatLab, how do I plot multiple waves on top of each other?

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

Upvotes: 1

Views: 6354

Answers (2)

AGS
AGS

Reputation: 14498

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)

Upvotes: 0

tmpearce
tmpearce

Reputation: 12693

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

Upvotes: 5

Related Questions