1.实验目的
(1)掌握离散时间信号的z变换和z逆变换分析
(2)掌握MATLAB中利用filter函数求解差分方程;
(3)掌握MATLAB中利用impz函数求解单位冲击响应h(n);
(4)掌握MATLAB中利用freqz函数求解幅频特性曲线和相频特性曲线;
(5)掌握MATLAB中利用zplane函数求解零极点;
2.实验内容
②求h(n),画图; 脉冲响应函数
③求幅频、相频,画图;
④求零极点图;
- 实验步骤和实验结果
(1)掌握离散时间信号的z变换和z逆变换分析
(2)
(2)掌握MATLAB中利用filter函数求解差分方程;
(3)掌握MATLAB中利用impz函数求解单位冲击响应h(n);
(4)掌握MATLAB中利用freqz函数求解幅频特性曲线和相频特性曲线;
解卷绕:
未解卷绕
(5)掌握MATLAB中利用zplane函数求解零极点;
4.实验小结
本节实验课学习了如何用MATLAB进行离散时间信号的z变换和z逆变换分析,以及利用filter函数求解差分方程、利用impz函数求解单位冲击响应h(n)、利用freqz函数求解幅频特性曲线和相频特性曲线和利用zplane函数求解零极点。
%% (1)计算Z变换和逆Z变换
clc;clear;
syms n
f=0.5^n+(1/3)^n;
F=ztrans(f)
pretty(F);
syms z
F=2*z/(z-2)^2;
f=iztrans(F)
%% (2)
%x(n)=ones(1,100),求y(n),画图,即求系统的阶跃响应
clc;clear;
x=ones(100);
t=1:100;
b=[0.001836,0.007344,0.011016,0.007374,0.001836];
a=[1,-3.0544,3.8291,-2.2925,0.55075];
y=filter(b,a,x);
plot(t,x,'r',t,y,'k-');
ylabel('x(n) & y(n)')
xlabel('n')
% 求h(n),画图; 脉冲响应函数
clc;clear;
b=[0.001836,0.007344,0.011016,0.007374,0.001836];
a=[1,-3.0544,3.8291,-2.2925,0.55075];
[h,t]=impz(b,a,40);
stem(t,h,'.');
% 求幅频、相频,画图
clc;clear;
b=[0.001836,0.007344,0.011016,0.007374,0.001836];
a=[1,-3.0544,3.8291,-2.2925,0.55075];
[H,w]=freqz(b,a,256,'whole',1);
Hr=abs(H);
Hphase=angle(H);
% Hphase=unwrap(Hphase);%解卷绕
subplot(211),plot(w,Hr);
ylabel('幅频')
subplot(212),plot(w,Hphase);
ylabel('相频')
% 求零极点图
clc;clear;
b=[0.001836,0.007344,0.011016,0.007374,0.001836];
a=[1,-3.0544,3.8291,-2.2925,0.55075];
zplane(b,a);