Borrar filtros
Borrar filtros

Zeros on [b,a] output of butter filter

5 visualizaciones (últimos 30 días)
Shaula Garibbo
Shaula Garibbo el 20 de En. de 2020
Comentada: Star Strider el 21 de En. de 2020
Hi. I'm trying to create a low-pass filter for a large collection of audio files to make some room on my hard drives. I'm using the butter filter as follows:
fn = fs/2; %(fs = 32000)
fc = 125/fn; %normalised passband frequency = 0.0078
fz = 135/fn; %normalised stopband frequency = 0.0084
[n, wn] = buttord(fc,fz,3,60); %(n = 60, wn = 0.0078)
[b,a] = butter(n, wn, ftype);
But the 'b' output component is always made up of zeros (I just get blank graphs on the freqz plots).
I suspect I have misunderstood something along the line, but I am overall aiming for a filter that reads in the 32kHz audio file, and removes all frequencies over 125Hz, as I do not need them for my analysis. Any advice would be greatly appreciated.

Respuesta aceptada

Star Strider
Star Strider el 20 de En. de 2020
The filter is unstable. This can easily be remedied by converting to zero-pole-gain realization, and then second-order section implementation:
ftype = 'low';
fs = 32000
fn = fs/2; %(fs = 32000)
fc = 125/fn; %normalised passband frequency = 0.0078
fz = 135/fn; %normalised stopband frequency = 0.0084
[n, wn] = buttord(fc,fz,3,60); %(n = 60, wn = 0.0078)
[z,p,k] = butter(n, wn, ftype); % Use Zero-Pole-Gain Representation
[sos,g] = zp2sos(z,p,k); % Second-Order Section For Stability
figure
freqz(sos, 2^14, fs) % Filter Bode Plot
Then use:
signal_filtered = filtfilt(sos,g,signal);
to do the actual filtering.
  6 comentarios
Shaula Garibbo
Shaula Garibbo el 21 de En. de 2020
Thank you! Being pointed in the right direction is incredibly useful.
Star Strider
Star Strider el 21 de En. de 2020
As always, my pleasure!

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by