Presentation is loading. Please wait.

Presentation is loading. Please wait.

实验一 熟悉MATLAB环境 常用离散时间信号的仿真.

Similar presentations


Presentation on theme: "实验一 熟悉MATLAB环境 常用离散时间信号的仿真."— Presentation transcript:

1 实验一 熟悉MATLAB环境 常用离散时间信号的仿真

2 [实验内容] 1.用MATLAB实现函数impseq(n0,n1,n2),使函数实现 δ(n-n0)。 该函数的格式为:
Function   [x,n]=impseq(n0,n1,n2) %  Generate  x(n)=delta(n-n0);n1<=n<=n2 %  [x,n]=impseq(n0,n1,n2) 2.用MATLAB实现函数stepseq(n0,n1,n2),使函数实现u(n-n0), 。 function   [x,n]=stepseq(n0,n1,n2) %Generate  x(n)=u(n-n0);n1<=n<=n2 %[x,n]=stepseq(n0,n1,n2) 3. 用MATLAB实现常见的离散时间序列。

3 1.单位脉冲序列 Unit sample sequence Representation in MATLAB

4 Function [x,n]=impseq(n0,n1,n2)
A: n=[n1:n2]; x = zeros(1,n2-n1+1); x(n0-n1+1)=1; B: n=[n1:n2]; x = [(n-n0)==0]; stem(n,x,’ro’);

5 2. 单位阶跃序列 Unit step sequence
A: n=[n1:n2]; x=zeros(1,n2-n1+1); x(n0-n1+1:end)=1; B: n=[n1:n2]; x=[(n-n0)>=0];

6 3. 实指数序列 For Example: n=[0:10]; x=(0.9).^n; stem(n,x,’ro’)

7 4. 复指数序列 Attenuation: 衰减因子 frequency in radians:
For Example: n=[0:10]; x=exp((2+3j)*n);

8 5. 正弦序列 Phase in radians For Example:
n=[0:10]; x=3*cos(0.1*pi*n+pi/3)+2*sin(0.5*pi*n)

9 6. 随机序列 Rand(1,N) Generate a length N random sequence whose elements are uniformly distributed between [0,1] Randn(1,N) Generate a length N Gaussian random sequence with mean 0 and variance 1. en [0,1]

10 7. 周期序列 A sequence x(n) is periodic if x(n)=x(n+N)
The smallest integer N is called the fundamental period For example A: xtilde=[x,x,x,…x] B: xtilde=x’*ones(1,P); xtilde=xtilde(:); xtilde=xtilde’; transposition


Download ppt "实验一 熟悉MATLAB环境 常用离散时间信号的仿真."

Similar presentations


Ads by Google