t=-1:0.001:2;
s=zeros(size(t));
s(1002:2000)=ones(size(s(1002:2000)));
plot(t,s);
