Zeros on [b,a] output of butter filter

조회 수: 14 (최근 30일)
Shaula Garibbo
Shaula Garibbo 2020년 1월 20일
댓글: Star Strider 2020년 1월 21일
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.
Star Strider
Star Strider 2020년 1월 21일
As always, my pleasure!

댓글을 달려면 로그인하십시오.

추가 답변 (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