Impulse Response21.51Amplitude0.50-0.5-1-1.50510152025Time index n303540
Q2.23 运行程序P2.6,计算输出序列y[n]和y2[n]以及差值信号d[n]。y[n]和y2[n]相等吗?
% Program P2_6 % Cascade Realization clf;
x = [1 zeros(1,40)]; % Generate the input n = 0:40;
% Coefficients of 4th order system den = [1 1.6 2.28 1.325 0.68]; num = [0.06 -0.19 0.27 -0.26 0.12]; % Compute the output of 4th order system y = filter(num,den,x);
% Coefficients of the two 2nd order systems num1 = [0.3 -0.2 0.4];den1 = [1 0.9 0.8]; num2 = [0.2 -0.5 0.3];den2 = [1 0.7 0.85]; % Output y1[n] of the first stage in the cascade y1 = filter(num1,den1,x);
% Output y2[n] of the second stage in the cascade y2 = filter(num2,den2,y1); % Difference between y[n] and y2[n] d = y - y2;
% Plot output and difference signals
subplot(3,1,1); stem(n,y);
ylabel('Amplitude');
title('Output of 4th order Realization'); grid; subplot(3,1,2); stem(n,y2)
ylabel('Amplitude');
title('Output of Cascade Realization'); grid; subplot(3,1,3); stem(n,d)
xlabel('Time index n');ylabel('Amplitude'); title('Difference Signal'); grid; 仿真结果如下所示:
Output of 4th order RealizationAmplitude10-10510152025303540Output of Cascade RealizationAmplitude10-10x 10-14510152025303540Difference SignalAmplitude0.50-0.50510152025Time index n303540
y(n)和y2(n)相等。
Q2.25 用任意的非零初始向量ic,ic1和ic2来重做习题Q2.23。 clf;
x=sin(2*pi*0.2*n); % Generate the input n = 0:40;
% Coefficients of 4th order system den = [1 1.6 2.28 1.325 0.68];
num = [0.06 -0.19 0.27 -0.26 0.12]; xi=[1 2 3 4];
% Compute the output of 4th order system
y = filter(num,den,x,xi);
% Coefficients of the two 2nd order systems num1 = [0.3 -0.2 0.4];den1 = [1 0.9 0.8]; num2 = [0.2 -0.5 0.3];den2 = [1 0.7 0.85]; xi1=[1 2];
% Output y1[n] of the first stage in the cascade y1 = filter(num1,den1,x,xi1); xi2=[3 4];
% Output y2[n] of the second stage in the cascade y2 = filter(num2,den2,y1,xi2);
% Difference between y[n] and y2[n] d = y - y2;
% Plot output and difference signals subplot(3,1,1); stem(n,y);
ylabel('Amplitude');
title('Output of 4th order Realization'); grid; subplot(3,1,2); stem(n,y2)
ylabel('Amplitude');
title('Output of Cascade Realization'); grid; subplot(3,1,3); stem(n,d)
xlabel('Time index n');ylabel('Amplitude'); title('Difference Signal'); grid;
仿真结果如下图所示:
Output of 4th order RealizationAmplitude100-100510152025303540Output of Cascade RealizationAmplitude50-50510152025303540Difference SignalAmplitude100-100510152025Time index n303540
Q2.27 用任意非零初始向量ic,ic1和ic2来重做习题Q2.26。 % Program P2.27
% Cascade Realization clf;
x = [1 zeros(1,40)]; % Generate the input n = 0:40;
% Coefficients of 4th order system den = [1 1.6 2.28 1.325 0.68];
num = [0.06 -0.19 0.27 -0.26 0.12]; ic=[4 10 2 12]
% Compute the output of 4th order system y = filter(num,den,x,ic);
% Coefficients of the two 2nd order systems num1 = [0.3 -0.2 0.4];den1 = [1 0.9 0.8]; num2 = [0.2 -0.5 0.3];den2 = [1 0.7 0.85];
% Output y1[n] of the first stage in the cascade y1 = filter(num2,den2,x,ic(1:2));
% Output y2[n] of the second stage in the cascade y2 = filter(num1,den1,y1,ic(3:4)); % Difference between y[n] and y2[n] d = y - y2;
% Plot output and difference signals subplot(3,1,1);
相关推荐: