21
Filter Comparison
Decisions, decisions, decisions! With all these filters to choose from, how do you know whichto use? This chapter is a head-to-head competition between filters; we'll select champions fromeach side and let them fight it out. In the first match, digital filters are pitted against analogfilters to see which technology is best. In the second round, the windowed-sinc is matchedagainst the Chebyshev to find the king of the frequency domain filters. In the final battle, themoving average fights the single pole filter for the time domain championship. Enough talk; letthe competition begin!
Match #1: Analog vs. Digital Filters
Most digital signals originate in analog electronics. If the signal needs to befiltered, is it better to use an analog filter before digitization, or a digital filterafter? We will answer this question by letting two of the best contendersdeliver their blows.
The goal will be to provide a low-pass filter at 1 kHz. Fighting for the analogside is a six pole Chebyshev filter with 0.5 dB (6%) ripple. As described inChapter 3, this can be constructed with 3 op amps, 12 resistors, and 6capacitors. In the digital corner, the windowed-sinc is warming up and readyto fight. The analog signal is digitized at a 10 kHz sampling rate, making thecutoff frequency 0.1 on the digital frequency scale. The length of thewindowed-sinc will be chosen to be 129 points, providing the same 90% to10% roll-off as the analog filter. Fair is fair. Figure 21-1 shows the frequencyand step responses for these two filters.
Let's compare the two filters blow-by-blow. As shown in (a) and (b), theanalog filter has a 6% ripple in the passband, while the digital filter isperfectly flat (within 0.02%). The analog designer might argue that the ripplecan be selected in the design; however, this misses the point. The flatnessachievable with analog filters is limited by the accuracy of their resistors and
343
344The Scientist and Engineer's Guide to Digital Signal Processing
capacitors. Even if a Butterworth response is designed (i.e., 0% ripple), filtersof this complexity will have a residue ripple of, perhaps, 1%. On the otherhand, the flatness of digital filters is primarily limited by round-off error,making them hundreds of times flatter than their analog counterparts. Scoreone point for the digital filter.
Next, look at the frequency response on a log scale, as shown in (c) and (d).Again, the digital filter is clearly the victor in both roll-off and stopbandattenuation. Even if the analog performance is improved by adding additionalstages, it still can't compare to the digital filter. For instance, imagine that youneed to improve these two parameters by a factor of 100. This can be donewith simple modifications to the windowed-sinc, but is virtually impossible forthe analog circuit. Score two more for the digital filter.
The step response of the two filters is shown in (e) and (f). The digital filter'sstep response is symmetrical between the lower and upper portions of thestep, i.e., it has a linear phase. The analog filter's step response is notsymmetrical, i.e., it has a nonlinear phase. One more point for the digitalfilter. Lastly, the analog filter overshoots about 20% on one side of the step.The digital filter overshoots about 10%, but on both sides of the step. Sinceboth are bad, no points are awarded.
In spite of this beating, there are still many applications where analog filtersshould, or must, be used. This is not related to the actual performance of thefilter (i.e., what goes in and what comes out), but to the general advantages thatanalog circuits have over digital techniques. The first advantage is speed:digital is slow; analog is fast. For example, a personal computer can only filterdata at about 10,000 samples per second, using FFT convolution. Even simpleop amps can operate at 100 kHz to 1 MHz, 10 to 100 times as fast as thedigital system!
The second inherent advantage of analog over digital is dynamic range. Thiscomes in two flavors. Amplitude dynamic range is the ratio between thelargest signal that can be passed through a system, and the inherent noise of thesystem. For instance, a 12 bit ADC has a saturation level of 4095, and an rmsquantization noise of 0.29 digital numbers, for a dynamic range of about14000. In comparison, a standard op amp has a saturation voltage of about20 volts and an internal noise of about 2 microvolts, for a dynamic rangeof about ten million. Just as before, a simple op amp devastates the digitalsystem.
The other flavor is frequency dynamic range. For example, it is easy todesign an op amp circuit to simultaneously handle frequencies between 0.01Hz and 100 kHz (seven decades). When this is tried with a digital system,the computer becomes swamped with data. For instance, sampling at 200kHz, it takes 20 million points to capture one complete cycle at 0.01 Hz. Youmay have noticed that the frequency response of digital filters is almostalways plotted on a linear frequency scale, while analog filters are usuallydisplayed with a logarithmic frequency. This is because digital filters need
Chapter 21- Filter Comparison345
4020c. Frequency response (dB)0-20-40-60-80-100
0
1000
2000
3000
4000
Frequency
5000
Frequency
2.0f. Step response1.51.00.50.0-0.5-40-20020406080Sample number
346The Scientist and Engineer's Guide to Digital Signal Processing
Match #2: Windowed-Sinc vs. Chebyshev
Both the windowed-sinc and the Chebyshev filters are designed to separate oneband of frequencies from another. The windowed-sinc is an FIR filterimplemented by convolution, while the Chebyshev is an IIR filter carried outby recursion. Which is the best digital filter in the frequency domain? We'lllet them fight it out.
The recursive filter contender will be a 0.5% ripple, 6 pole Chebyshevlow-pass filter. A fair comparison is complicated by the fact that theChebyshev's frequency response changes with the cutoff frequency. We willuse a cutoff frequency of 0.2, and select the windowed-sinc's filter kernel to be51 points. This makes both filters have the same 90% to 10% roll-off, asshown in Fig. 21-2(a).
Now the pushing and shoving begins. The recursive filter has a 0.5% ripplein the passband, while the windowed-sinc is flat. However, we could easily setthe recursive filter ripple to 0% if needed. No points. Figure 21-2b shows thatthe windowed-sinc has a much better stopband attenuation than the Chebyshev.One point for the windowed-sinc.
Figure 21-3 shows the step response of the two filters. Both are bad, as youshould expect for frequency domain filters. The recursive filter has a nonlinearphase, but this can be corrected with bidirectional filtering. Since both filtersare so ugly in this parameter, we will call this a draw.
So far, there isn't much difference between these two filters; either will workwhen moderate performance is needed. The heavy hitting comes over twocritical issues: maximum performance and speed. The windowed-sinc is apowerhouse, while the Chebyshev is quick and agile. Suppose you have areally tough frequency separation problem, say, needing to isolate a 100
1.540a. Frequency response1.020b. Frequency response (dB)Amplitude (dB)0-20-40-60-80AmplitudeChebyshevrecursive0.5Chebyshevrecursivewindowed-sincwindowed-sinc0.000.10.2-100Frequency
0.30.40.500.10.2Frequency
0.30.40.5FIGURE 21-2
Windowed-sinc and Chebyshev frequency responses. Frequency responses are shown for a 51 pointwindowed-sinc filter and a 6 pole, 0.5% ripple Chebyshev recursive filter. The windowed-sinc has betterstopband attenuation, but either will work in moderate performance applications. The cutoff frequency of bothfilters is 0.2, measured at an amplitude of 0.5 for the windowed-sinc, and 0.707 for the recursive.
Chapter 21- Filter Comparison
2.0
347
b. Chebyshev step response1.5
AmplitudeAmplitude1.00.50.0
Sample number
-0.5
-30
-20-100102030
millivolt signal at 61 hertz that is riding on a 120 volt power line at 60 hertz.Figure 21-4 shows how these two filters compare when you need maximumperformance. The recursive filter is a 6 pole Chebyshev with 0.5% ripple.This is the maximum number of poles that can be used at a 0.05 cutofffrequency with single precision. The windowed-sinc uses a 1001 point filterkernel, formed by convolving a 501 point windowed-sinc filter kernel withitself. As shown in Chapter 16, this provides greater stopband attenuation.How do these two filters compare when maximum performance is needed? Thewindowed-sinc crushes the Chebyshev! Even if the recursive filter wereimproved (more poles, multistage implementation, double precision, etc.), it isstill no match for the FIR performance. This is especially impressive when youconsider that the windowed-sinc has only begun to fight. There are stronglimits on the maximum performance that recursive filters can provide. Thewindowed-sinc, in contrast, can be pushed to incredible levels. This is, ofcourse, provided you are willing to wait for the result. Which brings up thesecond critical issue: speed.
20FIGURE 21-4
Maximum performance of FIR and IIR filters.The frequency response of the windowed-sinccan be virtually any shape needed, while theChebyshev recursive filter is very limited. Thisgraph compares the frequency response of a sixpole Chebyshev recursive filter with a 1001point windowed-sinc filter.
0Amplitude (dB)-20-40-60-80Chebyshev (IIR)Windowed-sinc (FIR)-10000.10.2Frequency
0.30.40.5348The Scientist and Engineer's Guide to Digital Signal Processing
Frequency
Chapter 21- Filter Comparison349
Frequency
1.5
a. Moving average1.00.50.0
-0.5
-20
-10
0
10
20
Sample number
FIGURE 21-7
Step responses of the moving average and the bidirectional single pole filter. The moving averagestep response occurs over a smaller number of samples, while the single pole filter's step responseis smoother.
350The Scientist and Engineer's Guide to Digital Signal Processing
carried out by recursion, or the single pole recursive filter implemented withlook-up tables or integer math. The winner is the moving average filter. It willexecute faster and not be susceptible to the development and executionproblems of integer arithmetic.
因篇幅问题不能全部显示,请点此查看更多更全内容