# How to filter a signal sampled at different frequencies

I have a signal which was sampled using different frequencies. The 3 regions are:

• 0-10 ms: 10000 Hz
• 10-50 ms: 1000 Hz
• 50-200 ms: 100 Hz

The signal is very noisy, so I thought about smoothing it with a low pass filter. I worked with each of the 3 regions independently:

1. Apply window in time domain (Hann window)
2. FFT
3. Apply half Hann window, to remove high frequencies
4. IFFT

Each of my regions looks better now but I am having problems stitching them back together, due to the beginning and end of each stage deviating considerably from the original values.

What is the standard procedure of applying a low pass filter to a signal sampled at different frequencies during several stages?

Edit:

In case it might be relevant, this is the half Hann window used as a low-pass filter. The window length (in the example, 50) is different for every region. I am not interested in a specific cut-off frequency; the filter is used to remove noise and I am evaluating the output visually.

• Is the low pass filtering you apply to all these three regions the same? What's the cutoff frequency for each of these regions? Mar 13, 2018 at 17:25
• @MarcusMüller Yes, it is the same. The cutoff frequency is different for each region, but playing around with these values doesn't really affect the stitching problem. Mar 13, 2018 at 18:33
• huh, that's a contradiction, or I'm not 100% getting that: It's the same filtering, but different filtering, because it's different in its cutoff frequency? Or is it that you use the same taps for each of the three rates, so it's $f_{cut}$ for the first region, $\frac {1}{10}f_{cut}$ for the second, $\frac1{100}f_{cut}$ for the third region? Mar 13, 2018 at 18:35
• so, what's the cutoff for the first region, as in Hz? Mar 13, 2018 at 19:42
• @Bernat Was my answer good for you?
– VMMF
Apr 16, 2018 at 21:26

If I were you I would define my sampling period as the period present in the interval with the highest sampling frequency. Then I would try to interpolate the sections of the signal that were originally sampled at a lower sampling frequency to obtain a uniform signal of the same sampling frequency.

Then I would filter the whole signal with the same filter.

This procedure is often used when you have non-uniform sampling intervals but it might work for you.

As you say that the signal is very noisy maybe interpolating is not good but you can try to and see how it works.

If you can be 100% sure that decimating the intervals with higher sampling frequency is not going to introduce aliasing you can try to decimate all the intervals to the lowest sampling frequency and avoid interpolating noisy samples.

Maybe even an intermediate solution would be the best. Take every interval to the intermediate sampling frequency, decimating the one with higher sampling frequency (if you are sure there's no aliasing) and interpolating the one with lower sampling frequency.

Since your 3 sampling frequencies are integer multiples of each other you can easily decimate or interpolate from any one to get any other

• Interpolation will just introduce different discontinuities at the edges of the sampling rate regions, wouldn't it, as the interpolator (anti-imaging) filter state wouldn't be continuous? Mar 13, 2018 at 19:09
• @MarcusMüller I will research about what you say but I think that if the sampling frequencies are multiple of each other (as in this case: 10000 , 1000, 100) there shouldn't be any discontinuities.
– VMMF
Mar 13, 2018 at 19:32
• well, you can do that - if you convert the last's period interpolation filter's state into the initial state of the next interpolation filter. But: in that case, why not do that with the filters you're planning to use right away? Mar 13, 2018 at 19:33
• I thought about saving the states of the original filters from one section to the next, but then I though that if they required different sampling frequencies the cutoff frequencies would vary
– VMMF
Mar 13, 2018 at 19:37
• @MarcusMüller I agree, it would be great if you could detail your solution in an answer. Mar 14, 2018 at 7:53