Zeros on [b,a] output of butter filter

5 次查看(过去 30 天)
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.

采纳的回答

Star Strider
Star Strider 2020-1-20
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 个评论
Shaula Garibbo
Shaula Garibbo 2020-1-21
Thank you! Being pointed in the right direction is incredibly useful.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Digital Filter Analysis 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by