MATLAB: Creating Sawtooth graph that looks like the image below

sawtooth

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.

Best 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;