Sampling theorem clarifications

whenever the sampling theorem was explained to me, a situation of this kind was proposed to me.

If we look at the previous image we will see that the condition to avoid spectral aliasing is that we have

$$\f_S \gt 2 f_0\$$

But now let's consider this specific situation (which corresponds to a pure sinusoidal signal):

or also a more general situation in which there is a certain bandwitdth on the positive frequency axis. In this case, which is the condition to avoid aliasing?

The sample rate needs to be greater than (not greater than or equal to) twice the maximum frequency of the signal of interest. As @Michael pointed out, sampling a sine wave of exactly 100Hz with a sampling frequency of exactly 200Hz results in data that is indistinguishable from dc.

Reconstructing the input sine wave requires a filter on the output values, not on the input side. (The filter on the input side is for anti-aliasing, another matter entirely.) Ideally, both filters would be brick-wall filters at the Nyquist frequency. See reconstruction filters.

• Not quite! The sample rate needs to be strictly greater then twice the BANDWIDTH (which does not have to start of 0Hz)... This allows subsampling and related techniques. – Dan Mills Nov 15 '19 at 16:33
• @DanMills Good point, thanks for clarifying that. – Elliot Alderson Nov 15 '19 at 17:09

All the answers given so far are incorrect. The Nyquist sampling rate only applies for a lowpass signal. With a bandpass signal you can utilize what is known as undersampling.

If you sample a band limited signal occupying the bandwidth $$\f \in [f_L, f_H]\$$ at some frequency $$\f_s\$$, you will get the expected repetition in the frequency domain.

source

If you are careful about your sampling frequency, you can avoid aliasing without needing to sample at the Nyquist rate for a lowpass signal. The sampling frequency must satisfy

$$f_s \in \left( \frac{2f_H}{n}, \frac{2f_L}{n-1} \right)$$

where $$\n \in \mathbb{N}\$$ is a natural number such that

$$n \leq \left\lfloor \frac{f_H}{f_H - f_L} \right\rfloor.$$

Note that $$\f_L = 0\$$ yields $$\n = 1\$$, which gives you the Nyquist sampling rate

$$f_s \in (2f_H, \infty).$$

Nobody has mentioned the duration of the sampling. For ideal reconstruction, the samples need to be taken at a rate above twice the band-limited bandwidth. How far above twice the bandwidth depends on the duration of the sampling. Sampling infinitesimally above the Nyquist rate is only good for infinite length sampling (e.g. you started before the Big Bang). Realistically, the time limited window of your samples corresponds to a rectangular time window, which spreads the windowed signal out in the frequency domain. So the sample rate needs to be higher to account for that windowing spread of bandwidth.

For narrow-band signals in zero noise, even at very high frequencies, you can sample at only somewhat above twice the bandwidth, e.g. for a 100 MHz signal with no more than 10 kHz of bandwidth (and absolutely nothing in the total signal outside that bandwidth), you can probably get away with sampling at 33 to 40 kHz, or maybe at a lower rate towards just above 20 kHz if you sample for a very very long time. No need to sample somewhat above 200 MHz, unless your band-limiting filter goes bad, and noise outside the 10 kHz bandwidth leaks in.

In order to avoid aliasing, according to Nyquist, you need to sample at a frequency of at least twice the value of the highest frequency you wish to measure. For your sinusoidal input, there is ideally only frequency content at the 100Hz mark, meaning you need to sample at 200Hz minimum for no aliasing to occur.

Do keep in mind however, if you sample at 200Hz, you only sample the sine wave twice per period, meaning that depending on where those samples fall, you may measure drastically different values. For example, if the samples fall on the zero crossings of the sine, you would measure 0V DC. Sampling 5-10 times the highest frequency helps ensure that your sampling produces a more accurate representation of your initial signal.

• @DKNguyen Can you clarify "stops the high frequency junk from aliasing...it doesn't mean it doesn't exist anywhere in the samples". If the high frequency "junk" isn't aliased, then how does it "exist" in the sample data? – Elliot Alderson Nov 14 '19 at 19:36
• @DKNguyen But exactly, mathematically, how does the high frequency "junk" alter the sample data without aliasing? In what way precisely does the sample data differ because of high frequency "junk" that is not aliased? You are using a lot of vague language here, and I think that statement you made is mistaken. – Elliot Alderson Nov 14 '19 at 19:43
• @DKNguyen But those high frequency components are being aliased...that's the whole point. From the standpoint of the sampled data that junk is in the pass band. If you properly reconstruct the sampled data you can not get any frequency components above the Nyquist limit. There is no way other than aliasing that high frequency components can appear in the sampled data. – Elliot Alderson Nov 14 '19 at 19:51
• @DKNguyen I'm talking about what you called "high frequency junk". You said "sampling at Nyquist...stops [it] from aliasing" but nevertheless could "exist...in the samples". Those were your words, I just want you to clarify what you meant by "exist in the samples" and how that was different from "aliasing". Your words clearly referred to the sampled data rather than the reconstructed data since you talk about preventing aliasing. – Elliot Alderson Nov 14 '19 at 21:22
• The Nyquist limit is a strictly greater than limit, not a greater or equal to limit. So where you said "you need to sample at 200Hz minimum" it should be "you need to sample at more than 200 Hz" – The Photon Nov 14 '19 at 21:39