|
|
单位阶越:5 c/ f: f$ O# U& B
function [x,n] = stepseq(n0,n1,n2); H, G! u1 P( h
% Generates x(n) = u(n-n0); n1 <= n,n0 <= n2
4 D N/ T4 W# z! [1 d% ------------------------------------------3 [; T R, s/ H( J
% [x,n] = stepseq(n0,n1,n2)
3 q* O5 Z6 O& e U% P. X7 w2 Y/ D%
; Y6 U7 n7 K5 a. H/ G$ l$ uif ((n0 < n1) | (n0 > n2) | (n1 > n2))
! P1 E- {3 W. Z" r/ Y8 {! h error('arguments must satisfy n1 <= n0 <= n2')
/ g- G$ W( ]0 {' x. Mend8 Y& ?5 |5 O$ _; `
n = [n1:n2];5 i: s, Q6 ?: i4 r1 i
%x = [zeros(1,(n0-n1)), ones(1,(n2-n0+1))];5 w( X1 E1 o! j; ^
x = [(n-n0) >= 0]; |
|