I have an application that displays several signals from different sensors at various sample rates. In order to display the data, I "stretch" the signal by repeating samples to match the highest sample rate. For example: if I display a 500 Hz signal and a 100 Hz signal at the same time, every sample in the 100 Hz signal will be repeated 5 times so it appears to have a 500 Hz sample rate.

When I apply filters to the signals (all second-order IIRs: LPF, HPF, notch) I use filters designed for the highest sample rate. In my example here, I'm using 500 Hz filters on an upsampled 100 Hz signal.

How "bad" is this? Is my only option to design an interpolation filter during upsampling, and if so, can anyone lead me to good references on how to design such a filter?


1 Answer 1


How "bad" is this?

It's not too good. What you are doing is equivalent to upsampling by a factor of five (i.e. inserting four zeros in between every sample), and then filtering it with a filter that has the impulse response [1, 1, 1, 1, 1]. The picture below shows the frequency response of this filter.

Averaging frequency response

The signal aliases introduced by the upsampling are centered at 0.4 and 0.8, so the good news is that the filter has a null at the center of the aliases. The bad news is that unless the signal has a really narrow bandwidth, the signal aliases will be much wider than the nulls, and a lot of alias energy will distort your signal.

Is my only option to design an interpolation filter during upsampling, and if so, can anyone lead me to good references on how to design such a filter?

If you want to understand how to design a low-pass filter then I would suggest learning about windowed sinc functions. If you just want to get a filter that works then I would recommend installing Octave and using the fir1 function to design the filter.

  • $\begingroup$ Thanks! I've designed low pass filters before... I even have filter functions in place for 100 Hz signals. The problem is that the current design will only allow for 1 sample rate to be displayed at a time (and that SR's filter functions to be used), which is the reason for upsampling. If, during upsampling, I apply some kind of linear or polynomial interpolation technique, can I expect the distortion to be lessened? Or would this still be the incorrect way of doing things? $\endgroup$
    – Micky
    Jul 15, 2013 at 14:35
  • $\begingroup$ It would be better than what you're doing now. Linear interpolation is equivalent to upsampling followed by a triangle filter, which is an improvement over a rectangle filter (what you are doing now). Non-linear interpolation can get better results than linear (though you have to watch out for over-fitting), but because it is non-linear it is difficult to analyze their performance. I am no expert on the topic, but achieving good polynomial interpolation appears to be more of an art than a science. $\endgroup$
    – Jim Clay
    Jul 15, 2013 at 14:52
  • $\begingroup$ If you want to go with polynomial interpolation I would go with either linear interpolation (guaranteed to be both safe and perform better than what you've got now) or quadratic interpolation (still pretty safe and will probably perform better than linear interpolation). If those aren't good enough I would use a standard low-pass IIR or FIR filter. $\endgroup$
    – Jim Clay
    Jul 15, 2013 at 14:54
  • $\begingroup$ Very helpful. If I decided to try a low-pass filter, would I use one designed for a 100 Hz sample rate or a 500 Hz sample rate? I assume the cutoff frequency would depend on the type of signal... $\endgroup$
    – Micky
    Jul 15, 2013 at 15:03
  • $\begingroup$ Design it for 500 Hz sample rate. The passband/cutoff should be such that it keeps the original signal but rejects the aliases. The "ideal" filter would keep everything up to 50 Hz and reject everything after that. The ideal filter, though, takes a lot of taps and introduces ringing, so give it as much transition band as you can afford. $\endgroup$
    – Jim Clay
    Jul 15, 2013 at 19:04

Your Answer

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

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