分析:
两种方法的结果大致相同,只是用filter求得的y与x的长度一样,而用conv求得的y与两个卷积信号的长度和一样。
3. 考虑冲激响应h2[n]?h[n?5],利用filter计算y2[n]?x[n]?h2[n],并用
stem画出所得结果。
y2[n]?x[n]?h2[n]= h[n+5]+h[n+4]+h[n+3]+h[n+2]+h[n+1]+h[n]。
代码: >> a=[1]; b=[1 1 1 1 1 1]; h=[0 1 2 3 4 5]; y=filter(h,a,b); >> ny=[-5:0]; >> stem(ny,y); 图形:
151050-5-4.5-4-3.5-3-2.5-2-1.5-1-0.50
分析:
只是上题的向左平移5个单位。 §8.3 离散时间LTI系统的性质 基本题
1.已知信号 x1[n]???1 0?n?4?0 其余n
?1 n?0??-1 n?1? h1[n]??3 n?2
?1 n?4???0 其余n?2 n?1??5 n?2? h2[n]??4 n?3
?-1 n?4???0 其余n定义代表区间0?n?9内的x1[n]的MATLAB向量x1,以及代表在区间
0?n?4内的h1[n]和h2[n]的
MATLAB向量h1和h2。同时,定义nx1和nx2为
这些信号合适的标号向量。利用stem画出这些信号并作适当标注。 代码:
x1=[1 1 1 1 1 0 0 0 0 0]; h1=[1 -1 3 0 1]; h2=[0 2 5 4 -1]; nx2=[0:4]; nx1=[0:9]; subplot(3,1,1); stem(nx1,x1);
title('x1=[1 1 1 1 1 0 0 0 0 0]'); subplot(3,1,2); stem(nx2,h1); title('h1=[1 -1 3 0 1]');
subplot(3,1,3); stem(nx2,h2); title('h2=[0 2 5 4 -1]'); 图形:
x1=[1 1 1 1 1 0 0 0 0 0]10.5050-550-50123456789h1=[1 -1 3 0 1]00.511.52h2=[0 2 5 4 -1]2.533.5400.511.522.533.54
2.交换律意味着具有单位冲激响应h[n]的LTI系统,在输入为x[n]时所得到输出y[n]与单位冲激响应为x[n],在输入为h[n]时所得的输出y[n]是一样的,利用conv以及x1和h1验证这一性质。conv的输出是与卷积次序无关吗? 代码:
x1=[1 1 1 1 1 0 0 0 0 0]; h1=[1 -1 3 0 1]; ny=[0:13]; y1=conv(x1,h1) y2=conv(h1,x1) subplot(2,1,1); stem(ny,y1); title('x1*h1');
subplot(2,1,2); stem(ny,y2); title('h1*x1'); 图形:
x1*h1432100246h1*x181012144321002468101214
结论:
conv的输出是与卷积次序无关。
4. 卷积具有分配律性质,这意味着,两个并联系统的输出与单位冲激响应是该
并联系统单位冲激响应之和的系统的输出是相同的。利用x1,h1和h2验证分配率性质。当输入为x1[n]时,用单位冲激响应为h1[n]和h2[n]计算LTI系统的输出的和。将结果与输入为x1[n],单位冲激响应为
h1[n]?h2[n]的LTI系统的输出进行比较。
代码:
x1=[1 1 1 1 1 0 0 0 0 0]; h1=[1 -1 3 0 1]; h2=[0 2 5 4 -1];
ny=[0:13];
y1=conv(x1,h1)+conv(x1,h2); y2=conv(x1,h1+h2); subplot(2,1,1); stem(ny,y1); subplot(2,1,2); stem(ny,y2); 图形:
1510500246810121415105002468101214
分析:
由生成的图形可以得知输出不变,所以卷积具有分配律性质。
5. 卷积具有结合律性质,这意味着用LTI系统的级联处理一个信号所得的结果
等效于一个系统来处理,该系统的单位冲激响应应是全部级联系统中单个冲激响应的卷积。用x1,h1和h2验证结合律性质。 代码:
x1=[1 1 1 1 1 0 0 0 0 0]; h1=[1 -1 3 0 1];