# Conclusions of sampling around Nyquist Rate

I'm trying to understand some results of playing around with sampling around a signal's Nyquist sampling rate. For my example, I'm sampling a $$B=5\mathrm{Hz}$$ wave over a 1 second period.

1. In the first image, I use a very high sampling rate of 1000Hz to emulate the exact signal (at least for graphing), $$\sin(2 \pi 5 t)$$. This sampling is subsequently used in the next graphs as a reference.
2. In the next, I use a rate just below Nyquist's, 9Hz. The resulting wave looks like a sine wave, but doesn't represent the highs and lows of the wave. I'm still tracking with why hitting the Nyquist rate is important from this image.
3. Next, I get confused with Nyquist: I sample at exactly $$2B=10\mathrm{Hz}$$, the lower bound. This produces nearly zeros in the data:
[ 0.00000000e+00  1.22464680e-16 -2.44929360e-16 -1.40896280e-15
-4.89858720e-16  6.12323400e-16  2.81792560e-15 -2.69546092e-15
-9.79717439e-16  1.10218212e-15]

(I'm not even sure if these are floating point errors or not). Yes, there is some oscillation, but it is very minor. It seems like we need to further increase the sample rate... Is the rate of $$2B$$ exclusive?
4. In the fourth image, I sample above at 11Hz, which above the Nyquist rate. However, this sampling looks very much like image #2 flipped about the x axis. Again, there is some oscillation, but I don't see how we could reconstruct a 5 Hz wave from this, especially when it has nearly the same qualities as image #2.
5. Finally, I sample at $$4B=10\mathrm{Hz}$$ and at last, I can see the 5Hz wave I expect. Why did it take 4x to get here when the theory only states 2x?

I feel like the conclusions I've made above are incorrect (in probably a variety of ways). Would someone please help me explain where I'm wrong?

Jupyter Notebook available here: https://gist.github.com/t-mart/8a46e87938904c7f6a5a102ad6a2ef0e

• 2f is not the lower bound, it's the smallest sampling that does not reliably work! (as you very concisely demonstrated.) – Marcus Müller Sep 23 at 10:58

## 1 Answer

Is the rate of 2B exclusive?

Yes. The sampling theorem states that the signal must be band limited to half the sample rate. That implies that the energy at the Nyquist frequency must be zero. In practice you need a healthy margin between the highest usable frequency and the Nyquist frequency. There is always some "transition band" that you need to get the energy from "useful" to "nothing"

I don't see how we could reconstruct a 5 Hz wave from this

You can using Shannon Whittaker interpolation. https://en.wikipedia.org/wiki/Whittaker%E2%80%93Shannon_interpolation_formula It doesn't matter how it looks to your eye, it just matters that all the information is there, which it is.

Why did it take 4x to get here when the theory only states 2x?

It doesn't take 4x. You need to use a quantitative mathematical criteria to determine whether a sampling is "good" or not. Visual inspection doesn't help here. The most straight forward would be: if you send this sequence into a D/A converter and compare the output with the original input, how different are the two signals? That's actually what the Shannon interpolation does: it mimics an DAC converter with an infinitely steep anti-aliasing filter.