How to understand the design of lowpass butter filter?
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Kalasagarreddi Kottakota
el 26 de Jun. de 2023
Respondida: Star Strider
el 26 de Jun. de 2023
Hi, I am designing a low pass butter filter with very small cut-off freqeuncy. But I see very wierd results which I could not understand. Could some one help me regarding this? In the first code fc is 100 Hz and second code it 10 Hz. When 100Hz, I see clearly from 1st plot the cutoff frequency, but when it is 10 Hz, I dont know whats happening, the 2nd plot does not have any initial data.
fc = 100;
fs = 36000;
[b,a] = butter(6,fc/(fs/2));
figure()
freqz(b,a,[],fs)
xlim([0 200])
%%
fc = 10;
fs = 36000;
[b,a] = butter(6,fc/(fs/2));
figure()
freqz(b,a,[],fs)
xlim([0 200])
0 comentarios
Respuesta aceptada
Star Strider
el 26 de Jun. de 2023
It is best not to use the transfer function implementation of discrete (digital) filters, because those are frequently unstable. Use zero-pole-gain and second-order-section implementation instead.
Example —
fc = 100;
fs = 36000;
[z,p,k] = butter(6,fc/(fs/2));
[sos1,g1] = zp2sos(z,p,k);
figure()
freqz(sos1,2^16,fs)
set(subplot(2,1,1),'XLim',[0 200])
set(subplot(2,1,2),'XLim',[0 200])
%%
fc = 10;
fs = 36000;
[z,p,k] = butter(6,fc/(fs/2));
[sos2,g2] = zp2sos(z,p,k);
figure()
freqz(sos2,2^16,fs)
set(subplot(2,1,1),'XLim',[0 200])
set(subplot(2,1,2),'XLim',[0 200])
I also made a few small changes to improve the plots.
signal_filtered1 = filtfilt(sos1,g1,signal);
signal_filtered2 = filtfilt(sos2,g2,signal);
That should produce the correct result.
.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Filter Design en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!