m=1000;
tau=100;
dt=tau/m;
t=dt*(-m/2:m/2-1);
r=0.5*(abs(t)<=1)
subplot(2,1,1);
plot(t,r,'g');
axis([-2 2 -2 2]);
s=t;
p=zeros(1,1000);
%%%%%%%%%pulse train%%%%%%%%%%%%%
for i=1:20
    s(50*(i-1)+1:50*(i-1)+30)=1;
    s(50*(i-1)+31:50*i)=0;
    i=i+1;
end
subplot(2,1,2);
plot(t,s);
axis([-100 100 -2 2])


