# Nyquist sampling theorem

Started by August 17, 2005
```John Monro wrote:
> Ikaro wrote:
> > Double the highest frquency of the signal will always give you the
> > perfect reconstruction, but it will not always be the Nyquist
> > frequency.
>
> Ikaro,
> for a baseband signal, you need to sample at slightly more than twice
> the highest frequency.
>

Isn't that true for any signal, sampling a sinwave at twice the
frequency doesn't work so well if you sample at 0 and 180 degrees, you
get zero for the amplitude in each case, hard to reconstruct the
original wave with that info.

```
```in article 1125272594.928133.179870@o13g2000cwo.googlegroups.com, steve at
bungalow_steve@yahoo.com wrote on 08/28/2005 19:43:

>
> John Monro wrote:
>> Ikaro wrote:
>>> Double the highest frquency of the signal will always give you the
>>> perfect reconstruction, but it will not always be the Nyquist
>>> frequency.
>>
>> Ikaro,
>> for a baseband signal, you need to sample at slightly more than twice
>> the highest frequency.
>>
>
> Isn't that true for any signal, sampling a sinwave at twice the
> frequency doesn't work so well if you sample at 0 and 180 degrees, you
> get zero for the amplitude in each case, hard to reconstruct the
> original wave with that info.

even if you sample at 0 and 180 degrees, you still can't reconstruct.  there
are an infinite number of sinusoids (at the Nyquist frequency) that will
pass through those same points.

x(t) = 1/(cos(phi) * cos( (pi/T)*t + phi)

1/T is the sampling rate and no matter what phi is, x(n*T) is always (-1)^n.

--

r b-j                  rbj@audioimagination.com

"Imagination is more important than knowledge."

```
```steve wrote:
> John Monro wrote:
>
>>Ikaro wrote:
>>
>>>Double the highest frquency of the signal will always give you the
>>>perfect reconstruction, but it will not always be the Nyquist
>>>frequency.
>>
>>Ikaro,
>>for a baseband signal, you need to sample at slightly more than twice
>>the highest frequency.
>>
>
>
> Isn't that true for any signal, sampling a sinwave at twice the
> frequency doesn't work so well if you sample at 0 and 180 degrees, you
> get zero for the amplitude in each case, hard to reconstruct the
> original wave with that info.

Of course. If the beat frequency between the sampling frequency and the
highest signal frequency is f, in the presence of even a little noise,
it takes a substantial portion of 1/f's worth of samples to get a good
estimate of the amplitude. (A quarter cycle is always enough.) Finding
the correct amplitude isn't an all-or-nothing matter; few things in
nature are.

Jerry
--
Engineering is the art of making what you want from things you can get.
&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;
```
```Jerry Avins wrote:

>
> Of course. If the beat frequency between the sampling frequency and the
> highest signal frequency is f, in the presence of even a little noise,
> it takes a substantial portion of 1/f's worth of samples to get a good
> estimate of the amplitude. (A quarter cycle is always enough.) Finding
> the correct amplitude isn't an all-or-nothing matter; few things in
> nature are.
>

well I'm talking theoretical here, zero noise, not real world, in this
case if you sample at >2x, just infinitesimally greater, you can
reconstruct the original waveform exactly, but not always at =2x, never
got a straight answer why this is never discussed in textbooks, I
suppose its so obvious to the authors that its not worthy of
discussion, it always bother me

```
```"steve" <bungalow_steve@yahoo.com> wrote in message
> Jerry Avins wrote:
>
>>
>> Of course. If the beat frequency between the sampling frequency and the
>> highest signal frequency is f, in the presence of even a little noise,
>> it takes a substantial portion of 1/f's worth of samples to get a good
>> estimate of the amplitude. (A quarter cycle is always enough.) Finding
>> the correct amplitude isn't an all-or-nothing matter; few things in
>> nature are.
>>
>
> well I'm talking theoretical here, zero noise, not real world, in this
> case if you sample at >2x, just infinitesimally greater, you can
> reconstruct the original waveform exactly,

Agree, though you need a very long anti-imaging (aka reconstruction) filter to
do so.  Nyquist just says you _can_ get the original waveform back, not that it
is easy!

> but not always at =2x, never
> got a straight answer why this is never discussed in textbooks, I
> suppose its so obvious to the authors that its not worthy of
> discussion, it always bother me

In the real-world, you want to leave yourself some margin (i.e. oversample by at
least 5-10%), so that you can have a reasonable anti-imaging filter.  Hence a
sample rate of 44.1kHz for 20kHz audio bandwidth (48kHz is even better).

```
```steve wrote:
> John Monro wrote:
>
>>Ikaro wrote:
>>
>>>Double the highest frquency of the signal will always give you the
>>>perfect reconstruction, but it will not always be the Nyquist
>>>frequency.
>>
>>Ikaro,
>>for a baseband signal, you need to sample at slightly more than twice
>>the highest frequency.
>>
>
>
> Isn't that true for any signal, sampling a sinwave at twice the
> frequency doesn't work so well if you sample at 0 and 180 degrees, you
> get zero for the amplitude in each case, hard to reconstruct the
> original wave with that info.
>
Steve,
I wanted to avoid the complication of sub-Nyquist sampling and was
responding to Ikaro's statement that:
"Double the highest frquency of the signal will always give you the
perfect reconstruction,..."
Note that Ikaro said "always,"  and because of that it is possible to
refute his claim by quoting one contrary example, which I did.

As to your question, you are presenting a simple sine function as an
example and stating that it can't be reconstructed from samples taken at
a rate of exactly 2*fmax.  Who said you could?  Not me!

regards,
John
```
```VijaKhara@gmail.com wrote:
> Hello,
> I read in the text book ("Digital signal Processing Principles,
> Algorithm and APplications" J. G. Proakis % D. G. Manolakis, page 30)
> that the Nyquist frequency (rate) is a double of the highest frequency
> of the signal.

That's the introduction of the book. They don't get into details
there.

> In the web, I learn that it is the double of the bandwith. Moreover in
> the web they state that there is a mistake in many textbooks where
> authors teach that it is the double of the highest frequency. The
> theorem in textbook is correct only when the signal is a baseband type.

If you read the part of P&M where they go through the details of
sampling, you will find that sampling is a bit more complicated.
The main point is that in the sampled signal, the continuous-time
spectrum is repeated with period Fs, the sampling frequency.
In fact, in Digital-to-Analog Converters one implements a smoothing
filter to make sure only the baseband part of the spectrum remains.

It is possible, at least in theory, to turn all this around and
sample a higher band of the spectrum and reconstruct a different
band than baseband. I think this is known as "bandpass sampling".

> In my  opinion, if it is a theorem so Nyquist must state clearly the
> definition of his Nyquist frequency, and if so there should not be such
> a confusing argument.
>
> So which one do you agree? in my textbook or in the web.

Usually, my advice is to stay with the textbooks rather than the
web. In general, consult more textbooks before accepting anything
you find on the web as a definitive answer, in case you happened
to find a poorly phrased text.

But then, textbooks tend to bee somewhat simplified, and this
might be a case of over-simplification. I don't know how
wide-spread bandpass sampling is in practice, I have only worked
with baseband-sampled signals.

Rune

```
```steve wrote:
> Jerry Avins wrote:
>
>
>>Of course. If the beat frequency between the sampling frequency and the
>>highest signal frequency is f, in the presence of even a little noise,
>>it takes a substantial portion of 1/f's worth of samples to get a good
>>estimate of the amplitude. (A quarter cycle is always enough.) Finding
>>the correct amplitude isn't an all-or-nothing matter; few things in
>>nature are.
>>
>
>
> well I'm talking theoretical here, zero noise, not real world, in this
> case if you sample at >2x, just infinitesimally greater, you can
> reconstruct the original waveform exactly, but not always at =2x, never
> got a straight answer why this is never discussed in textbooks, I
> suppose its so obvious to the authors that its not worthy of
> discussion, it always bother me

What's in good texts is
the need to sample at greater than 2x to reconstruct,
the need to sample at 2x not to alias,
and that the more oversampling, the easier the filtering problem.
(At zero sampling, filtering becomes infinitely hard.)

If that's not enough to get someone to think about why, he's probably
pursuing the wrong field.

Jerry
--
Engineering is the art of making what you want from things you can get.
&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;
```
```VijaKhara@gmail.com wrote:

> Hello,
> I read in the text book ("Digital signal Processing Principles,
> Algorithm and APplications" J. G. Proakis % D. G. Manolakis, page 30)
> that the Nyquist frequency (rate) is a double of the highest frequency
> of the signal.

(snip)

> In my  opinion, if it is a theorem so Nyquist must state clearly the
> definition of his Nyquist frequency, and if so there should not be such
> a confusing argument.

Another is that much of the theory assumes infinitely long
signals, which are rare in practice.  The distinction between
"greater" and "greater than or equal" in determining the Nyquist
frequency is only significant in the case of infinitely long
signals.

-- glen

```