MATLAB: How I summation graph ? I have photo exemple in this post.

plotplotting

Best Answer

t=0:0.1:10
y1=10*sign(t-5)
y2=20*sign(t-5)
y=y1+y2
plot(t,y1,'r',t,y2,'g',t,y,'b')
If your signal is periodic
t=-20:0.01:20
y1=10*sign(abs(mod(t,10))-5)
y2=20*sign(abs(mod(t,10))-5)
y=y1+y2
plot(t,y1,'r',t,y2,'g',t,y,'b')