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

I want sum graph 1 and graph 2 .How I write code. Thank you. I'm sorry for word.I'm not good english language.

 Akzeptierte Antwort

Azzi Abdelmalek
Azzi Abdelmalek am 20 Jun. 2015
Bearbeitet: Azzi Abdelmalek am 20 Jun. 2015
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')

5 Kommentare

Fieldza Field
Fieldza Field am 20 Jun. 2015
Bearbeitet: Fieldza Field am 20 Jun. 2015
I don't understand.Can you explain me. Thank you.
Azzi Abdelmalek
Azzi Abdelmalek am 20 Jun. 2015
Bearbeitet: Azzi Abdelmalek am 20 Jun. 2015
for y1, If t-5 is negative the output will be 10 multiplied by -1, given by sign(t-5). If t-5 is positive ...
Now, based on this, if you want to do it with a for loop, try it.

Thank you very much.I tried it.It's ok.But i have question.If graph is not equal.How I should summation graph. Can summation? Thank you.

If it's another case, you have to figure it out. Just try to think a little.
Thank you very much.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Graphics Objects finden Sie in Hilfe-Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by