|
|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
2 T5 J# [4 U( _# s
单位样本序列
* A0 c$ k* ^5 c* \! W( }
% H3 N. o' J {! c8 g, }6 Q5 v! r
5 f; I+ e: ~) ]: T$ k
1 e( o$ r5 f) d- clc
- clear
- close all
- n1 = 0;
- n2 = 5;
- n0 = 3;
- n = [n1:n2];
- x = [(n - n0) == 0];
- stem(n,x,'filled');
- ylim([-1,2]);) I3 _6 ^' g( C: I7 w u; \
7 v, p2 {; P- F, |$ l; y
/ h. O" f. [0 Y T
2 r9 v8 x2 Y/ K9 q% R; ^- d5 c改成一个函数:3 Q: Y' O4 Q% e' \
7 d- E7 ]% t1 i h5 b
- 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 T5 Y0 g" g7 Y- t# D
+ X, T3 ~! ]. a
命名为delta.m! J( h: M0 @8 g7 D. |% x; O% C2 m
8 }' s" W( Q/ r
新建一个脚本:
/ z8 Q- q$ T6 a$ }- x& ^' _- U8 H, S& {" R$ o" ^, W
- n0 = 3;
- n1 = -3;
- n2 = 6;
- [x,n] = delta(n0,n1,n2);
- stem(n,x,'filled');
- ylim([-1,2]);
! W) [( V' C# T9 `
% N. d. |$ D% e# S9 P4 M运行得到: y! }- y2 ]( s7 G
8 W0 l4 f( A# l1 Y; s/ y7 V- b
8 b3 C% D0 U a0 w8 O( h; `5 `. w; j4 W
Z0 t J; Z ^ {单位阶跃序列# K: v4 M3 j' m! k
. q" ^/ z+ i6 z+ S4 D
4 D- K e6 b# ^- F. ~8 c! t* e: V# o
' b1 n+ n k- c! a0 T( K直接写成函数形式吧:
3 z: C5 B+ ?2 l/ A! H. U$ c. s: t! A& B; o
- 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];
' e# X- c2 ]' k0 u& P3 e + K6 `( Y( B! C/ f1 I6 a
新建一个脚本,测试:4 u3 d5 y* c; P* L
2 Y: K. b' L& s+ N5 L
- clc
- clear
- close all
- n0 = 3;
- n1 = -3;
- n2 = 6;
- [x,n] = stepseq(n0,n1,n2);
- stem(n,x,'filled');
- ylim([-1,2]);6 q7 U' v9 W8 U0 S
4 ^* z/ M! r$ P9 a
结果:' h' s$ v, c7 p7 Y; n
8 K4 }% F3 \" R# l
" ?' f1 b2 A' m- S( n
) E$ ?0 u' e0 R- P# P3 t
, S$ x2 H, K( r5 {& ?. c实值指数序列) S8 b6 ?+ p! S N
1 C: J: w3 z0 ~& f. B
为一般形式。
) C$ e4 h) v% I$ P0 j9 y; _9 w( ^: x5 q2 y
下面产生一个序列:! o8 q1 B. \% W& g: K# `" n
9 L+ ]! D4 H9 L( ]2 @/ K K
8 k/ y) ^- A6 a0 }; V. z+ V7 Z/ B
+ S$ _" X3 U' N f脚本代码:
% u- r9 X. q6 M$ c2 G9 m
5 B5 p/ e6 Z: R- h- 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]);
! M; v+ v* o0 n/ ~
* y- a$ @. H% R# M" [
C1 T5 N, f( l& U; _ N+ d& F
) u2 j, N/ }8 D/ Q6 z1 \' B9 A
4 r9 D. V! |( `7 [0 L* e% e4 N复指数序列$ H9 P! T8 k! D; p
; u6 @' H" T) p! O9 ~
5 e1 Y9 ~2 a# J1 }8 B2 j0 ^; j$ B
5 K, L! t+ _5 n: l! K- O- clc
- clear
- close all
- n = 0:10;
- x = exp( (2+3j)*n );
- stem(n,x);
- xlabel('n');
- % H3 o7 V# C5 \( Z
' u; e9 q8 j( M: O4 \
/ G* w8 e8 O% O( s. P' n" j* u" P) ^' y! k
, F W/ e5 o+ b, w" E! M9 M
周期序列
: P3 J- a; S) w, [
1 |. _2 K4 _1 o$ U- 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');4 Q/ a% s2 S- y- Y$ v, Q3 M
6 c: E% O6 V, K [2 q- r1 O0 R8 M( O
6 h! N2 r1 k9 b: C
; E+ D0 e! P F: V0 N: t- @6 Y4 A& D$ ?3 C
|
|