how to graph a function that is periodic piecewise with "n" cycles

 Akzeptierte Antwort

Walter Roberson
Walter Roberson am 2 Okt. 2013

1 Stimme

repmat() the single cycle "n" times.
Note: you need to decide whether at the end of each cycle the graph is to connect to the beginning of the next, or if instead there is to be a jump from the end of each cycle to the beginning of the next.

4 Kommentare

Thank you very much Walter! I really appreciate the answer, could you do me a favor and send me an example code
x = 0:49
y = sin(x);
y(x > 20) = tan(x(x>20));
y = repmat(y, 1, 10);
x = 0 : length(y) - 1;
plot(x, y)
Thank you very much Walter!
@Walter Roberson lol, master walter, you are everywhere, ahaha. I am searching this piecewise function as well.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Programming 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