function y=ustep(t,a)
% USTEP  Unit Step Function.
%
%        Y=URECT(T) generates a step function with u(0) = 1.
%        Y=USTEP(T,A) generates a step function with u(0) = A.  
%
%        USTEP (with no input arguments) invokes the following example:
%
%          % generate a DT rectangular pulse between n=3 and n=7
%          >>n=0:12;
%          >>yn=ustep(n-3) - ustep(n-8);  % note n-8, not n-7
%          >>lines(n,yn,'o')   %plus other axis commands
%
%        See Also: UDELTA, URAMP, URECT, TRI, LINES

% Version 1.0
% Ashok Ambardar, EE Dept. MTU, Houghton MI.49931, USA
% e-mail: akambard@mtu.edu
% Copyright (c) 1993

if nargin==0,
 help ustep
 disp('Strike a key to see results of the example')
 pause
 nn=0:12;
 yn=ustep(nn-3)-ustep(nn-8);
 clg
 axis([0 12 0 1.5])
% lines(nn,yn,'o')
 axis([0 12 0 1.5])
 hold off
 return
end

if nargin == 1,
 y=(t>0)+(t==0);
elseif nargin == 2,
 y=(t>0)+a*(t==0);
elseif nargin > 2,
 error('Too many input arguments');
end


