02.10.2019 Views

UploadFile_6417

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Optimal Equiripple Design Technique 367<br />

differentiator, the m vector does not specify the desired slope in each<br />

band but the desired magnitude.<br />

• [h] = firpm(N,f,m,weights,ftype) is similar to the above case except<br />

that the array weights specifies the weighting function in each<br />

band.<br />

To estimate the filter order N, the SP toolbox provides the function<br />

firpmord, which also estimates other parameters that can be used in the<br />

firpm function. The basic syntax is<br />

[N,f0,m0,weights] = firpmord(f,m,delta);<br />

The function computes the window order N, the normalized frequency<br />

band edges in f0, amplitude response in a0, and the band weights in<br />

weights. The vector f is a vector of normalized band edges and m is a<br />

vector specifying the desired amplitude on the bands defined by f. The<br />

length of f is two less than twice the length of m; i.e., f does not contain 0<br />

or 1. The vector delta specifies tolerances in each band (not in decibels).<br />

The estimated parameters can now be used in the firpm function.<br />

As explained during the description of the Parks-McClellan algorithm,<br />

we have to first guess the order of the filter using (7.48) to use the function<br />

firpm. After we obtain the filter coefficients in array h, wehave to check<br />

the minimum stopband attenuation and compare it with the given A s<br />

and then increase (or decrease) the filter order. We have to repeat this<br />

procedure until we obtain the desired A s .Weillustrate this procedure<br />

in the following several MATLAB examples. These examples also use the<br />

ripple conversion function db2delta, which is developed in Problem P7.1.<br />

□ EXAMPLE 7.23 Let us design the lowpass filter described in Example 7.8 using the Parks-<br />

McClellan algorithm. The design parameters are<br />

ω p =0.2π ,<br />

ω s =0.3π ,<br />

R p =0.25 dB<br />

A s =50dB<br />

We provide a MATLAB script to design this filter.<br />

>> wp = 0.2*pi; ws = 0.3*pi; Rp = 0.25; As = 50;<br />

>> [delta1,delta2] = db2delta(Rp,As);<br />

>> [N,f,m,weights] = firpmord([wp,ws]/pi,[1,0],[delta1,delta2]);<br />

>> h = firpm(N,f,m,weights);<br />

>> [db,mag,pha,grd,w] = freqz_m(h,[1]);<br />

>> delta_w = 2*pi/1000; wsi=ws/delta_w+1; wpi = wp/delta_w;<br />

>> Asd = -max(db(wsi:1:501))<br />

Asd = 47.8404<br />

Copyright 2010 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).<br />

Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!