Downsampling/Decimation - When is well done?

I am working on decimation of signal, and I want to know which is the best way to understand if the downsampling is well done or not. At the moment I am comparing the FFT of the source signal and the downsampled signal and I observed a downward shift of it (I think it is due to the lesser quantity of samples), I had also a look into the time behavior. Do you have other advices/suggestions?

EDIT

• one method to understand if the downsampling process is well done is by comparing the FFT of the decimated signal and the original signal. The original signal must be attenuated by the decimation factor as suggested in the answer from @user2934229. Otherwise the signals can be normalized by the length of the signal (not suggested in my case because the signal is too long);
• Can you clarify "well done"? The downsampling is simply removing samples. The only remaining source of "error" is in the low pass filter design. You either have a bad design or you have numerical issues (like rounding). Feb 13 '14 at 15:07
• I try to explain my doubts. The downsampling process is composed by lowpass filter + decimation. After filtering the input signal, I see that FFT of the input signal and filtered signal are the almost same at the frequencies below the cut-off frequency (that it is good). But after applying the decimation to the filtered signal (by throwing away some samples) I am observing the FFT of the downsampled signal presents an attenuation. I don't understand why. Feb 13 '14 at 15:47
• Correct me if I'm wrong, but it seems to me my answer provided with the information you seeked. If it did, it'd be fair to accept it as the answer for your question. Feb 2 '15 at 12:03
• Also, it might be beneficial for future readers to rephrase the question to incorporate your comment above, since this seems to be your real question - i.e. why does the signal seem to be attenuated when it is properly low-pass-filtered prior to downsampling. Feb 2 '15 at 12:22

I am observing the FFT of the downsampled signal presents an attenuation. I don't understand why.

The output of FFT (or DFT in general) isn't normalized - it is relative to the signal length (the total amount of samples being transformed). When decimating a signal (say, by a factor of M), you end up with a signal with 1/M length the original signal's length.

So, because DFT/FFT results are relative to signal length, a decimated signal with a 1/M length would have DFT/FFT components "attenuated" by a factor of M as well, even if the original signal was properly downsampled (i.e. bandlimited before being decimated).

To properly compare between the DFT of different signals, you should divide the output of DFT by the length of the transformed signal, to normalize the transform.

One either needs to have a signal that is already bandlimited to below half the new downsampled sample rate, or low-pass filter the signal before doing the decimation. If the latter, then the downsampling is "well done" if the low-pass filtering is "well done".

• I understood this. But how I can evaluate from the downsampled signal is well done or not? What can I compare? Feb 12 '14 at 18:15

If your data is already bandlimited such that downsampling will not produce any aliasing, then you will not notice any difference. For example, if your data is sampled at 1000Hz, but there's not spectral content above 250Hz, downsampling by a factor of two to get a new sample rate of 500Hz will not produce any aliasing.

Now suppose you do have spectral content above 250Hz and you want to asses how well downsampling with an anti-aliasing filter will suppress any aliasing, then you must design the filter to your specifications. Typically you will set the stop band attentuation level to something like 30dB or more and then plot the filter to see if indeed is properly designed.

If it is, then it's safe to say that any signals in the stop band will be attenuated by that amount. That's just how filtering works. Long story short, design the filter to your specification and plot it. If it isn't, consider increasing the filter order.

When you down sample the signal it will spread and may overlap or leak,or in generally cause problems because of that spreading of it.So you should apply filters in order to restrict that behavior,and take care that you downsampling it with factors that will not bring it down that the fundamental frequency range (fs/2).I hope that helps!

It depends entirely how your spectrum looks and what type of signal you have that you want to decimate.
If you have a signal only (no interferers in band), you have to design a filter that suppresses any images resulting from the decimation process. The amount of filtering depends on how much you need to suppress the image signal to maintain an SNR that still allows you to decode the signal.
If you have a signal with an interferer, the amount of filtering would have to take into account how much the interferer and signal images needs to be suppressed to have an good SNR afterwards.
So the quick answer is to look at SNR before and after decimation to tell you if you have done it properly.

A decent ,,downsampling'' (let's say for obvious audio purposes) would, as you observed, just scale the spectrum and pad it with zeroes at the upper end.

The point would be that this is hard to do. Just inserting zeros (let's say one between each pair of samples) will mirror the spectrum into the upper half of the new spectrum. You would first insert zeros and then filter with as steep a filter as you can get. This will introduce error.

You were talking about decimation, which means removing samples. That would upsample your signal. I suppose you were referring to inserting samples instead.

• I have a signal @ 200 Hz and I want to pass to 100 Hz and 50 Hz. At the moment I've applied a FIR ( Parks-McClellan design ) a then a decimation function for removing the "unuseful" samples. How can I decide if it is good or not? Feb 12 '14 at 16:39
• In that case you would need to insert samples instead of removing. So it should not be good at all. Feb 12 '14 at 17:15
• Do you have any source for your use of up- and down-sampling? In my experience, increasing the apparent sampling rate is called "up"sampling, decreasing the apparent sampling rate is called "down"sampling. Reducing the sampling rate means lengthening the sampling step, i.e., decimating the sample sequence. Feb 12 '14 at 17:55
• @LutzL is right. I've the same information about:(Loosely speaking, "decimation" is the process of reducing the sampling rate. In practice, this usually implies lowpass-filtering a signal, then throwing away some of its samples - DSPGuru.com) Feb 12 '14 at 18:11