Contents Sampling Introduction Nyquist Sampling Natural Sampling Flat topped Sampling Aperture Error Aliasing Revisited Quantization Distortion Conclusions Sampling Introduction A great deal of signal processing is required to convert an analog signal to the digital domain. This collection of SystemView models will examine this process, and its consequences. Some of these include: Natural & flat topped sampling Aperture error Aliasing Quantization distortion Nyquist Sampling In any sampling process, it is necessary to obtain enough samples to be representative of the whole. The Nyquist theorem states that the minimum number is 2 samples per Hertz. In actual practice it is often necessary to take more than this minimum amount. Sampling In a telephony codec, the ratio is 8 k samples 2.35 samples / Hz . 3.4 kHz Aliasing occurs if less than 2 samples/Hz are obtained. Notice what happens in the time domain, if a sine wave is sampled at less than the Nyquist rate: Sampled Signal Aliasing Signal Sampling P oints Reminder Aliasing also occurs in computer simulations if the System Clock is not set to a high enough rate for the model. In most cases, choose a value of about 5 – 10 times the highest frequency in the model. There are two types of sampling: natural and flat-topped. Of these two, natural sampling is the easier to analyze. However, in practice, flat-topped sampling is used in an ADC. Natural Sampling In this type of sampling, the resultant signal follows the natural shape of the input during the sampling interval. Switch Analog input signal Sampled output signal The sampling function can be regarded as a form of multiplication. An output occurs when the input is multiplied by 1, but nothing emerges when it is multiplied by zero. x = T Sampling The pulse signal acts as a sample gate for the analog waveform. This process, known as PAM† is actually time domain multiplication. A 1 Hz sinewave sampled at 10 samples per second, with an aperture of 20 mSec resembles: sinc envelope Baseband Spectrum Amplitude The spectrum of a sampled baseband creates a whole host of sampling artifacts. f Sampling Signal Equal amplitude sidebands 1/ m fs - f m f 2f 4f s s 2/ 3f s s 5f s 3/ 4/ 6f s 5/ Frequency fs + f m Flat topped Sampling The sampled signal is held constant in a DAC during the conversion process. This alters the time and frequency domain components. X Input Signal The simulation results are: † Pulse Amplitude Modulation = T Sampling Signal Sampled & Held Signal Sampling The spectrum of this waveform resembles: Notice that the results are almost the same as with natural sampling except that the frequency pairs are not equal in amplitude. Instead, each component follows the sinc envelope. This subtle difference is due to aperture error. It’s affect on a sampled signal becomes more apparent when a baseband is sampled. Sinc Envelope Baseband Spectrum Amplitude The spectrum after sampling a baseband resembles: f Sampling Signal Sidebands follow the sinc envelope 1/ m fs - f m f 2f 4f s 2/ s 3f s s 3/ 5f s 4/ 6f s 5/ Frequency fs + f m The spectrum of a flat-topped sampled waveform follows the sinc envelope. The amplitude of the highest frequency components have been adversely affected. This constitutes aperture error in the frequency domain. This phenomenon can be significantly reduced by using non-return to zero sampling. NRZ Sampling Sampling a Baseband Notice the effect of flat topped and natural sampling on a baseband signal: The high frequency content of a baseband signal is affected by flat-topped sampling since its spectrum follows the sinc envelope. This distortion can be reduced by either increasing the sampling frequency or reducing the sampling aperture width. Aperture Error Aperture error is the difference between the actual value of the input signal, and the flattopped sample value. The magnitude of this difference is related to the input frequency and sampling width. Aperture Error Input Waveform Aperture Error Sampling Waveform Time Domain Baseband Spectrum Sinc Envelope Time Frequency Frequency Domain The error caused by a 20 mSec aperture sampling a 1 Hz signal 10 times a second resembles: Sampling This error or noise can be reduced by reducing the aperture width. Aperture Error Input Waveform Aperture Error Sinc Envelope Sampling Waveform Baseband Spectrum Time Frequency Time Domain Frequency Domain The error caused by a 10 mSec aperture sampling a 1 Hz signal 10 times a second resembles: Notice that the aperture error was reduced when the sampling window was reduced. It would appear that reducing the sampling aperture to near zero would eliminate this form of distortion. This would be true except for the fact that at the other end of the digital transmission system, the signal must be reconverted back to digital. In the case of a telephony codec, the sample rate of 8 KHz produces an effective output aperture of 125 Sec at the DAC. Video codecs can reduce aperture error at the DAC by interpolating between samples. Aliasing Revisited Another way to examine aliasing is when the lower sideband associated with the sampling frequency, overlaps the baseband spectrum. Baseband Spectrum LSB fs 2 Aliasing Noise USB fs Sampling Frequency Besides creating tones, foldover distortion can create broadband aliasing noise. Aliasing can be reduced by increasing the sampling rate, and/or by limiting the input baseband frequency prior to sampling by means of an anti-aliasing filter. Sampling Quantization Distortion Noise associated with step size is known as quantization noise. 1100 110 1011 1010 101 Reduced Quantizing Noise Digital Code Digital Code 1001 100 011 1000 111 110 101 100 010 011 001 010 001 000 000 0 1 2 3 4 Sampling Instant 5 6 0 1 2 3 4 5 6 Sampling Instant It is relatively easy to determine the amount of quantizing noise present if linear signals are digitized. The amount of noise is equal to the difference between the input analog signal and the quantized signal. This effect can be reduced by increasing the number of bits per sample, thus reducing the quantization step size. In telephony codecs, the step size is adjusted according to the size of the audio signal. This process, called companding, helps to keep the signal to quantization noise ratio more or less constant. Small signals effectively have a 12-bit resolution whereas large signals have 8-bit resolution. This takes advantage of the psychoacoustic characteristics of human hearing. Sampling Conclusions This model was able to demonstrate the affects of aperture error on a single frequency input in both the time and frequency domains. In order to demonstrate this phenomenon on a baseband signal, a more comprehensive model, perhaps using sweep tokens at the input would be necessary. Never the less, this model demonstrated that: Aperture error occurs whenever flat–topped sampling is used The magnitude of the error is directly related to the aperture width Aperture error adversely affects the high frequency components in the sampled signal