• No results found

Filter Design Using the Kaiser WindowFilter Design Using the Kaiser Window

Filter Design Using the Kaiser Window

The Kaiser window function of length M is defined as The Kaiser window function of length M is defined as

[ [ ]]

2 2 2 2 1 1 11 0, 0, n n  I   I  otherwise otherwise  β   β 

⎧⎧

⎡ ⎡

⎞⎞

⎤⎤

⎪⎪

⎢ ⎢

− − −−

⎥⎥

1 1 (( )) ,, 00 11 o o o o  M   M  w w nn nn  I   I  β β 

⎟⎟

⎪⎪

⎢ ⎢

⎝ ⎝

⎠⎠

⎥⎥⎦⎦

=

= ⎨ ⎨

≤ ≤

⎪⎪

⎪⎪

⎩⎩

 The Kaiser filter must be designed to meet the The Kaiser filter must be designed to meet the smaller of the two ripple constraints:smaller of the two ripple constraints:

{

{

}}

m miinn  p p,, ss δ δ

==

δ δ δ δ 

 The values ofThe values of  β  β   and M could be chosen to meet any set of design parameters, and M could be chosen to meet any set of design parameters, (( ,,δ δ ω ω ω  p p,,ω  , by defining A =ss)), by defining A =−−20 log1020 log10δ δ   and using the following two equations: and using the following two equations:

8 8 1 1  A A  M   M 

= = +⎡ ⎡

+

−−

⎤⎤

2 2..228855((ω ω  s s ω ω pp))

⎥⎥

⎥⎥

⎥⎥

where,

where, ⌈⌈..⌉⌉ nnccttii ssmmaalllleesst t iinntte e tthhaan n oor r eeqquuaal l ttoo x.

x.

Filter Design Using Parks-McClellan Algorithm

Filter Design Using Parks-McClellan Algorithm

Ka

Kaisiser er wiwin n veversrsatatilile se sinince ce ththey ey alallolow tw the he dedesisign gn of of ararbibitrtrarary fy fililteters rs whwhicich mh meeeet st spepecicifificc design constraints. However, filters designed with Kaiser windows still have a number of design constraints. However, filters designed with Kaiser windows still have a number of d

diissaaddvvaannttaa aammppllee,,

 s s aarre e nnoot t aarraanntteeeed d tto o bbe e tthhe e mmiinniimm iilltteer r wwhhiicch h mmeeeetts s tthhee straints.

straints.

 rs do nors do not allo t allo passbpassband and sand and stopband rtopband ripple tipple to be vario be varied indeped independentlendently.y. In 1972, Parks and McClellan devised a methodology for designing symmetric filters that In 1972, Parks and McClellan devised a methodology for designing symmetric filters that minimize filter length for a particular set of design constraints {

minimize filter length for a particular set of design constraints {ωω p p,, ωωss

dows are dows are ges. For ex ges. For ex

K

Kaaiisseer r ffiilltteerr gguu uum m lleennggtth h f  f   design con

design con K

Kaaiisseer r ffiillttee ww

,,δ δ  , and p p, and δ δ  }. The s s}. The sulting filters minimize the maximum error between the desired frequency response and the sulting filters minimize the maximum error between the desired frequency response and the ctual frequency response by spreading the approximation error uniformly over each band. The ctual frequency response by spreading the approximation error uniformly over each band. The the Remez exchange algorithm and Chebyshev the Remez exchange algorithm and Chebyshev  pproximation

 pproximation theory. theory. Such Such filters that filters that exhibit exhibit equiripple behavior equiripple behavior in bin both the oth the passband passband and and thethe stop

stop

Designing a filter with the Parks and McClellan algorithm is a two step process. First the length Designing a filter with the Parks and McClellan algorithm is a two step process. First the length (i.e. order) of the filter must be computed based on the design constraints. Then the optimal filter (i.e. order) of the filter must be computed based on the design constraints. Then the optimal filter for a specified length can be determined. As with Kaiser windows, the filter length computation for a specified length can be determined. As with Kaiser windows, the filter length computation iis s a a rreessuullttiinng g ffiilltteer r mmaay y eexxcceeeed d oor r vviioollaatte e tthhe e ddee ggn n ccoonnssttrraaiinnttss. . TThhiis s iiss generally not a problem since the filter can be redesigned for different lengths until the generally not a problem since the filter can be redesigned for different lengths until the constraints are just met. The Matlab command

constraints are just met. The Matlab command for computing the approximate filter length isfor computing the approximate filter length is [n, fo, mo, w] =

[n, fo, mo, w] = remezord (f, m, ripple, 2*pi)remezord (f, m, ripple, 2*pi) where the inputs are:

where the inputs are: f

f - - vveecctt bbeer r oof f bbaannd d eedd e e ffrreeqquueenncciieess. . FFoor r a a ssiimmpplle e lloow w ppaasss s ffiilltteerr, , f f == [[wwpp wwss ss

m

m -- vveeccttoorr gg iimmppllee llooww ppaassss

= [1 0]. = [1 0].

ripple - vector containing the allowed ripple in each band. For a simple low pass filter ripple = ripple - vector containing the allowed ripple in each band. For a simple low pass filter ripple = [delta_p delta_s], where delta_p and delta_s are the passband and stopband ripples, respectively. [delta_p delta_s], where delta_p and delta_s are the passband and stopband ripples, respectively.

e, in radians, that corresponds to the sampling frequency. e, in radians, that corresponds to the sampling frequency. utputs

utputs of thof the commae command and a n = fn = filter ilter length length - 1, a- 1, and the nd the vectorvectors fo, s fo, mo, and mo, and w whicw which areh are ediate filter parameters.

ediate filter parameters.

ezord, and the o

ezord, and the output b is a vector of FIR utput b is a vector of FIR filter coefficients such thatfilter coefficients such that re

re aa

Parks and McClellan algorithm makes use of Parks and McClellan algorithm makes use of aa

 band, and are sometimes called equiripple filters.  band, and are sometimes called equiripple filters.

 pproximate

 pproximate so so thethe sisi

o

or r ccoonnttaaiinniinng g aan n eevveen n nnuumm gg ], where w

], where wp and wp and w are the paare the passband assband and stopbnd stopband freqand frequenciesuencies, respec, respectivelytively.. contai

containing the ideal fning the ideal filter milter maa nitudenitudes of the filts of the filter in each band. For a ser in each band. For a s filter m filter m 2*pi - valu 2*pi - valu T Thheeoo rree interm interm

Once the filter length, n, is obtained, the Matlab command for designing a Parks-McClellan filter Once the filter length, n, is obtained, the Matlab command for designing a Parks-McClellan filter is b = remez (n, fo, mo, w). The inputs n, fo, mo, and w are the corresponding outputs of

is b = remez (n, fo, mo, w). The inputs n, fo, mo, and w are the corresponding outputs of rem

Labwork

Labwork

1.

1. Plot the rectangular, Bartlett, Hanning, Hamming, and Blackman window functions ofPlot the rectangular, Bartlett, Hanning, Hamming, and Blackman window functions of ot command. Then compute and plot the DFT ot command. Then compute and plot the DFT length 21 on a single figure using the subpl

length 21 on a single figure using the subpl

aa tt

m

m gnitudgnitude of each of the five windows. Plot the mage of each of the five windows. Plot the magnitudnitudes on a decibel scale (i.e.es on a decibel scale (i.e., plo, plo 20 log10 |W(e

20 log10 |W(e j jωω

)|). )|).

Hint: Use at least 512 sample points in

Hint: Use at least 512 sample points in computing the DFT.computing the DFT.

Measure the null-to-null main lobe width (in rad/sample) and the peak-to-side lobe Measure the null-to-null main lobe width (in rad/sample) and the peak-to-side lobe amplitude (in dB) from the logarithmic magnitude response plot for each window type. amplitude (in dB) from the logarithmic magnitude response plot for each window type. The Matlab command zoom is helpful for this. Make a table with these values and the The Matlab command zoom is helpful for this. Make a table with these values and the theoretical ones.

theoretical ones. 2.

2. Plot the Kaiser windows and their DFT magnitudes (in dB) for M = 21 and the followingPlot the Kaiser windows and their DFT magnitudes (in dB) for M = 21 and the following values of

values of  β  β 

 β 

 β  = 0, 1, 5. = 0, 1, 5. 3.

3. Write a Matlab program that computes the truncated and shifted impulse response of sizeWrite a Matlab program that computes the truncated and shifted impulse response of size  N

 N for for a a low low pass pass filter filter with with a a cutoff cutoff frequency frequency ofof ωωcc  = 2.0. For each of the following  = 2.0. For each of the following

filter sizes, plot the magnitude of the filter’s DFT in decibels: filter sizes, plot the magnitude of the filter’s DFT in decibels:

  N = 21 N = 21

Submit the plots of the magnitude response in decibels for the two filters. Submit the plots of the magnitude response in decibels for the two filters.

e following design e following design   N = 101 N = 101 Report: Report: (a)

(a) Submit the plots of the magnitude response for the two filters (not in decibels).Submit the plots of the magnitude response for the two filters (not in decibels). On each of the plots, mark the passband, the transition band and the stopband. On each of the plots, mark the passband, the transition band and the stopband.

(b) (b) (c)

(c) Explain how the filter size effects the stopband ripple. Why does it have thisExplain how the filter size effects the stopband ripple. Why does it have this effect?

effect? 4.

4. Design a low pass filter, h(n) using Kaiser window with thDesign a low pass filter, h(n) using Kaiser window with th specifications:

specifications:

Plot the magnitude of the DFT of h(n) for |

Plot the magnitude of the DFT of h(n) for |ωω| <| < π π  . Create three plots in the same figure: one that . Create three plots in the same figure: one that

ows the entire frequency response, and ones that zoom in on the passband and stopband ripple, ows the entire frequency response, and ones that zoom in on the passband and stopband ripple, sh

Related documents