# Time Domain Example of Nyquist/Shannon?

I looked at an old thread, Nyquist Frequency Phase Shift, but was left wondering still about oversampling.

I learned Shannon 40 years ago, then worked 30 years in (s/w) engineering, but now retired I have only begun using/configuring complete digital audio setups. I find myself baffled by exactly the sort of hands-on question that was posed in the referenced thread. Yet most of the relatively simple (IMO) questions I've thrown at the search engines have landed on generic "Nyquist says" posts, and almost all graphs have been frequency domain.

Like the author of the referenced post, if I draw a simple sine wave and "sample" it with something just over twice its frequency, then vary the phasing of the sample points (or the wave) a few times, I end up with very different squarewave patterns. Especially for an illustratively short burst, it's impossible for me to deduce how even the most perfect linear-phase brickwall filter could regenerate the exact analog input (amplitude plus phase), which would be critical in preserving harmonic structure for any instrument. Certainly Nyquist had little to draw upon except filters as a physical 'decoder'.

It is very easy to picture that, for a tiny increment over 2*Fm, something very similar to the zero-output example given in the referenced post would be generated for a fairly long burst. It's equally hard to see how any procedure would regenerate a perfect image of the input burst, intermediate oversampling etc. notwithstanding, whereas for a much lower frequency (same Fs) it looks feasible.

Since available hw/sw has improved so radically since CDs and DAT first showed up, has anyone seen a genuine graphed experiment? Something like a 20khz pure tone riding on a (reasonably short) 2khz tone burst (or any such two-tone combination to give a gauge for zero phase shift), sampled at a rate just higher (say 5% e.g.) than twice the higher frequency. I would love to see the results, in time domain, input vs. output. I'd also love for them to be exact over multiple sample/decode tests. Then I could get over the feeling that not just oversampling but huge oversampling might be a good idea after all.

Or does insistence on a readable burst of short length throw such a monkey wrench into the spectrum being sampled that Fmax would in reality be way, way higher?

• I'm not sure I understand your question. Can you clarify? My understanding is that you don't believe that a signal $x(t)$, if oversampled, can be effectively recovered by the resulting samples. The same if the samples are taken at times $kT_s+\tau$ for $k$ an integer, $T_s$ the sampling period and $\tau$ a fixed delay. If that is indeed your question, will a simulation convince you? It's easy to set up a Matlab (or equivalent) program to simulate sampling and interpolation.
– MBaz
Jul 4, 2016 at 21:03
• Just to answer your last question: a short burst of a sinusoidal signal is definitely not band-limited. If you use a rectangular window (i.e., simply cut out a part of the sinusoid), the spectrum will generally decay as $1/f$. C.f. this answer. Jul 4, 2016 at 21:04
• A sample rate exceeding 2xFinput even incrementally should eliminate aliasing and provide a sample that can reconstruct perfectly the original signal (a sine wave). But try as I might I can't find graphic proof of this expressed in the time domain. I'm not certain it's something Matlab or Maple could prove to my satisfaction, but I have Maple18 and can try at least. I'm just trying to find genuine physical proof, and I'm somewhat stunned that I can't. Jul 5, 2016 at 3:27

A short burst of frequency f contains a ton of higher frequency spectra energy which is needed to make the burst short, or rectangular windowed, rather than infinitely long. Thus, a finite burst no longer meets the Nyquust criteria for sampling at just a bit over 2 times f.

The transform of a rectangular window is a Sinc, which has infinite support in the frequency domain. But a really really long window has a Sinc that decays faster, and thus may go below your noise floor soon enough.

If you want to sample at just a bit over 2 times f and not end up with aliasing, the signal may need to be stationary for a very very long time to allow reconstruction.

Or you can sample at a higher sample rate to acquire a sufficient amount of the spectra of the window that limits the length of a much shorter time domain burst.

So there's a trade-off between how close you can get to Nyquist frequencies versus the length of the signal.

• As I suspected for a short burst. I guess the only recourse is a long-duration signal with a lower frequency tone 'ridden' by a higher frequency tone that is an integral multiple of the lower tone. That should look the same over any lower-tone cycle. Question now is how to do it. I still can't believe the web isn't full of time-domain screenshots of just such a demo. Jul 5, 2016 at 3:35

As an addendum, I tried some experiments today.

The first entailed a computer-generated complex wave made up of a 1.5khz sine summed with a 15khz sine, the combination sampled at 32khz. This was sent from Audacity via spdif to my DSP, which resamples to 48k to placate the SHARCs which run at that sample rate and cannot be changed. From there, I ran the signal through my power amps and speakers, miking the output to a scope.

To my great surprise I found a very nice 1.5khz wave and nothing else. At that point I tried one tone (15khz, generated at 32k on Audacity itself). This time I saw nothing at all. Trying the same procedure at higher sample rates, however, produced clear and visible output.

Zooming in on the source signal, I found that the wave generated for 15k @32k sample rate consisted of a connect-the-dots series of triangle waves, not exactly what I had in mind. I needed a more 'natural' way to generate my source, or so it seemed.

To that end, I connected my analog signal generator to an Ultramatch2496 in ADC mode with a sample rate of 32k. This time I was rewarded with clear and clean output at the HF drivers and on the scope.

So my concerns at least for a continuous sine wave that approaches the Nyquist frequency have been alleviated via experiment (for my setup, which was my foremost concern anyway). Neurotically obsessive I suppose, but experimental verification of anything always makes me feel better!

My original question regarding preservation of phase between two frequencies (one near Nyquist), however, will require another analog generator I suppose. I will have to take that on faith for the time being.

My best bet on time domain interpretation for you is to use Whittaker interpolation formula than looking at Shannon frequency domain interpretation. The interpolation formula works by fitting a sinc wave (whose amplitude is the same as the sample value) at each sampled point. All these infinite sinc waves add up. All the infinite samples contribute towards the amplitude at points in between the samples. However, due to the property of sinc wave having zeroes at integer values, the sinc waves from other samples don't muck with each other at the sampling points.

Now if you had Fs even slightly larger than 2F, there is no way that you can get all samples equal to 0 and therefore there would be sinc waves that can contribute and add up to the amplitude at a given point between samples. But if all sample points end up being 0 (like one possibility with Fs=2F), all the sinc waves have 0 amplitude and there is nothing to build up.