What should the order of my FIR filter be?

22 visualizaciones (últimos 30 días)
Emilia Butters
Emilia Butters el 27 de Mzo. de 2020
Comentada: Star Strider el 30 de Mzo. de 2020
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!

Respuestas (1)

Star Strider
Star Strider el 27 de Mzo. de 2020
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 comentarios
Emilia Butters
Emilia Butters el 30 de Mzo. de 2020
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 el 30 de Mzo. de 2020
I appreciate the update.
I will delete my Answer in a few minutes.

Iniciar sesión para comentar.

Community Treasure Hunt

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

Start Hunting!

Translated by