I am trying to filter an audio signal with kaiserord in MATLAB, but I'm having a problem. Here is my code:

fcuts=[50 100 20E+3 20.1E+3];
mags=[0 1 0];
devs=[0.05 0.01 0.05];
[n,Wn,beta,ftype]=kaiserord(fcuts,mags,devs, fs)  %fs from my audio signal
hh=fir1(n,Wn,ftype,kaiser(n+1, beta),'scale');
filtered=filter(hh,1,W) %W is my audio signal

I try to filter audio with $50\textrm{ Hz}-20\textrm{ kHz}$ bandpass filter but after applying filter; I realize that there is signal before $47\textrm{ Hz}$,

Where is my mistake?


Your filter is a stop band attenuation of about 40 dB. Frequencies outside your passband will be attenuated by at least 40 dB but they will not go down all the way to zero.

The FIR filter is very long (2000 or samples). It takes that many samples for the filter to reach "steady state". In other words, you should throw away the first 2000 samples of your filtered signal before doing any analysis on it.

  • $\begingroup$ Thank you, I add silence to my file, filter this, and finally remove the silent part from file, And the result is ithe same, How can I fix it? $\endgroup$ – M.Dio Jan 20 '17 at 8:25
  • $\begingroup$ How much 47 Hz are you seeing? $\endgroup$ – Hilmar Jan 20 '17 at 14:38
  • $\begingroup$ only 1 . What may be the problem? $\endgroup$ – M.Dio Jan 23 '17 at 5:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.