%1.实验一 部分分式和
B=[2 16 44 56 32];
A=[3 3 -15 18 -12];
[R,P,K]=residuez(B,A)
R =
-0.0177 + 0.0000i
9.4914 + 0.0000i
-3.0702 + 2.3398i
-3.0702 - 2.3398i
P =-3.2361 + 0.0000i
1.2361 + 0.0000i
0.5000 + 0.8660i
0.5000 - 0.8660i
K =-2.6667
%2.零极点图
B=[0 2 -1.6 -0.9];
A=[1 -2.5 1.96 -0.48];
subplot(4,1,1)
zplane(B,A);
title('第一个系统不稳定')
legend('零点','极点')B1=[0 0 0 1 -1];
A1=[1 -0.9 -0.65 0.873 0];
subplot(4,1,2)
zplane(B1,A1);
title('第二个系统不稳定')
legend('零点','极点')%3.频率响应曲线
B2=[1 0 0];
A2=[1 -0.75 0.125];
[H2,W2]=freqz(B2,A2,'whole');
h1=abs(H2);
h2=angle(H2);
subplot(4,1,3);plot(W2/pi,h1)
title('幅频特性曲线');
subplot(4,1,4);
plot(W2/pi,h2);
title('相频特性曲线')
极点全部在单位圆内或者有单极点在单位圆上系统才稳定
%4.
clear;
clc;
B=[1 0 0 0 0 0 0 0 -1];
A=[1 0 0 0 0 0 0 0 -0.9];
subplot(3,1,1)
zplane(B,A);
legend('零点','极点')
title('不稳定');
[H,W]=freqz(B,A,'whole');
h1=abs(H);
h2=angle(H);
subplot(3,1,2);
axis([0,7,-100,100]);
plot(W/pi,h1);
xlabel('n*pi')
subplot(3,1,3);
axis([0,7,-100,100])
plot(W/pi,h2);
xlabel('n*pi')
很明显为梳状滤波器
重要思想
这里不采用卷积算,而是逆向思维使用filter函数
%5思考题1
[x,fs]=audioread('motherland.wav');
% sound(y,Fs);b = [1,0];
a1 = [1,0.8];
a2 = [1,-1];
a3 = [1,1.2];figure(1);
N = length(x);
t = (0:N-1)/fs;
figure(1);
subplot(2,2,1);
plot(t,x);
title('滤波前时域波形图');
axis([0,2,-0.5,0.5]);
grid on;x1 = filter(b,a1,x); %filter计算离散系统的零状态响应 由Hz恢复为差分方程再求响应
subplot(2,2,2);
plot(t,x1)
axis([0,2,-0.5,0.5]);
title('经H1系统滤波后时域波形图');
grid on;x2 = filter(b,a2,x);
subplot(2,2,3)
impz(b,a1,30);
axis([0,2,-0.5,0.5]);
title('经H2系统滤波后时域波形图');
grid on;x3 = filter(b,a3,x);
subplot(2,2,4);
plot(t,x3)
axis([0,2,-0.5,0.5]);
title('经H3系统滤波后时域波形图');
grid on;