# Nyquist Frequency Phase Shift

The figure below shows in dashed lines sinusoidal signals of the same frequency at three different phase shifts. The signals are then sampled such that the sinusoidal frequency is exactly a half of the sampling frequency, i.e. the frequency of all the sinusoids is the Nyquist frequency. The samples taken from this signal are represented by the circles. From the figure, it seems that the amplitude of the digital sinusoidal signals is dependent upon the sampling rate and instant of sampling. In fact if the sampling times coincide with the zero-crossings of the sinusoid, then no signal will be detected at all.

I had initially thought that sampling a bandlimited analog signal at the appropriate sampling frequency would enable perfect reconstruction, but this counter-example has left me stumped. It seems that this sinusoid will generally not be reconstructed properly if digitized and then reconstructed at this rate. Have I gone wrong in my understanding, and if so, can someone please point me in the right direction?

Cheers!

The sample rate needs to be GREATER than (NOT just equal to) twice the highest non-zero frequency content of the signal being sampled. Just a little bit greater might work, but the closer the sample rate is to twice the signal frequency, the longer in time you may need to sample to raise the signal above the noise and complex conjugate image in a DFT/FFT result.

• corrected: greater than twice. not just greater than half. (got back from a trip to AU/NZ... must still be looking at fractions upside down. :) – hotpaw2 Feb 1 '14 at 4:55
• No, that is wrong. In the theorem, i.e., the idealized mathematical situation, the sampling frequency can be exactly twice the highest frequency. In any realistic context, there are no bandlimited signals, so the sampling frequency has to be higher to account for "leakage". – Lutz Lehmann Feb 1 '14 at 8:30
• The OP did not ask about theorems that only apply to signals that do not exist in practice. – hotpaw2 Feb 1 '14 at 12:41
• If intended or not, that is exactly what they asked. The whole question about the limiting frequency only makes sense for ideal band-limited signals, i.e., signals reaching from before the big bang to after the thermal dissipation of the universe. In any other context, there is no exact limiting frequency and thus no clear bound for the sampling frequency. One can only attempt to capture the bulk of the frequency content, which implies some kind of margin between the highest useful frequency and half the sampling frequency. – Lutz Lehmann Feb 1 '14 at 13:35
• @LutzL, we had these discussions on Wikipedia when i was [[User:rbj]] (before i was "community banned"). i don't find it useful to differentiate much from the quasi-sinusoid at Nyquist that puts in a quasi-dirac-impulse at Nyquist and "regular" signals. the simplest and accurate way to put it is that the sampling frequency must exceed twice the highest possible frequency represented in the continuous-time $x(t)$ in order to reconstruct it. – robert bristow-johnson Feb 1 '14 at 17:34

The sampling theorem states that $$f_\mathrm{S} \geq 2f_\mathrm{max}$$, where $$f_\mathrm{S}$$ and $$f_\mathrm{max}$$ are the sampling and maximum signal freuqency, respectively. But there's an additional condition: The equal sign only holds if the signal spectrum does not contain a dirac impulse at $$f_\mathrm{S}/2$$ which is clearly the case in your example. Therefore $$f_\mathrm{S} > 2f_\mathrm{max}$$ has to be fulfilled.

A reference for this statement can be found here, for example:

If a signal contains a component at exactly B hertz, then samples spaced at exactly 1/(2B) seconds do not completely determine the signal, Shannon's statement notwithstanding. This sufficient condition can be weakened, as discussed at Sampling of non-baseband signals below.

More recent statements of the theorem are sometimes careful to exclude the equality condition; that is, the condition is if x(t) contains no frequencies higher than or equal to B; this condition is equivalent to Shannon's except when the function includes a steady sinusoidal component at exactly frequency B.

The above is an excerpt of an earlier version of the according Wikipedia article.

• "Read a whole text book as the reference." -1. – Peter K. Jan 31 '14 at 21:31
• @Peter K. Could you please clarify where you think my answer is wrong. I don't get your comment. Thanks – Deve Jan 31 '14 at 22:11
• The link you have in "A reference for this statement can be found here, for example." is to, effectively, a whole book. Which is useless as a reference to back a one paragraph statement. – Peter K. Jan 31 '14 at 22:14
• @Peter K. Ok, I see. I'm referring to the fourth paragraph of the very page I've linked, not to the book as a whole. I'll edit my answer accordingly. – Deve Jan 31 '14 at 22:20
• OK, thanks for the response. I've edited the question to include the relevant quote. – Peter K. Jan 31 '14 at 22:31

By definition, band-limited signals in the sense of the sampling theorem have finite energy. Sine waves are periodic and thus have infinite energy. So any dirac pulse in the Fourier transform is not permissible.

To be more precise, the sampling theorems only applies to signals that can be represented as

$$x(t)=\int_{-f_s/2}^{f_s/2} X(f)\,e^{2\pi i\,ft}\,df$$

with $X\in L^2$. In the class of $L^2$ functions, values at specific points do not matter, so the values of $x(t)$ do not depend on the specific values of $X(\pm f_s/2)$.

Any realistically occuring signal $x(t)$ is of finite length and thus has a continuous Fourier transform. For any approximation of "band-limited", the Fourier transform $X(f)$ needs to have negligible values at $\pm f_s/2$ and beyond.

Addendum: Any finite signal that looks for some time segment like a sine wave $\sin(2\pi ft)$ and sports a sufficiently smooth fade-in and -out has smooth peaks in its spectrum around the frequencies $\pm f$. Outside the peaks, the amplitude goes towards zero, but never does reach it to stay at zero. Thus one has to define a threshold of where the amplitude is for practical purposes identical to zero, absolute or relative to the peak value of the amplitude. But that leads to the frequency contents of the signal to be contained in between $\pm (f+h)$, so that even the strict rule requires a sampling frequency of at least $f_s=2(f+h)>2f$.

• again, even with the Addendum, you're missing the point, Lutz. since comments have limited length, i'll put this into an answer. – robert bristow-johnson Feb 2 '14 at 18:22

again, even with the Addendum, i think Lutz's answer misses the point. the point is (quoting Wikipedia):

To illustrate the necessity of $f_s \ > \ 2B$, consider the family of sinusoids (depicted in Fig. 8) ) generated by different values of $\theta$ in this formula:

$$x(t) = \frac{\cos(2 \pi B t + \theta )}{\cos(\theta )}\ = \ \cos(2 \pi B t) - \sin(2 \pi B t)\tan(\theta ), \quad -\pi/2 < \theta < \pi/2.$$

With $f_s = 2B$ or equivalently $T = 1/(2B)$, the samples are given by:

$$x(nT) = \cos(\pi n) - \underbrace{\sin(\pi n)}_{0}\tan(\theta ) = (-1)^n$$

regardless of the value of $\theta$. That sort of ambiguity is the reason for the strict inequality of the sampling theorem's condition. Fig. 8

• And this example is wrong, even if it is in wikipedia. It is a strawman example, a myth perpetuated in the EE literature, perhaps to have something to say "see, even the mathematicians get something wrong". Pure infinite sine waves of any frequency fall completely outside the scope of the sampling theorem. As I said in the addendum, it may serve as a starting point for the discussion of the real issues in the practical application of the sampling theorem. – Lutz Lehmann Feb 2 '14 at 19:04
• it's not an example. and there is nothing in the mathematics that is incorrect. – robert bristow-johnson Feb 2 '14 at 19:37
• this is not a practical application, it is a practical example (and a question for anyone interested in answering): consider a real-time audio processor, with $f_s=1/T=$ 44.1 kHz, set to "null" or "passthru" processing (output samples are simply copied from the input). 1. are we or are we not capable of inputting to this processor a generated sinusoid with frequency of 22.05 kHz and leaving that input turned on for an hour? 2. if we are capable of such, what might we see in the output? – robert bristow-johnson Feb 2 '14 at 19:43
• Your input is a finite signal, thus its frequency contents surpasses the given frequency of 22.05Hz and thus sampling with 44.1Hz is not sufficient. So of course you will get aliasing effects en masse. – Lutz Lehmann Feb 2 '14 at 20:08
• after a half hour, there is no practical differentiation between this "finite signal" and an identical signal that has been turned on for 2 hours or 4 hours or 4 years or 4 millennia (or since eternity, if that were possible). however, if the sinusoidal signal frequency was $\epsilon>0$ less than $f_s/2$, there is enough information to eventually reconstruct the sinusoid with correct amplitude and phase. Lutz, you're missing the point of the question and the point of the answer. what specific "aliasing effects en masse" do you expect to see? i can only think of one aliasing effect. – robert bristow-johnson Feb 2 '14 at 20:16

Your observation is correct, and it has been noted before. One example, for instance, is mentioned on pages 160-161 of "Principles of Communication Systems" by H. Taub and D. Schilling, McGraw-Hill Book Company, 1971. After introducing the sampling theorem, the authors state:

"An interesting special case is the sampling of a sinusoidal signal having the frequency Fm. Here, all the signal power is concentrated precisely at the cutoff frequency of the low-pass filter, and there is consequently some ambiguity about whether the signal frequency is inside or outside the filter passband. To remove this ambiguity, we require that Fs (be greater than) 2Fm rather than that Fs (be greater than or equal to) 2Fm. To see that this condition is necessary, assume that Fs = 2Fm but that an initial sample is taken at the moment the sinusoid passes through zero. Then all successive samples will also be zero. This situation is avoided by requiring Fs (be greater than) 2Fm."

I have an analog sine wave generator that outputs 17kHz. And I am sure that it is realistically occurring. If I wanted to use this signal for some sound effect for a youthful audience, for, say, a finite twenty periods, and the first sample exactly coincides with a zero crossing, then I'm pretty sure that it is not going to reach its full amplitude in the reconstruction. So much for faithful reconstruction, I might say, even at a signal frequency well below half the sampling rate. Seems like my old open reel would do a better job than a 44k1 sound adapter.

• not if your 44.1 kHz sound adapter had a long enough reconstruction filter. let's say the impulse response was 64 samples long (and that is upsampled to 64x, so it's really 4096 samples long at 2.8 MHz. then i don't think your reel-to-reel does as well. – robert bristow-johnson Mar 11 '14 at 4:07

And that, rbj, seems to be answering OP's question. It is the 'ringing' of the reconstruction filter that fills the 'holes' made by the 'beat' of the sampling rate (to put it mildly simplistic). The samples still coincide with the frequency of the signal to be reproduced, so the filter keeps getting energy at that frequency. And, in an ironic contrast with previous assertions regarding 'infinite signals', it would actually be impossible to correctly quantize a signal that just 'jumps from the origin' for a few samples, as such a signal has infinite bandwidth. So OP's example cannot be the whole signal. Formulas for bandwith used in amplitude modulation can explain.

I think the OP is on to something here. The complete parameterization of a band-limited signal of bandwidth B will be 3-dimensional surface (magnitude as a function of complex freq). Sampling at 2B yields only a 2-dimensional surface (magnitude as a function of 'real' freq). Will there not be overlap in the mapping between the two, and thus loss of information? $S(f) \{f \in C \} \rightarrow S(|f|) \{f \in C \}$?

It appears that to completely capture the signal the I and Q components need to be sampled.