[英]How to compute an IIR Filter frequency response in Octave/MATLAB
I'm trying to compute the frequency response of an IIR filter.我正在尝试计算 IIR 滤波器的频率响应。
The transfer function of the filter is:滤波器的调function为:
The value of a
is computed as: a
的值计算如下:
f = 1000;
fsamp = 16000;
a = 1 / (1 + (2 * pi * f) / fsamp);
Ok so now I have the transfer function of my IIR filter.好的,现在我有了 IIR 滤波器的传输 function。 How should I now compute the frequency response?
我现在应该如何计算频率响应? I thought about using the
freqz
function, but I need help defining the arguments, how do i define the numerator and denominator polynomials?我考虑过使用
freqz
function,但我需要帮助定义arguments,如何定义分子和分母多项式?
f=1000; fsamp=16000; a=1/(1+(2*pi*f)/fsamp);
a = [1 -a];
b = [(1-a) 0];
w = logspace(-1,1);
h = freqs(b,a,w);
mag = abs(h);
phase = angle(h);
phasedeg = phase*180/pi;
subplot(2,1,1)
loglog(w,mag)
grid on
xlabel('Frequency (rad/s)')
ylabel('Magnitude')
subplot(2,1,2)
semilogx(w,phasedeg)
grid on
xlabel('Frequency (rad/s)')
ylabel('Phase (degrees)')
This is based on this solution https://www.mathworks.com/help/signal/ref/freqs.html by Mathworks.这是基于 Mathworks 的此解决方案https://www.mathworks.com/help/signal/ref/freqs.html 。 And I get this outcome:
我得到了这个结果:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.