What should the order of my FIR filter be?

9 次查看(过去 30 天)
Dear all,
I'm having difficulty deciidng on the order (labelled as x) of an FIR filter. I am creating speech-shaped noise using audio files with an Nfft = 4096 & a sampling rate = 22050. When doing the following:
FIR = fir2(x,NormFrqs,MagSpect);
If the order is < Nfft (as is suggested), then when subsequently trying to use pwelch:
[spect,frqs]=pwelch(SSN, win_, overlap*Nfft, Nfft, Fs,'power');
Pwelch does not run as the window (ie. hann(Nfft) or rectwin(Nfft)) is greater than the the input sample (noise filtered through the FIR filter). Does anyone know what the solution to this is? I have tried making the order of the filter > Nfft, however, the resulting speech file is has an entirely different duration to the original audio files.
Thank you!

回答(1 个)

Star Strider
Star Strider 2020-3-27
The fir2 function documentation appears to favour even-numbered filter orders. (The only MATLAB functions that I know of that calculate the order for FIR filters are kaiserord and firpmord.) It’s likely best to experiment to determine the lowest filter order that successfully matches the design requirements.
  6 个评论
Emilia Butters
Emilia Butters 2020-3-30
Thank you for your help! I have in fact found the problem which was with the inputs to be pwelch function:
pwelch(x, window, noverlap, Nfft, Fs, 'power')
For the window, I was using hanning(Nfft) instead of hanning(length(data)) so that hanning(Nfft) was virtually always greater than x & prevented pwelch from functioning.
Star Strider
Star Strider 2020-3-30
I appreciate the update.
I will delete my Answer in a few minutes.

请先登录,再进行评论。

类别

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

Community Treasure Hunt

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

Start Hunting!

Translated by