% Script File: sawtooth_wave.
clear
M=32
A = linspace(0,360,2*M+1)';
D(2:M)=(2:M)/M;D(M+2:2*M)=-1+(2:M)/M;
D(1)=0;D(M+1)=0;D(2*M+1)=0;
D=D';
Avals = linspace(0,360,1024)';
F     = CSInterp(D(1:2*M));
Fvals = CSeval(F,360,Avals);
plot(Avals,Fvals,A,D,'o');hold on
plot(Avals,Fvals)
hold off
a = 89;b=181;
axis([a b -0.1 1.1])
set(gca,'xTick',linspace(a,b,M/4))