Using freqs to plot butterworth filter frequency response
Mostrar comentarios más antiguos
I'm attempting to use the Matlab freqs function to plot the frequency response of a first and second order butterworth filter by passing it the corresponding A(s) and B(s) polynomial values for each filter order.
I am having a tough time understanding what is showing up when I plot the magnitude vs frequency. It looks like the chart is mirrored, not like a normal butterworth response should look like, and I can't chase down the cause. Anyone have this issue before?
https://imgur.com/a/AuV5d
Code
%First Order
Num1=[0 1];
Dem1=[1 1];
w = (0 : 100*2*pi/100 : 100*2*pi); %freq range
T1=freqs(Num1, Dem1, w); %calculate the transfer function
axis([0 100 -30 0])
plot(w/(2*pi),20*log10(abs(T1)))
%Second Order
Num2=[0 0 1];
Dem2=[1 1.4142 1]; %repeat for second order
T2=freqs(Num2, Dem2, w);
hold on
plot(w/(2*pi), 20*log10(abs(T2)))
grid on
hold off
Respuestas (1)
Star Strider
el 31 de Mzo. de 2018
I don’t understand what you mean by ‘mirrored’.
When I used:
w = logspace(-3, 2);
and used semilogx instead of plot, I got what appears to be an acceptable plot for a lowpass filter. The rest of your code is unchanged.
Categorías
Más información sobre Digital Filter Analysis en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!