{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

CH17(1) - CHAPTER 17 Custom Filters Most filters have one...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
297 CHAPTER 17 Custom Filters Most filters have one of the four standard frequency responses: low-pass, high-pass, band-pass or band-reject. This chapter presents a general method of designing digital filters with an arbitrary frequency response, tailored to the needs of your particular application. DSP excels in this area, solving problems that are far above the capabilities of analog electronics. Two important uses of custom filters are discussed in this chapter: deconvolution , a way of restoring signals that have undergone an unwanted convolution, and optimal filtering , the problem of separating signals with overlapping frequency spectra. This is DSP at its best. Arbitrary Frequency Response The approach used to derive the windowed-sinc filter in the last chapter can also be used to design filters with virtually any frequency response. The only difference is how the desired response is moved from the frequency domain into the time domain. In the windowed-sinc filter, the frequency response and the filter kernel are both represented by equations , and the conversion between them is made by evaluating the mathematics of the Fourier transform. In the method presented here, both signals are represented by arrays of numbers , with a computer program (the FFT) being used to find one from the other. Figure 17-1 shows an example of how this works. The frequency response we want the filter to produce is shown in (a). To say the least, it is very irregular and would be virtually impossible to obtain with analog electronics. This ideal frequency response is defined by an array of numbers that have been selected, not some mathematical equation. In this example, there are 513 samples spread between 0 and 0.5 of the sampling rate. More points could be used to better represent the desired frequency response, while a smaller number may be needed to reduce the computation time during the filter design. However, these concerns are usually small, and 513 is a good length for most applications.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
The Scientist and Engineer's Guide to Digital Signal Processing 298 100 'CUSTOM FILTER DESIGN 110 'This program converts an aliased 1024 point impulse response into an M+1 point 120 'filter kernel (such as Fig. 17-1b being converted into Fig. 17-1c) 130 ' 140 DIM REX[1023] 'REX[ ] holds the signal being converted 150 DIM T[1023] 'T[ ] is a temporary storage buffer 160 ' 170 PI = 3.14159265 180 M% = 40 'Set filter kernel length (41 total points) 190 ' 200 GOSUB XXXX 'Mythical subroutine to load REX[ ] with impulse response 210 ' 220 FOR I% = 0 TO 1023 'Shift (rotate) the signal M/2 points to the right 230 INDEX% = I% + M%/2 240 IF INDEX% > 1023 THEN INDEX% = INDEX%-1024 250 T[INDEX%] = REX[I%] 260 NEXT I% 270 ' 280 FOR I% = 0 TO 1023 290 REX[I%] = T[I%] 300 NEXT I% 310 ' 'Truncate and window the signal 320 FOR I% = 0 TO 1023 330 IF I% <= M% THEN REX[I%] = REX[I%] * (0.54 - 0.46 * COS(2*PI*I%/M%)) 340 IF I% > M% THEN REX[I%] = 0 350 NEXT I% 360 ' 'The filter kernel now resides in REX[0] to REX[40] 370 END TABLE 17-1 Besides the desired magnitude array shown in (a), there must be a corresponding phase array of the same length. In this example, the phase of the desired frequency response is entirely zero (this array is not shown in Fig. 17-1).
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}