1
$\begingroup$

I have a 50-60Hz signal being sampled at a frequency of 25 kHz & I'm trying to filter all frequencies beyond 70 Hz with a reasonable steep transition band (approx 4 Hz) & good attenuation (~40+ dB).

For this, I tried a Windowed sinc filter using the following parameters :-

Cutoff frequency, fc = 70 / 25000 = 0.00280

Bandwidth, BW = 4 / 25000 = 0.00016

Filter length, M = 4 / 0.00016 = 25000

The problem here is the filter length. The value of 25000 means a window that's 1 second wide while my target is typically around 500-1000 samples, i.e. 1-2 cycles at 50 Hz.

I can't increase the bandwidth & I'm not sure what other options I have to meet this filtering requirement. So, my questions are,

  1. Is the windowed sinc not a suitable filter for this application?
  2. Considering that the sampling frequency is so high, shouldn't it be quite easy to achieve this type of filtering with a small filter kernel?
  3. Is there any other filter that I can use for this? My requirement is to offer good attenuation to all signals beyond 70 Hz using a small window. The choice of the filter isn't of much concern.
$\endgroup$
3
  • $\begingroup$ Why do you use the notation for the filter length as M, and why do you calculate it as the inverse of the bandwidth? Also, you forgot a 2 in the calculation of fc and BW (considering the normalized to 1 notation). $\endgroup$ May 9, 2018 at 4:17
  • $\begingroup$ I picked this up from the book "The Scientist and Engineer's Guide to Digital Signal Processing". dspguide.com/ch16/2.htm. The example in dspguide.com/ch16/3.htm was the reference I used & it doesn't seem to have a missing 2? Or maybe I overlooked something? $\endgroup$ May 9, 2018 at 15:46
  • $\begingroup$ He seems to note M as the length, but that's usually the mid point; N, or L, are usually the length. It's not set in stone. However, quote from eq. 16-3: The length of the filter kernel, M, determines the transition bandwidth of the filter. This is only an approximation since roll-off depends on the particular window being used.. In the meantime, try this, maybe it will suit you better. $\endgroup$ May 9, 2018 at 15:59

2 Answers 2

0
$\begingroup$

Your real problem isn't with creating a filter. Your real problem is likely that, depending on your S/N, only 1000 samples or less at 25ksps is too short a time for any FIR or IIR filter to react significantly differently given 68 or 72 Hz spectrum input, to give you the 4 Hz transition band you desire. Instead, you might want to try using a parametric or least squares curve fitter to your 50-60 Hz signal of interest, rather than a naive filter.

$\endgroup$
4
  • $\begingroup$ Could you point me to some resources where I can get more info on these methods? FIR & IIR filters are what I've used for most applications & these are quite new to me. Also, is there no way (even theoretical) that an FIR Windowed Sinc could give such a response? I can't see any based on the equations I've mentioned in the question but I'm curious. $\endgroup$ May 9, 2018 at 15:55
  • $\begingroup$ Yes. A windowed Sinc could possibly give you the frequency response you desire. But it would be have to be longer than 1000 taps. And for it to work, the data would likely need to be multiples of the filter length. $\endgroup$
    – hotpaw2
    May 9, 2018 at 19:15
  • $\begingroup$ Could you point me to some resources for the other options that you mentioned? The parametric/least squares curve fitter? $\endgroup$ May 12, 2018 at 18:03
  • $\begingroup$ Parametric fit? That’s a different enough topic that it deserves it’s own separate/new question. $\endgroup$
    – hotpaw2
    May 12, 2018 at 23:08
0
$\begingroup$

The following is all assuming we are interested in Finite Impulse Response (FIR) filter design.

The cutoff frequency is not really the determining factor in the filter length. The 3 main things that determine the filter length are: the amount of passband ripple, the amount of stopband attenuation and the relative size of the transition band, i.e., the size of the band going from the passband to the stopband. Cutoff frequency will affect the design if it is really close to 0 Hz or half your sampling frequency.

The smaller the size of the transition band the longer your filter is going to be. To specifically answer your questions.

The sinc filter design is largely by trial an error to achieve your desired specifications. You play with the length of filter, the type of window used, and the filter cut-off to try to meet your specifications. So it may not be the most suitable in terms of trying to meet your spec. That said, it will give you an idea of the size of filter that would be required. Other design techniques are likely to require filters of similar lengths.

Regarding the transition width and sampling frequency, as I mentioned above it is actually the opposite. The smaller the transition width, the longer your filter is going to need to be.

One alternative, is to actually downsample your signal to reduce your sampling frequency. Since you are attenuating all signals above 70 Hz, why not just use decimation? The advantages of this technique are:

  1. Reduced computational load
  2. The filters used can be much smaller because they can have larger transition widths.
  3. If really needed, you can upsample to get the data back to the original sampling rate using the same filters you used for the downsampling.

The main disadvantage is that your overall design is a bit more complicated. A good reference for this is "Multirate Signal Processing" by Crochiere and Rabiner.

If you are looking for the smallest filter lengths, then using the Parks–McClellan algorithm based on the Remez exchange technique has the shortest filter lengths for meeting passband ripple and stopband attenuation levels.

$\endgroup$
2
  • $\begingroup$ The transition width is indeed the key factor here. Going from 70 Hz with zero attenuation to high attenuation within 4 Hz is a tough one but I'm not sure how downsampling would make things better. Say I decimated by a factor of 100. Even with 250 samples per second, I still get the same filter length of 1 second / 250 samples. It's not the computational load that worries me but the number of cycles that it takes to do the filtering. 1 second is around 50 cycles for a 50-60 Hz signal while I'm trying to achieve this in 1-2 cycles. $\endgroup$ May 9, 2018 at 16:02
  • $\begingroup$ Yes, you are correct. When you downsample, the required filter becomes smaller (fewer taps) but overall length in term of time i.e (Number of taps * sample rate) will remain pretty much equal. In this case I don't have a good solution for you. $\endgroup$
    – David
    May 9, 2018 at 17:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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