ha2hz.m
来自「经典《信号与系统》教程的matlab例程,对深入理解信号与系统相关概念有很大帮助」· M 代码 · 共 37 行
M
37 行
% Name:Ha2Hz
% This program is used to compute the system function from
% an analog lowpass filter using the impusle invariance transformation
% b:The numerator coefficient vector of Ha(s)
% a:The denominator coefficient vector of Ha(s)
% bz:The numerator coefficient vector of H(z)
% az:The denominator coefficient vector of H(z)
% T:The sampling period (second)
%=========================================================================
clear,close all
b=input('Type in the numerator coefficient vector of analog filter:');
a=input('Type in the denomintor coefficient vector of analog filter:');
T=input('Type in the sampling period :');
[bz,az]=impinvar(b,a,1/T);
bz
az
%==========================================================================
[H,w]=freqz(bz,az);
%=================================================================
[Ha,wa]=freqs(b,a);
subplot(222)
plot(w/pi,abs(H));
title('Amplitude response of digital filter'),
ylabel('|H|'),axis([0,0.5,0,1.1]),grid on
subplot(224)
plot(w/pi,20*log(abs(H)));
ylabel('dB'),axis([0,0.5,-80,0]),
xlabel('Frequency (pi)'),grid on
subplot(221)
plot(wa,abs(Ha));
title('Amplitude response of analog filter'),
ylabel('|Ha|'),axis([0,pi,0,1.1]),grid on
subplot(223)
plot(wa,20*log(abs(Ha)));
ylabel('dB'),axis([0,pi,-80,0]),
xlabel('Frequency (radians/s)'),grid on
%===============================================================
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?