dt=0.1;x=-10:dt:10;l=length(x);T=2;y=zeros(1,l);for i=1:ly(i)=i-round(round(i/(T/dt))*(T/dt));endplot(x,y)