|
|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
5 |" f8 H# x5 R7 I
单位样本序列
1 O% k, s0 `( j7 N
9 Z& k& d) {9 |- L% n. h% m* a
s# R$ o5 H2 b7 ]9 Q$ q7 b' g
- clc
- clear
- close all
- n1 = 0;
- n2 = 5;
- n0 = 3;
- n = [n1:n2];
- x = [(n - n0) == 0];
- stem(n,x,'filled');
- ylim([-1,2]);
& e6 @4 D* P, |5 a2 B0 k
& ^4 F. I1 Y5 _. P% G
) i+ w$ q% h9 z* H: i9 @) b
0 I* c) g1 t& ?1 G. v( \2 `改成一个函数:
5 {. i" g# X0 h8 T2 C# l$ u. x8 F9 B0 V) S' e, i7 ^
- function [x,n]=delta(n0,n1,n2);
- % generate x(n) = delta(n - n0); n1 <= n <= n2
- %_____________________________________________
- %[x,n] = delta(n0, n1, n2);
- %
- n = [n1:n2];
- x = [(n-n0) == 0];4 A% X2 ]1 l9 M" C+ `+ M
) ?4 c& j2 p/ F. ]命名为delta.m7 w4 O4 [. I7 r* }" m9 H$ D
0 _7 w: m( Q c3 K7 n7 ?* H1 e5 M
新建一个脚本:# p. e1 i0 H$ Y9 I( {
9 m6 v3 Y% U, L
- n0 = 3;
- n1 = -3;
- n2 = 6;
- [x,n] = delta(n0,n1,n2);
- stem(n,x,'filled');
- ylim([-1,2]);
# C8 O7 a# H; d1 @2 F8 C
& g- S/ r. I: n: C8 l: e' c运行得到:2 F/ P! k5 N# g& e* M& M; b; {
( ~- R/ F9 M! {
. @+ M \- l/ F0 P" n1 w. G: h
2 T' C+ `* Z" X. M) m0 D5 y" ]# U1 N! Q
单位阶跃序列
3 P* b- E% v' H, O1 D1 X5 C! k9 g" Y9 m y# h! A
- R G9 E P) g6 Q+ i+ Q1 x
5 m0 H$ K9 y3 ?/ }9 {7 t直接写成函数形式吧:
$ ?8 S' q; D# e' ^3 s$ K# j4 e+ _. |; q* @1 y( z
- function [x,n]=stepseq(n0,n1,n2);
- % generate x(n) = u(n - n0); n1 <= n <= n2
- %_____________________________________________
- %[x,n] = stepseq(n0, n1, n2);
- %
- n = [n1:n2];
- x = [(n-n0) >= 0];1 S4 @& u! i: ^
, a4 k! N3 @; A" p( O! ~+ e新建一个脚本,测试:7 f% c9 n5 o! G$ h) J" }
' @* x, \" V- P5 E! E- clc
- clear
- close all
- n0 = 3;
- n1 = -3;
- n2 = 6;
- [x,n] = stepseq(n0,n1,n2);
- stem(n,x,'filled');
- ylim([-1,2]);8 K# ]$ T- H+ k4 J
! M% Q6 W8 ~1 Y0 f结果:
% z+ H4 ]( K* s8 `: A9 D
3 g) m+ H( P" F& A
, I* v1 w; ?0 p1 }6 Z8 V0 B, F9 k' p
! H1 z# }$ g; Z h" V
3 K5 }* D1 Z* Z5 B1 a; e
实值指数序列- e7 R$ \4 s6 k9 c% T9 q- v1 K6 m( Y
9 O9 [5 w( C' P( K4 U% i
为一般形式。
+ Y- V4 g- j; ~2 R m- Q4 i o
4 H9 o( Z, h2 T. s" @8 ]6 Z下面产生一个序列:5 l$ O9 |1 v; _6 i
2 N6 z( W% k y" U; T+ q
! [: ]0 C8 K0 I& D6 \1 @/ E' H" h% i% l1 L2 M
脚本代码:+ b+ U- S- P X* A: x6 U
; q7 N& \3 |- [( k. x, G4 \2 a4 k- clc
- clear
- close all
- n = -3:10;
- x = 0.9.^n;
- stem(n,x,'filled');
- xlabel('n');
- ylabel('0.9^n');
- xlim([-5,13]);
- ylim([0,2]);
9 S6 ?3 T0 J9 h8 a 3 s" h+ O/ Z% Z
9 L; d+ W; t S( e( u
2 U$ l% v: z! K; f$ ]: R* D* m. y
, }8 i7 H( }$ I5 m
复指数序列
" f+ K: C( _( s* [& Q' K+ Q8 k8 `2 ^& ?: U& @, a
: a* I8 W8 j, B3 u- m+ b2 w2 I: c4 r- n
- clc
- clear
- close all
- n = 0:10;
- x = exp( (2+3j)*n );
- stem(n,x);
- xlabel('n');
1 `9 ?7 V$ ?* t0 G z : N4 X; r4 e( y9 \2 c) S1 X
, u8 `# ^' @# {' R. o5 X1 ?0 i3 O `4 A1 r5 N: ?
/ V0 n& I1 d) X
周期序列. \1 a4 V4 j- ]
2 D3 V! X+ M, m3 g% ?. H- clc
- clear
- close all
- n = 0:10;
- x = exp( (2+3j)*n );
- subplot(2,1,1)
- stem(n,x);
- xlabel('n');
- title('Not Period Sequence');
- % the number of period
- P = 5;
- xtilde = x' * ones(1,P);
- xtilde = xtilde(:)';
- subplot(2,1,2);
- stem(xtilde);
- title('Period Sequence');
* S; n' t7 T% Y; J. v$ f + Y/ W! ?& G1 z, X, {
0 Y3 h& R0 g) s9 V7 I- n6 Y; j5 B! U' q! h7 F3 S. |/ w: n
0 c! n- r! u: t# @- `. r |
|