function [t,g]=pulse(tmax,tw,n)
%function [t,g]=pulse(tmax,tw,n);
%Generates a pulse signal, width tw, with trailing zeros;
%from 0 to tmax in n steps;

%set up time vector, assume even time spacing;
dt=tmax/n;
t=0:dt:tmax;
n=1;
%initialize signal vector;
g=zeros(size(t));
%generate signal
while t(n)<tw
  g(n)=1;
  n=n+1;
end

