Professional Documents
Culture Documents
cause of this it is difficult to determine which frequency a(t), is truly being observed. This effect is similar to that observed in western movies when watching the spoked wheels of a rapidly moving stagecoach rotate backwards at a slow rate. The effect is a result of each individual frame of film resembling a discrete strobed sampling operation flashing at a rate slightly faster than that of the rotating wheel. Each observed sample point or frame catches the spoked wheel slightly displaced from its previous position giving the effective appearance of a wheel rotating backwards. Again, aliasing is evidenced and in this example it becomes difficult to determine which is the true rotational frequency being observed.
An Intuitive Development
The sampling theorem by C.E. Shannon in 1949 places restrictions on the frequency content of the time function signal, f(t), and can be simply stated as follows: In order to recover the signal function f(t) exactly, it is necessary to sample f(t) at a rate greater than twice its highest frequency component. Practically speaking for example, to sample an analog signal having a maximum frequency of 2Kc requires sampling at greater than 4Kc to preserve and recover the waveform exactly. The consequences of sampling a signal at a rate below its highest frequency component results in a phenomenon known as aliasing. This concept results in a frequency mistakenly taking on the identity of an entirely different frequency when recovered. In an attempt to clarify this, envision the ideal sampler of Figure 1(a), with a sample period of T shown in Figure 1(b), sampling the waveform f(t) as pictured in Figure 1(c). The sampled data points of f(t) are shown in Figure 1(d) and can be defined as the sample set of the continuous function f(t). Note in Figure 1(e) that another frequency component, a(t), can be found that has the same sample set of data points as f(t) in Figure 1(d). Be-
00562001
FIGURE 1. When sampling, many signals may be found to have the same set of data points. These are called aliases of each other.
AN-236
AN005620
www.national.com
AN-236
An Intuitive Development
(Continued)
00562002
FIGURE 2. Shown in the shaded area is an ideal, low pass, anti-aliasing filter response. Signals passed through the filter are bandlimited to frequencies no greater than the cutoff frequency, fc. In accordance with the sampling theorem, to recover the bandlimited signal exactly the sampling rate must be chosen to be greater than 2fc. On the surface it is easily said that anti-aliasing designs can be achieved by sampling at a rate greater than twice the maximum frequency found within the signal to be sampled. In the real world, however, most signals contain the entire spectrum of frequency components; from the desired to those present in white noise. To recover such information accurately the system would require an unrealizably high sample rate. This difficulty can be easily overcome by preconditioning the input signal, the means of which would be a band-limiting or frequency filtering function performed prior to the sample data input. The prefilter, typically called anti-aliasing filter guarantees, for example in the low pass filter case, that the sampled data system receives analog signals having a spectral content no greater than those frequencies allowed by the filter. As illustrated in Figure 2, it thus becomes a simple matter to sample at greater than twice the maximum frequency content of a given signal. A parallel analog of band-limiting can be made to the world of perception when considering the spectrum of white light. It can be realized that the study of violet light wavelengths generated from a white light source would be vastly simplified if initial band-limiting were performed through the use of a prism or white light filter. These values are a sequence of equidistant sample points spaced apart. (f)t is thus given by
(3) the band limited function, f(t), takes the form, Figure 3a,
(4)
(6)
www.national.com
AN-236
(Continued)
(8) Cn can be written as where (9) Substituting Equation (9) into Equation (6) gives the periodic Fourier Transform giving and fs is the sampling frequency
(10) of Figure 3f. Using Poissons sum formula (Note 1) F() can be stated more clearly as
(16) Equation (16) is equivalent to Equation (2) as is illustrated in Figure 4e and Figure 3a respectively. As observed in Figure 3 and Figure 4, each step of the sampling theorem proof was also illustrated with its Fourier transform pair. This was done to present alternate illustrative proofs. Recalling the convolution (Note 2) theorem, the convolution of F(), Figure 3b, with a set of equidistant impulses, Figure 3d, yields the same periodic frequency function Fp(), Figure 3f, as did the Fourier transform of fn, Figure 3e, the product of f(t), Figure 3a, and its equidistant sample impulses, Figure 3c. In the same light the original time function f(t), Figure 4e, could have been recovered from its sampled waveform by convolving fn, Figure 4a, with h(t), Figure 4c, rather than multiplying Fp(), Figure 4b, by the rectangular function H(), Figure 4d, to get F(), Figure 4f, and finally inverse transforming to achieve f(t), Figure 4e, as done in the mathematic proof.
Note 2: The convolution theorem allows one to mathematically convolve in the time domain by simply multiplying in the frequency domain. That is, if f(t) has the Fourier transform F(), and x(t) has the Fourier transform X(), then the convolution f(t)*x(t) has the Fourier transform F() X().
(11) Interestingly for the interval c c the periodic function Fp() and Figure 3f. equals F() and Figure 3b. respectively. Analogously if Fp() were multiplied by a rectangular pulse defined, (12) H() = 1 c and H() = 0 || C then as pictured in Figure 4b, d, and f, (13)
(14) Solving for f(t) the inverse Fourier transform Equation (3) is applied to Equation (14)
(15)
www.national.com
AN-236
(Continued)
00562003
www.national.com
AN-236
(Continued)
00562004
www.national.com
AN-236
(Continued)
00562005
FIGURE 5. Spectral folding or aliasing caused by: (a) under sampling (b) exaggerated under sampling.
00562006
FIGURE 6. Aliased spectral envelope (a) and (b) of Figure 5a and Figure 5b respectively.
www.national.com
AN-236
(Continued)
00562007
signed such that frequencies in the stopband were attenuated to less than the rms quantization noise level of and thus appearing invisible to the system. More specifically
It can be seen, for example in the Butterworth filter case (characterized as having a maximally flat pass-band) of Figure 9a that any order of filter may be used to achieve the 59 dB attenuation level, however, the higher the order, the faster the roll off rate and the closer the filter magnitude response will approach the ideal. Referring back to Figure 8 it is observed that those frequencies greater than a are not recognized by the A/D converter and thus the sampling frequency of the sample data system would be defined as s 2a. Additionally, the frequencies present within the filtered input signal would be those less than a. Note however, that the portion of the signal frequencies least distorted are those between =O and p and those within the transition band are distorted to a substantial degree, though it was originally desired to limit the signal to frequencies less than the cutoff p, because of the non-ideal frequency response the true Nyquist frequency occurred at a. We see then that the sampled-data system could at most be accurate for those frequencies within the antialiasing filter passband. From the above example, the design of an antialiasing filter appears to be quite straight forward. Recall however, that all waveforms are composed of the sums and differences of various frequency components and as a result, if the response of the filter passband were not flat for the desired signal frequency spectrum, the recovered signal would be an inaccurate summation of all frequency components altered by their relative attenuations in the pass-band. Additionally the antialiasing filter design should not neglect the effects of delay. As illustrated in Figure 8 and Figure 9b, delay time corresponds to a specific phase shift at a particular frequency. Similar to the flat pass-band consideration, if the phase shift of the filter is not exactly proportional to the frequency, the output of the filter will be a waveform in which the summation of all frequency components has been altered by shifts in their relative phase. Figure 9b further indicates that contrary to the roll off rate, the higher the filter order the more non-ideal the delay becomes (increased delay) and the result is a distorted output signal. A final and complex consideration to understand is the effects of sampling. When a signal is sampled the end effect is the multiplication of the signal by a unit sampling pulse train as recalled from Figure 3a, c and e. The resultant waveform has a spectrum that is the convolution of the signal spectrum and the spectrum of the unit sample pulse train, i.e. Figure 3b, d, and f. If the unit sample pulse has the classical sin X/X
As an example of how an antialiasing filter would be applied, assume a sample data system having within it an 8-bit A/D converter. Eight bits translates to 2n =28 =256 levels of resolution. If a 2.56 volt reference were used each quantization level, q, would represent the equivalent of 2.56 volts/256=10 millivolts. Realizing this the antialiasing filter would be de-
www.national.com
AN-236
difference frequency components may fall within the desired signal spectrum thereby creating aliasing errors, Figure 10c. When designing antialiasing filters it will be found that the closer the filter response approaches the ideal the more complex the filter becomes. Along with this an increase in delay and pass-band ripple combine to distort and alias the input signal. In the final analysis the design will involve trade offs made between filter complexity, sampling speed and thus system bandwidth.
Note 5: This will be explained more clearly in Section IV. of this article.
00562008
www.national.com
AN-236
(Continued)
00562009
00562010
b) Group delay performances of normalized Butterworth lowpass filters as a function of degree n. FIGURE 9.
www.national.com
AN-236
(Continued)
00562011
FIGURE 10. (c) equals the convolution of (a) with (b). The Analog-to-Digital Converter Following the antialiasing filter is the A/D converter which performs the operations of quantizing and coding the input signal in some finite amount of time. Figure 11 shows the quantization process of converting a continuous analog input signal into a set of discrete output levels. A quantization, q, is thus defined as the smallest step used in the digital representation of fq(n) where f(n) is the sample set of an input signal f(t) and is expressed by a finite number of bits giving the sequence fq(n). Digitally speaking q is the value of the least significant code bit. The difference signal e(n) shown in Figure 11 is called quantization noise or error and can be defined as e(n) = f(n) fq(n). This error is an irreducible one and is a function of the quantizing process. Its error amplitude is dependent on the number of quantization levels or quantizer resolution and as shown, the maximum quantization error is |q/2|. Generally e(n) is treated as a random error when described in terms of its probability density function, that is, all values of e(n) between q/2 and q/2 are equally probable, then for the average value e(n)avg =0 and for the rms value As a side note it is appropriate at this point to emphasize that all analog signals have some form of noise corruption. If for example an input signal has a finite signal-to-noise ratio of 40dB it would be superfluous to select an A/D converter with
www.national.com 10
a high number of bits. It may be realized that the use of a large number of bits does not give the digitized signal a higher signal-to-noise ratio than that of the original analog input signal. As a supportive argument one may say that though the quantization steps q are very small with respect to the peak input signal the lower order bits of the A/D converter merely provide a more accurate representation of the noise inherent in the analog input signal. Returning to our discussion, we define the conversion time as the time taken by the A/D converter to convert the analog input signal to its equivalent quantization or digital code. The conversion speed required in any particular application depends upon the time variation of the signal to be converted and the amount of resolution or bits, n, required. Though the antialiasing filter helps to control the input signal time rate of change by band-limiting its frequency spectrum, a finite amount of time is still required to make a measurement or conversion. This time is generally called the aperture time and as illustrated in Figure 12 produces amplitude measurement uncertainty errors. The maximum rate of change detectable by an A/D converter can simply be stated as
(18)
AN-236
00562012
00562013
V: AMPLITUDE UNCERTAINTY ERROR ta: APERTURE TIME ta: APERTURE TIME UNCERTAINTY
FIGURE 12. Amplitude uncertainty as a function of (a) a nonvarying aperture and(b) aperture time uncertainty.
11
www.national.com
AN-236
(20) of a rectangular pulse. The sin X/X form occurs frequently in modern communication theory and is commonly called the sampling function. The magnitude and phase of a typical zero order hold sampler spectrum
00562014
FIGURE 13. The Fourier transform of the rectangular pulse (a) is shown in (b).
(21) is shown in Figure 14 and Figure 15 illustrates the spectra of various sampler pulse-widths. The purpose of presenting this illustrative information is to give insight at to what effects cause the aliasing described in Figure 10. From Figure 15 it is realized that the main lobe of the sin X/X function varies inversely proportional with the sampler pulse-width. In other words a wide pulse-width, or in this case the aperture window, acts as a low pass filtering function and limits the amount of information resolvable by the sample data system. On the other hand a narrow sampler pulse-width or aperture window has a broader main lobe or band-width and thus when convolved with the analog input signal produces the least amount of distortion. Understandably then the effect of the samplers spectral phase and main lobe width must be considered when developing a sampling system so that no unexpected aliasing occurs from its convolution with the input signal spectrum.
www.national.com
12
AN-236
00562016
00562015
FIGURE 15. Pulse width and how it effects the sin X/X envelop spectrum (normalized amplitudes).
FIGURE 14. Sampling Pulse (a), its Magnitude (b) and Phase Response (c).
13
www.national.com
AN-236
A Final Note
This article began by presenting an intuitive development of the sampling theorem supported by a mathematical and illustrative proof. Following the theoretical development were a few of the unobvious and troublesome results that develop when trying to put the sampling theorem into practice. The purpose of presenting these thought provoking perils was to perhaps give the beginning designer some insight or guidelines for consideration when developing a sample data systems interface.
Acknowledgements
The author wishes to thank James Moyer and Barry Siegel for their encouragement and the time they allocated for the writing of this article.
Appendix A
BASIC FILTER CONCEPTS A filter is a network used for separating signal waves on the basis of their frequency and is usually composed of passive, reactive and active elements such as resistors, capacitors, inductors, and amplifiers, or combinations thereof. There are basically five types of filters used to pass or reject such signals and they are defined as follows: 1. A low-pass filter passes a band of frequencies called the passband, ranging from zero frequency or DC to a certain cutoff frequency, c (Note 6), and in addition has a maximum attenuation or ripple level of AMAX within the passband. See Figure 17. Frequencies beyond the c may have an attenuation greater than AMAX but beyond a specific frequency s defined as the stopband frequency, a minimum attenuation of AMIN must prevail. The band of frequencies higher than s and maintaining attenuation greater than or equal to AMIN is called the stopband. The transition region or transition band is that band of frequencies between c and s.
00562017
FIGURE 16. (a) Processed signal data points (b) output of D/A converter (c) output of smoothing filter.
www.national.com
14
AN-236
Appendix A
(Continued)
cies above and below s2 and s2 respectively, must have a minimum attenuation of AMIN.
00562018
00562020
FIGURE 17. Common Low Pass Filter Response A high-pass filter allows frequencies above the passband frequency, c, to pass and rejects frequencies below this point. AMAX must be maintained in the passband and frequencies equal to and below the stopband frequency, s, must have a minimum attenuation of AMIN. See Figure 18.
FIGURE 19. Common Band-pass Filter Response A band-reject filter or notch filter allows all but a specific band of frequencies to pass. As shown in Figure 4, those frequencies between s1 and s2 are filtered out and those frequencies above and below c2 and c1 respectively are passed. The attenuation requirements of the stopband AMIN and passband AMAX must still hold.
00562019
00562021
FIGURE 18. Common High Pass Filter Response A bandpass filter performs the function of passing a specific band of frequencies while rejecting those frequencies above and below c2 and lower, c1 cutoff frequency limits. See Figure 19. As in the previous two cases the passband is required to sustain an attenuation of AMAX, and the stopband of frequen-
FIGURE 20. Common Band-Reject Filter Response An all-pass or phase shift filter allows all frequencies to pass without any appreciable attenuation. It further introduces a predictable phase shift to all frequencies passed, though not
15
www.national.com
Appendix A
(Continued)
C.E. Shannon, Communication in the Presence of Noise, Proceedings IRE, Vol. 37, pp. 1021, Jan. 1949. M. Schwartz, L. Shaw, Signal Processing: Discrete Spectral Analysis, Detection and Estimation, McGraw-Hill, 1975. L.R. Rabiner, B. Gold, Theory and Application of Digital Signal Processing, Prentice-Hall, 1975. W.H. Hayt, J.E. Kemmerly, Engineering Circuit Analysis, McGraw-Hill, 3rd edition, 1978. E.O. Brigham, The Fast Fourier Transform, Prentice-Hall, 1974. J. Sherwin, Specifying A/D and D/A converters, National Semiconductor Corp., Application Note AN-156. Analog-Digital Conversion Notes, Analog Devices Inc., 1974. A.I. Zverev, Handbook of Filter Synthesis, Wiley, 1967.
restricting the entire range of frequencies to a specific phase shift (i.e., a phase shift may be imposed upon a selected band of frequencies and appear invisible to all others).
Appendix B
ARTICLE REFERENCES S.D. Stearns, Digital Signal Analysis, Hayden, 1975. S.A. Tretter, Introduction to Discrete-Time Signal Processing, Wiley, 1976. W.D. Stanley, Digital Signal Processing, Reston, 1975. A. Papoulis, The Fourier Integral and its Applications, Mc-Graw-Hill, 1962. E.A. Robinson, M. T. Silvia, Digital Signal Processing and Time Series Analysis, Holden-Day, 1978.
LIFE SUPPORT POLICY NATIONALS PRODUCTS ARE NOT AUTHORIZED FOR USE AS CRITICAL COMPONENTS IN LIFE SUPPORT DEVICES OR SYSTEMS WITHOUT THE EXPRESS WRITTEN APPROVAL OF THE PRESIDENT AND GENERAL COUNSEL OF NATIONAL SEMICONDUCTOR CORPORATION. As used herein: 1. Life support devices or systems are devices or systems which, (a) are intended for surgical implant into the body, or (b) support or sustain life, and whose failure to perform when properly used in accordance with instructions for use provided in the labeling, can be reasonably expected to result in a significant injury to the user.
National Semiconductor Corporation Americas Email: support@nsc.com National Semiconductor Europe Fax: +49 (0) 180-530 85 86 Email: europe.support@nsc.com Deutsch Tel: +49 (0) 69 9508 6208 English Tel: +44 (0) 870 24 0 2171 Franais Tel: +33 (0) 1 41 91 8790
2. A critical component is any component of a life support device or system whose failure to perform can be reasonably expected to cause the failure of the life support device or system, or to affect its safety or effectiveness.
AN-236
National Semiconductor Asia Pacific Customer Response Group Tel: 65-2544466 Fax: 65-2504466 Email: ap.support@nsc.com
www.national.com
National does not assume any responsibility for use of any circuitry described, no circuit patent licenses are implied and National reserves the right at any time without notice to change said circuitry and specifications.
IMPORTANT NOTICE
Texas Instruments Incorporated and its subsidiaries (TI) reserve the right to make corrections, modifications, enhancements, improvements, and other changes to its products and services at any time and to discontinue any product or service without notice. Customers should obtain the latest relevant information before placing orders and should verify that such information is current and complete. All products are sold subject to TI s terms and conditions of sale supplied at the time of order acknowledgment. TI warrants performance of its hardware products to the specifications applicable at the time of sale in accordance with TI s standard warranty. Testing and other quality control techniques are used to the extent TI deems necessary to support this warranty. Except where mandated by government requirements, testing of all parameters of each product is not necessarily performed. TI assumes no liability for applications assistance or customer product design. Customers are responsible for their products and applications using TI components. To minimize the risks associated with customer products and applications, customers should provide adequate design and operating safeguards. TI does not warrant or represent that any license, either express or implied, is granted under any TI patent right, copyright, mask work right, or other TI intellectual property right relating to any combination, machine, or process in which TI products or services are used. Information published by TI regarding third-party products or services does not constitute a license from TI to use such products or services or a warranty or endorsement thereof. Use of such information may require a license from a third party under the patents or other intellectual property of the third party, or a license from TI under the patents or other intellectual property of TI. Reproduction of TI information in TI data books or data sheets is permissible only if reproduction is without alteration and is accompanied by all associated warranties, conditions, limitations, and notices. Reproduction of this information with alteration is an unfair and deceptive business practice. TI is not responsible or liable for such altered documentation. Information of third parties may be subject to additional restrictions. Resale of TI products or services with statements different from or beyond the parameters stated by TI for that product or service voids all express and any implied warranties for the associated TI product or service and is an unfair and deceptive business practice. TI is not responsible or liable for any such statements. TI products are not authorized for use in safety-critical applications (such as life support) where a failure of the TI product would reasonably be expected to cause severe personal injury or death, unless officers of the parties have executed an agreement specifically governing such use. Buyers represent that they have all necessary expertise in the safety and regulatory ramifications of their applications, and acknowledge and agree that they are solely responsible for all legal, regulatory and safety-related requirements concerning their products and any use of TI products in such safety-critical applications, notwithstanding any applications-related information or support that may be provided by TI. Further, Buyers must fully indemnify TI and its representatives against any damages arising out of the use of TI products in such safety-critical applications. TI products are neither designed nor intended for use in military/aerospace applications or environments unless the TI products are specifically designated by TI as military-grade or enhanced plastic. Only products designated by TI as military-grade meet military specifications. Buyers acknowledge and agree that any such use of TI products which TI has not designated as military-grade is solely at the Buyer s risk, and that they are solely responsible for compliance with all legal and regulatory requirements in connection with such use. TI products are neither designed nor intended for use in automotive applications or environments unless the specific TI products are designated by TI as compliant with ISO/TS 16949 requirements. Buyers acknowledge and agree that, if they use any non-designated products in automotive applications, TI will not be responsible for any failure to meet such requirements. Following are URLs where you can obtain information on other Texas Instruments products and application solutions: Products Audio Amplifiers Data Converters DLP DSP Clocks and Timers Interface Logic Power Mgmt Microcontrollers RFID OMAP Mobile Processors Wireless Connectivity Products www.ti.com/audio amplifier.ti.com dataconverter.ti.com www.dlp.com dsp.ti.com www.ti.com/clocks interface.ti.com logic.ti.com power.ti.com microcontroller.ti.com www.ti-rfid.com www.ti.com/omap www.ti.com/wirelessconnectivity TI E2E Community Home Page e2e.ti.com Applications Communications and Telecom www.ti.com/communications Computers and Peripherals Consumer Electronics Energy and Lighting Industrial Medical Security Space, Avionics and Defense Video and Imaging www.ti.com/computers www.ti.com/consumer-apps www.ti.com/energy www.ti.com/industrial www.ti.com/medical www.ti.com/security www.ti.com/space-avionics-defense www.ti.com/video
Mailing Address: Texas Instruments, Post Office Box 655303, Dallas, Texas 75265 Copyright 2011, Texas Instruments Incorporated