|
|
单位阶越:6 x9 l" h# V& w4 f, D
function [x,n] = stepseq(n0,n1,n2): a/ h4 t2 W9 {, W+ p
% Generates x(n) = u(n-n0); n1 <= n,n0 <= n2
. R/ |) \2 G$ o _+ K1 p/ C7 ~% M% ------------------------------------------
6 M/ U4 f8 d2 M& o5 }9 m% [x,n] = stepseq(n0,n1,n2)
' }! s9 r, v# T" L* q7 h%
$ Y2 f+ E" C' cif ((n0 < n1) | (n0 > n2) | (n1 > n2))
' u) m1 W) M& t1 O8 f% j error('arguments must satisfy n1 <= n0 <= n2')
$ L- o+ d1 C% Z) E4 Oend
/ [( Z( ^1 Q- |1 P, d- z1 cn = [n1:n2];$ u4 f+ j( \) R+ P8 U; y5 G
%x = [zeros(1,(n0-n1)), ones(1,(n2-n0+1))];
* m0 O; q* o) A! g% sx = [(n-n0) >= 0]; |
|