h2=[0 2 5 4 -1]; ny=[0:17];
y1=conv(conv(x1,h1),h2); y2=conv(x1,conv(h1,h2)); subplot(2,1,1); stem(ny,y1); subplot(2,1,2); stem(ny,y2); 图形:
403020100-10024681012141618403020100-10024681012141618
分析:
生成的图形一致,可以得出结论卷积具有结合律性质。
中等题
6. 假定系统有单位冲激响应为he1[n]?h1[n]和he2[n]?h1[n?n0],这里n0是
一个整数,令ye1[n]和ye2[n]是这两个系统当输入为x[n]时的输出。利用交换律性质证明:如果每个系统的输入与单位冲激响应互换的话,输出是
相同的。并基于时不变性质证明ye2[n]?ye1[n?n0]。利用MATLAB确认当n0?2,输入为x1[n]。 代码:
x1=[1 1 1 1 1 0 0 0 0 0]; h1=[1 -1 3 0 1]; %系统一 he1=h1; ny=[0:13]; y1=conv(x1,he1); y2=conv(he1,x1); subplot(2,1,1); stem(ny,y1); subplot(2,1,2); stem(ny,y2); figure; %系统二
he2=h1; %向右时移两个单位 ny=[2:15]; y1=conv(x1,he2); y2=conv(he2,x1); subplot(2,1,1); stem(ny,y1); subplot(2,1,2); stem(ny,y2); 生成图:
系统143210024681012144321002468101214
系统24321024681012141643210246810121416
分析:
可以看得出,如果每个系统的输入与单位冲激响应互换的话,输出是相同的与ye2[n]?ye1[n?n0]。
§8.4线性和时不变性 目的
在本练习中将更加熟悉系统的线性和时不变的性质。 基本题
考虑如下3个系统:
系统1:w[n]?x[n]?x[n?1]?x[n?2] 系统2:y[n]?cos(x[n]) 系统3:z[n]?nx[n]
其中x[n]是每个系统的输入,w[n],y[n]和z[n]是相应的输出。 1. 考
虑
3
个
输
入
x1[n]??[n],
x2[n]??[n?1]和
对系统1,将对这3个输入的响应存入w1,w2x3[n]?(?[n]?2?[n?1])。
和w3中,向量w1,w2和w3仅需包含在区间0?n?5内的w[n]值。利用subplot和stem在一张图上画出w1,w2,w3和w1+2×w2代表的4种函数的图。对系统2和3也作出类似的图。
代码: 系统1: %系统一 w1=[1 -1 -1 0 0 0]; w2=[0 1 -1 -1 0 0]; w3=[1 1 -3 -2 0 0 ]; n=[0:5]; subplot(2,2,1); stem(n,w1); title('w1'); subplot(2,2,2); stem(n,w2); title('w2'); subplot(2,2,3);
stem(n,w3); title('w3'); subplot(2,2,4); stem(n,w1+2*w2); title('w1+2*w2'); 图形:
w110.50-0.5-10246w310-1-2-30246系统2: 代码: %系统2
w1=[cos(1) 0 0 0 0 0]; w2=[0 cos(1) 0 0 0 0]; w3=[cos(1) cos(2) 0 0 0 0 ]; n=[0:5]; subplot(2,2,1); stem(n,w1); title('w1');
w210.50-0.5-10246w1+2*w210-1-2-30246