Filter löschen
Filter löschen

Zeros on [b,a] output of butter filter

5 Ansichten (letzte 30 Tage)
Shaula Garibbo
Shaula Garibbo am 20 Jan. 2020
Kommentiert: Star Strider am 21 Jan. 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.

Akzeptierte Antwort

Star Strider
Star Strider am 20 Jan. 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 Kommentare
Shaula Garibbo
Shaula Garibbo am 21 Jan. 2020
Thank you! Being pointed in the right direction is incredibly useful.
Star Strider
Star Strider am 21 Jan. 2020
As always, my pleasure!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by