Creating Sawtooth graph that looks like the image below

I was wondering if someone could help me create a sawtooth graph that looks like this? I looked at the examples and tried couple different methods but could not figure out a way to do this. I would really appreciate the help.

 Accepted Answer

T=2;
t=-6:0.01:6;
xt=(2/T).*mod(t,T/2).*sign(T/2-mod(t,T));
plot(t,xt);grid;

More Answers (0)

Categories

Tags

Community Treasure Hunt

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

Start Hunting!