Given $$c(t) = \cos(2\pi\cdot 30 \cdot t) $$

If we sample this signal at the Nyquist rate 60 Hz and at a higher rate of 80 Hz, we get the following:

enter image description here

There is no aliasing as $f$ = 30 Hz is less than or equal to the folding frequency, 30 Hz and 40 Hz, respectively.

Why does sampling at a rate of 80 Hz result in this "distorted" cosine signal, although it is higher than the Nyquist rate? (I know if we go way higher than 80 Hz the signal will look better.)

  • 6
    $\begingroup$ why not just change "$\cos(⋅)$" to "$\sin(⋅)$" and see what happens? $\endgroup$ Commented Jan 18, 2020 at 8:02
  • 1
    $\begingroup$ You can't Shannon-sample a signal with infinite energy, but you can Nyquist sample it. Nyquists sampling theorem deals with periodic signals and how to sample them to get representations via a trigonometric polynomials. $\endgroup$ Commented Jan 18, 2020 at 19:44
  • $\begingroup$ @LutzLehmann i must confess that there is almost nothing that i understand in your comment. $\endgroup$ Commented Jan 22, 2020 at 17:32

5 Answers 5


It is actually not distorted, it is sampled at high enough rate. What fools you is the straight lines drawn between sample points, it gives you a false impression of the waveform. It shows you a linear interpolation of the signal. It does not represent how the signal would actually look like. A sampled signal exists only at the sample points, and to convert that into continuous analog representation that also exists between the sample points, you should use sinc interpolation which limits the bandwidth to half of the sampling rate.

  • $\begingroup$ See youtu.be/cIQ9IXSUzuM?t=287 "D/A and A/D | Digital Show and Tell (Monty Montgomery @ xiph.org)" $\endgroup$
    – Nayuki
    Commented Jan 20, 2020 at 6:46

The actual requirement is to sample at GREATER then twice the bandwidth, not at a rate equal to it...

So only your 80Hz same set actually meets the requirement, because the 60Hz case is ambiguous in general, consider if you were sampling sin (2PiFt) instead then you would get a flat line at zero amplitude.... And changing the angle between sin and cos would just produce a waveform having variable amplitude, which is not what the original wave does.

You are filling in the gaps by joining the dots, not by low passing the impulse stream, and that does not work, all those sharp spikes represent energy way outside the bandwidth limit.

The reconstruction filter is where the magic happens.

  • $\begingroup$ If you want to capture a signal with frequency B, how much more than 2B would you mathematically require? I reckon it would depend on the magnitude of the frequency, but is there a rule of thumb? 1Hz? 1%? $\endgroup$
    – mhh
    Commented Jan 19, 2020 at 16:43
  • 3
    $\begingroup$ @mhh How good are your reconstruction filters? The greater the sample rate compared to the signal of interest, the easier the filter design becomes. CD digital audio went for ~10%, which turned out to be a pain (Mostly because flat group delay was hard) when using just analogue reconstruction filters, but just fine if you do the digital filter thing and then run the analogue filters at a higher output rate. $\endgroup$
    – Dan Mills
    Commented Jan 19, 2020 at 17:17

There is no aliasing as 𝑓 = 30 Hz is less than or equal to the folding frequency, 30 Hz and 40 Hz, respectively.

Yes and no. There isn't significant aliasing when you're sampling at 80Hz, because the resulting signal has frequency components at 30Hz and 50Hz. The result is thus unambiguous as long as you take that 50Hz signal into account.

There is aliasing when you're sampling at 60Hz, because a 30Hz signal sampled at 60Hz translates into two signals at 30Hz, and you cannot know which is which. This is why the Shannon/Nyquist sampling theorem says that you need to sample at more than twice the bandwidth of the signal.

Why does sampling at a rate of 80 Hz result in this "distorted" cosine signal, although it is higher than the Nyquist rate? (I know if we go way higher than 80 Hz the signal will look better.)

Because you are not reconstructing the signal correctly. The Shannon/Nyquist theorem doesn't say that the results of sampling won't look funny, it says that when you're done sampling, you'll have enough information to reconstruct the signal.

You need to run that sampled signal through a reconstruction filter that passes 30Hz and blocks 50Hz -- the output of that filter will be a pure 30Hz tone, to the extent that the filter blocks 50Hz.

  • 1
    $\begingroup$ This paper may help. There's a lot of creative ways to misunderstand the Shannon/Nyquist theorem; I tried to cover the most common ones in that paper. $\endgroup$
    – TimWescott
    Commented Jan 18, 2020 at 18:00
  • 1
    $\begingroup$ The statement on the Shannon sampling theorem is wrong. A truly bandlimited signal with finite energy can be sampled at twice the bandwidth with perfect reconstruction. But only if you include the infinitely many samples in the infinite reconstruction sum. The basis functions fall like $1/t$, so that the influence of a sample falls very slowly with the distance in time. $\endgroup$ Commented Jan 18, 2020 at 20:34
  • 2
    $\begingroup$ @LutzLehmann I don't see how that would work with a pure sine wave. Sampling it at exactly twice the bandwidth hits the nulls at all samples, infinite or not. $\endgroup$
    – pipe
    Commented Jan 18, 2020 at 22:19
  • $\begingroup$ @pipe : A pure sine wave does not have finite energy, thus is not covered by the sampling theorem. Any kind of windowing to make the energy finite will in general destroy the limitation to a bounded frequency band or, at best, increase the limit frequency by some amount inversely proportional to the feature size of the window function. $\endgroup$ Commented Jan 18, 2020 at 22:30
  • $\begingroup$ @LutzLehmann The universe has only been with us for a finite time, and has a finite predicted lifespan. Therefore, I'll stick to the inequality. To be complete, you need to take into account that the reconstruction time is inversely proportional to how close you push up to the Nyquist rate: you can by no means get arbitrarily close to the Nyquist rate unless you're willing to allow reconstruction to get arbitrarily long. $\endgroup$
    – TimWescott
    Commented Jan 19, 2020 at 0:22

Remembering from my 1970 Signal Processing lectures we have ...

The crucial thing is the filter used to reconstruct the signal. Let's do the theory first for ideal sampling a perfect sine wave at 2x its frequency and filtering with an ideal low pass filter.

  1. The samples are infinitely thin - they are delta functions separated by time t.

  2. The filter is an ideal low pass filter with infinite slope at the pass frequency - the response drops vertically.

  3. If you put a single delta function pulse through such an ideal filter you get a sin(x)/x response which has values above and below the x axis. The response is zero at the axis crossing points t, 2t, 3t, 4t etc. The response begins at -infinity, peaks at 0 and goes on to +infinity. It is delayed by a time set by the cut off frequency of the filter which is equal to the time between the pulses.

  4. If you put a stream of delta functions separated by time t through such a low pass filter you get a sin(x)/x response for each pulse. For pulse n at time = nt every other pulse has a zero response. Hence there is no aliasing -- the peak (or sampled value) output for each pulse is completely separated from the outputs for all the other pulses.

  5. The output for each pulse is a sin(x)/x curve. Adding all the sin(x)/x curves for all the pulses reconstructs the signal exactly.

  6. The output for a single pulse stretches from -infinity to +infinity

Now to the real world ...

Such a pulse is impossible to create.

Such a filter is impossible to create not least because it has a response which goes back to minus infinity. The filter must have some slope (so many dB/octave) and it does not have a perfect sin(x)/x output response. The less steep the slope, the further from sin(x)/x and the more aliasing.

So, in the real world, any sampling will distort the signal because of the imperfect pulse used and the imperfect filter used to recreate the signal. The best results are obtained with the narrowest pulse you can create and the steepest drop off you can create.

Sampling at frequencies greater than 2x improves the quality because the gaps between the pulses are smaller and the errors introduced by not having a sin(x)/x output response from the filter become smaller.

See Nyquist–Shannon sampling theorem at https://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem which shows the sin(x)/x curve and its zero crossings.

Also, try using a smooth curve to join your points in your graph - you will get a much better representation.

And finally, obviously if the sampling frequency is exactly 2x the sine wave frequency every sample will be at the same point in the sine wave and all will be equal. It's a bit of an exception and I cannot remember how it is resolved - I think it is the sin(x)/x which re-creates the original sine wave even though all the sampled points are the same value. A quick check with 100 sample points in a spreadsheet would resolve it ...


Since this is a pure sinusoid, it has a bandwidth of 0 Hz. You can multiply it by a carrier signal of the same frequency, pass it through a low pass filter then take only a few samples. What matters is NOT the frequency of the signal, rather the bandwidth. Consider for example a voice signal modulating a 1 GHz carrier. It will be very costly, to sample this at more than 2 GHz. Instead, we apply the method above and we will need only to sample at twice the voice bandwidth.


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.