How to plot a piecewise function for single cycle? Then repeat the same graph for several times.
Show older comments
How to plot a piecewise function for single cycle? Then repeat the same graph for several times.
2 Comments
Walter Roberson
on 25 Feb 2017
Symbolic or numeric?
António Gil
on 13 Oct 2020
How would you do a Symbolic one?
Answers (1)
Asad (Mehrzad) Khoddam
on 13 Oct 2020
This is a sample of function that repeats the graph:
% initial x
x0=-1;
% period
T=4;
xp=linspace(x0,x0+T,201);
% function
yp=sin(sqrt(2+xp));
x=[];
y=[];
% repeat it
for i=-3:2
x=[x xp+T*i];
y=[y yp];
end
plot(x,y)
Categories
Find more on Line Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!