# Nyquist frequency

#### silent tone

##### Golden Member
I've wondered this for a while. How can a signal be accurately reproduced up to the nyquist frequency? It seems to me that when the frequency of the source signal approaches nyquist, then the amplitude recorded would have an increasing probability of inaccuracy. The recording device would have to sample the signal at the exact timeslice where the signal reaches it's peak. Am I making in incorrect assumption about how the sample is taken? ie. not timeslices, but an average amplitude since the last sample.

#### Mark R

##### Diamond Member
If you sample just above the Nyquist frequency, then it looks as though you get amplitude error.

If you simply perform linear interpolation algorithm between the sampled points then you end up with a signal that has an incorrect amplitude, and incorrect frequency (particularly important to note is that the frequency, of the reconstructed signal is above the Nyquist). The crude way of improving things is to use an anti-aliasing filter on the output of your which will get rid of any high frequency aliases.

If you use a more sophisticated filter, based on the assumption that the reconstructed signal cannot contain frequencies above the Nyquist, then you can more accurately reconstruct the original signal. In particular, you can use the Nyquist Shannon interpolation algorithm - which guarantees the correct reconstruction of the original signal provided that the original signal was sampled at more than 2x the Nyquist frequency.

Most modern audio DACs will do this - they use a digital oversampling filter to perform the Nyquist-Shannon interpolation, which is then converted at a very high sample rate (over 6MHz on high-end DACs).

#### BrownTown

##### Diamond Member
even if you are sampling at the Nyquist you will still get a distrorted signal that only approximates the origional. No amount of sampling can ever completely replicate the origional signal, thats why you just try to get a high enough frequency that people cannot tell the differnence. In the real world all you have to worry about is getting "close enough" for what you are working on, nenver about actuallu getting 100% accuracy.

#### RaynorWolfcastle

##### Diamond Member
Originally posted by: BrownTown
even if you are sampling at the Nyquist you will still get a distrorted signal that only approximates the origional. No amount of sampling can ever completely replicate the origional signal, thats why you just try to get a high enough frequency that people cannot tell the differnence. In the real world all you have to worry about is getting "close enough" for what you are working on, nenver about actuallu getting 100% accuracy.
If you have a bandlimited signal, then sampling at the Nyquist rate is sufficient to completely replicate the original signal (at least in theory). If you do the math for the Fourier transform, you'll see that it actually works out (though you need to asume everything is ideal).

In practice, you have non-ideal filters and you're usually quantizing your signal as well, in which case you are performing an approximation.

#### BrownTown

##### Diamond Member
The math with the fourier transform looks right, but im still not entirely sure how you go about reconstructing the signal, just looking at some online programs which let you define signal frequencies and sampling rates it seems (at least visually) like you can get aliasing even above the Nyquist frequency. And then there is the problem that if you sample just at the Nyquist rate you can still get all zeroes which doesn't really tell you anything about the amplitude of the signal...

#### Born2bwire

##### Diamond Member
Originally posted by: BrownTown
The math with the fourier transform looks right, but im still not entirely sure how you go about reconstructing the signal, just looking at some online programs which let you define signal frequencies and sampling rates it seems (at least visually) like you can get aliasing even above the Nyquist frequency. And then there is the problem that if you sample just at the Nyquist rate you can still get all zeroes which doesn't really tell you anything about the amplitude of the signal...

The math is how we reconstruct the signal. There's a variety of ways to do it specifically, but all it really concerns is doing it in such a way as the math works out. For example, the simplest way to reconstruct the analog signal, and how it is usually explained in advertisements, is a zero-order hold DAC. This is just the classic stairstep waveform that you'll see in advertisements trying to tell you how 96KHz sampling rate is better than 44.1 KHz. But that isn't the end of the DAC stage, you then pass the stairstep waveform through a filter, and the filter is dictated by the math so that the end result is the original waveform. For a zero-order hold, it is an ideal low-pass filter whose amplitude is described by e^x or something like that. But there are other types of DAC and filter combinations. You could do a DAC that outputs a slightly interperlated waveform that would allow for a simpler analog filter after it. The filter following the DAC is your interpolation filter, it takes care of interpolating whatever is sent out of the DAC back to the original waveform. And going from the math, if you know what the output of the DAC is and what the original input was, then you can find the mathematical description of your required filter.

As for aliasing above the Nyquist frequency, not sure what you mean there. One of the stipulations is that you have a bandlimited signal. In real life, when we digitize a waveform, we filter out the higher frequencies that we cannot reproduce. For example, in audio, the audio is sent through a brickwall filter to remove anything above 20 KHz for CD's. The Nyquist frequency for CD's is 44.1KHz, the extra bandwidth of 2.05KHz is there to allow for a little leeway in the interpolating filter without causing aliasing (since we cannot produce an ideal filter we give some extra bandwidth where no signal information is contained so that any aliasing lies outside of the bandwidth of the original signal).