# Oversampling and Aliasing

I am really confused about oversampling and upsampling. I know that upsampling means stretching our signal in time domain by a factor of K, then interpolating some values or using just zeros. As I found out stretching in time domain is shrinking in frequency domain by the same rate. For example, stretch by factor of 2 in time domain mean shrinking by factor of 2 in frequency domain.

Let talk about oversampling, we just increase the sampling frequency more than Nyquist rate. Then we have too much information. Is there any chance to have aliasing? I mean in time domain, lets say I am sampling my signal (frequency is 70 Hz) by sampling frequency equals to 280 Hz (Nyquist*2) so, is there aliasing in frequency domain? Sorry if my explanation is not clear. It is because I am bewildered with these concepts; oversampling, upsampling, downsampling, undersampling, critical sampling and aliasing.

theoretically, I know them but when it comes to practical view, I have serious problem.

When upsampling, you don't really stretch the signal in time. You insert new samples between the existing ones, without modifying the times at which those samples were taken. One property of upsampling is that the waveform remains exactly the same before and after the process; you just increase the number of samples. Note that the main difference between oversampling and upsampling is that the former occurs at the time of sampling, and the latter occurs after sampling has already been done. If there is no aliasing, in theory both produce the same result.

Aliasing is only present when there is a signal at the input of your sampler whose frequency is higher than the Nyquist frequency. In your example, if you sample a 70 Hz signal at 280 samples per second, you will not have aliasing. However, in practice you will not always have precise knowledge or control over the signal you're sampling. For example, you may want to sample a signal coming from an antenna. You don't know in advance what signals are going to be picked up by the antenna. In a case like this, one approach is to low-pass filter the signal before sampling, to ensure no aliasing will happen.

• But what about down sampling and under sampling. According to your description, they act the same way. Down sampling after sampling occurred and under sampling when the signal is going to be sampled. Right? Mar 11, 2015 at 0:24
• On the other hand, you say that we have aliasing just when we have under sampling? Mar 11, 2015 at 0:25
• @David, you're right, downsampling happens after sampling. Say you sample a narrowband, high frequency signal, and then you shift it (in DSP) to low frequency. After shifting, you can safely reduce your sampling rate and decrease the running time of your code. On the other hand, undersampling is almost always undesirable -- it means you didn't sample at the rate you needed to satisfy Nyquist. Both can introduce aliasing. However, most DSP programs low-pass filter the signal before actually downsampling it, avoiding any aliasing.
– MBaz
Mar 11, 2015 at 1:13
• "When upsampling, you don't really stretch the signal in time. You insert new samples between the existing ones, without modifying the times at which those samples were taken." well, M, you can play the new buffer (with inserted samples) back at the same sample rate and a slower tempo (and lower in pitch). also, upsampling need not be just inserting samples between existing samples (which would be equivalent to Lagrange or a windowed sinc() function). it could be some optimal interpolation kernel that is different from a windowed sinc(). Mar 11, 2015 at 3:56
• @robertbristow-johnson: of course; the main point is that upsampling doesn't stretch or compress the signal in time, which is what the OP was confused about.
– MBaz
Mar 11, 2015 at 15:14

lets say I am sampling my signal (frequency is 70 Hz) by sampling frequency equals to 280 Hz (Nyquist*2) so, is there aliasing in frequency domain?

It depends. If you have harmonics higher than Nyquist frequency then there will be aliasing. If you sample a pure sinusoid, which has no harmonics, no aliasing can occur.

E.g taking a square wave at 70Hz, which has harmonics 3, 5, 7, etc... and sampling it at the rate of 280Hz:

It seems there are no aliases, but actually all harmonics are aliased at 70Hz (even harmonics would be aliased at DC or 140Hz, but there are none).

Let's increase (or decrease) the sampling rate so it's not a multiple of 70Hz. E.g sampling at 285Hz:

Gosh now we see additional components in the spectrum... Let's increase the rate to 320Hz to space them a bit more:

See how amplitude decreases from 70 Hz to 110 to 30 to 150, changing side relatively to 70Hz. This means these frequencies are actually aliases of spectral components with increasing frequencies:

• Harmonic 3: 210Hz --> aliased at 110Hz [160-(210-160)]
• Harmonic 5: 350Hz --> aliased at 30Hz [160-(480-350)]
• Harmonic 7: 490Hz --> aliased at 150Hz [160-(490-480)]
• Harmonic 9: 630Hz --> aliased at 10Hz [160-(630-480)]
• Harmonic 11: 770Hz --> aliased at 130Hz [160-(800-770))
• etc.

Nyquist frequency (half Nyquist rate) must be higher than the highest component frequency (including harmonics) else aliasing occurs. Basically component must be a sinusoid not to have harmonics, or harmonics must have an insignificant amplitude.