Message Boards Message Boards

GROUPS:

What are the valid specs for a FIR implementation of a bandstop filter?

Posted 5 months ago
533 Views
|
2 Replies
|
0 Total Likes
|

Hi all, I am trying to compute the coefficients of a FIR in order to implement a digital bandstop filter. I would like to issue the command

a = LeastSquaresFilterKernel[ {"Bandstop", {{3.70, 11.8}}}, 10^5] 

which would be "find 10^5 coefficients for a bandstop filter with resonance frequency 3.7 Hz and quality factor Q = 11.8" To me this request seems reasonable, at least as reasonable as

a = LeastSquaresFilterKernel[ {"Bandstop", {{1., 10}}}, 10^5 ]; (* works *)

but still, when I issue that in Mathematica I get

LeastSquaresFilterKernel::spec: {Bandstop,{{3.7,11.8}}} is not a valid filter specification.

Anyone knows what's wrong with that? Thank you very much for your suggestions.

Guido

2 Replies

Guido,

The wc term is not in Hz -- it is a number between 0 and Pi, where Pi is Nyquist frequency. You need to decide on the time spacing of your FIR points (your sample rate) and scale wc accordingly. Also, I am surprised that any real application would require an FIR filter of length 10^5 points -- are you certain you need that many points? Typically the filter is a much shorter "Kernel" that gets convolved with a longer time sequence (maybe 10 up to a few hundred points). If you make the FIR very long, while it may be sharper, you suffer a huge time delay. Also, sharp cutoff filters often suffer from ringing in the time domain.

I hope this helps.

Regards

Neil

Posted 4 months ago

Thanks for the reply, in the meantime I tried to do the same with Matlab and realized exactly what you said, that indeed to design a notch filter 3 coefficients could be enough. And also that the wc term is

wc = PI * f_cut / f_nyquist = 2*PI * f_cut / f_s

As soon as I get back to mathematica I will try that and eventually post again. Thanks a lot for the reply, that pointed me to the right direction!

Best, Guido

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract