# Upsampling/Interpolation and Downsampling/Decimation

I am having trouble figuring out exactly what is happening the process of downsampling/upsampling and the output in the example given below:

1. So the 100Hz sine wave is sampled at 2000Hz resulting in a fft output mirror about 1000Hz, the nyquist frequency.
2. It is then downsampled, effectively sampling this signal at 500Hz (factor of 4)/ or is it more a appropriate to say the signal now has characteristics like the 100Hz wave was sampled at 500Hz? This is achieved by discarding samples.
3. This wave is then upsampled by four, however I do not see what this does to benefit the signal? I understand afer this it is low-pass filtered to remove the new alias images due to downsampling, but surely you you could low-pass filter after the downsampling and still end up with the same frequency output, i.e. 100Hz? Or does it allow a 100Hz output with increased data points, which is better?

Thanks for taking the time to read my question and any help would be greatly appreciated!

So the 100Hz sine wave is sampled at 2000Hz resulting in a fft output mirror about 1000Hz, the nyquist frequency.

no. The FFT doesn't give you that. It's the spectrum as visualized here. It's an interpretation of the FFT (which is just an implementation of the DFT). For the DFT, it's just a single periodic function with a period of 5. That simple. No repetitions.

The repetitions in the visualization stem from the fact that mathematically, discrete spectra are periodic, and that the spectrum graphs were chosen to have frequency axis longer than a single Nyquist bandwidth. Again, the DFT doesn't care about what it means – it will just "show" that there is a periodicy of frequency $\frac 15$.

It is then downsampled, effectively sampling this signal at 500Hz (factor of 4)/ or is it more a appropriate to say the signal now has characteristics like the 100Hz wave was sampled at 500Hz? This is achieved by discarding samples.

You're starting to get into the right mindset. Yes, this is like a 100 Hz signal sampled at 500 Hz – count the samples! There's a repetition every five samples!

Generally, I recommend just "dropping" knowledge of the original frequency at the ADC. Really, it makes things easier. You're sampling a 100 Hz tone with 2000 Hz, so your period is 20 samples, and the relative frequency is $\frac 1{20}$. Then you decimate by 4 — leading to a relative frequency of $4\frac1{20}=\frac15$.

The DSP algorithms don't have any of that "original frequency" knowledge; as said, the DFT really doesn't care whether it's a 100 Hz signal sampled at 2 kHz, or it's a 4 MHz signal sampled at 80 MHz – all that counts is how long a period is, in samples, because all the DSP only sees your signal as sequence of numbers. One after the other – no matter how fast the orignal samples came in.

This wave is then upsampled by four, however I do not see what this does to benefit the signal?

Wrong question to ask. It's done to illustrative interpolation.

I understand afer this it is low-pass filtered to remove the new alias images due to downsampling, but surely you you could low-pass filter after the downsampling and still end up with the same frequency output, i.e. 100Hz?

Nononononono!

You didn't learn your lesson; yes, your signal after decimation could be filtered, but that would have no effect, because it still fulfills the bandwidth criteria set by Nyquist. That's why there's no anti-aliasing filter here – the signal is already sufficiently band-limited as is.

However, after interpolation, you will need an anti-imaging filter.

Because the inserting of zeros did exactly that, adding images where there should be none.

Or does it allow a 100Hz output with increased data points, which is better?

Again, not the question. This is an illustration, and the fact that you wanted to omit the anti-image filter shows that it's a good illustration: compare $|X_i|$ and $|X_u|$. You only want to see what's left in $X_i$, not all the spectrum that is in $X_u$!

• Hi Marcus thanks for taking the time to answer a few of the points, however i'm little unsure now about a few things: 1. The amplitude spectrum is an interpretation of the DFT? 2. So I should think of it is a relative frequency, at 2000Hz the relative frequency of the signal is 1/20 (100Hz signal)? 3. After discarding samples the relative frequency increases from 0.05 to 0.2? 4. I don't understand what the benefit of the upsampling was? Aug 14, 2016 at 18:41
• 5. is there not images after the downsampling? As seen in the spectrum? Aug 14, 2016 at 18:41
• 1. yes, that's what I said. 2. yes, that's what I said. 3. yes, that's what I said. 4. not the question here, as I said :) 5. no, after downsampling there's aliasing, not imaging. Aug 14, 2016 at 19:47