📄 ustep.m
字号:
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
% >>dtplot(n,yn,'o') %plus other axis commands
%
% See Also: UDELTA, URAMP, URECT, TRI
% ADSP Toolbox: Version 2.0
% For use with "Analog and Digital Signal Processing", 2nd Ed.
% Published by PWS Publishing Co.
%
% Ashok Ambardar, EE Dept. MTU, Houghton, MI 49931, USA
% http://www.ee.mtu/faculty/akambard.html
% e-mail: akambard@mtu.edu
% Copyright (c) 1998
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);
v=matverch;
if v < 4, eval('clg');else,eval('clf');end
axis([0 12 0 1.5])
dtplot(nn,yn,'o')
axis([0 12 0 1.5])
hold off
return
end
if nargin == 1,
y=(t>0)+(t==0);
%elseif nargin == 2,
else
y=(t>0)+a*(t==0);
%elseif nargin > 2,
% error('Too many input arguments');
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -