%Triang.m m-file to create a triangle wave
function y = triang(t)
N=length(t);
ta=t(1:N/2);
tb=t(N/2+1:N);
ya=-2*rem(ta,2*pi)/pi+1;
yb=2*rem(tb,2*pi)/pi-3;
y=[ya,yb];
