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.

IIR Filter Structures 223<br />

Brow = r(i:1:i+1,:); Arow = p(i:1:i+1,:);<br />

[Brow,Arow] = residuez(Brow,Arow,[]);<br />

B(fix((i+1)/2),:) = real(Brow); A(fix((i+1)/2),:) = real(Arow);<br />

end<br />

end<br />

The dir2cas function first computes the z-domain partial fraction expansion<br />

using the residuez function. We need to arrange pole-and-residue<br />

pairs into complex conjugate pole-and-residue pairs followed by real poleand-residue<br />

pairs. To do this, the cplxpair function from MATLAB can<br />

be used; this sorts a complex array into complex conjugate pairs. However,<br />

two consecutive calls to this function, one each for pole and residue<br />

arrays, will not guarantee that poles and residues will correspond to each<br />

other. Therefore a new cplxcomp function is developed, which compares<br />

two shuffled complex arrays and returns the index of one array, which can<br />

be used to rearrange another array.<br />

function I = cplxcomp(p1,p2)<br />

% I = cplxcomp(p1,p2)<br />

% Compares two complex pairs which contain the same scalar elements<br />

% but (possibly) at differrent indices. This routine should be<br />

% used after CPLXPAIR routine for rearranging pole vector and its<br />

% corresponding residue vector.<br />

% p2 = cplxpair(p1)<br />

%<br />

I=[];<br />

for j=1:1:length(p2)<br />

for i=1:1:length(p1)<br />

if (abs(p1(i)-p2(j)) < 0.0001)<br />

I=[I,i];<br />

end<br />

end<br />

end<br />

I=I’;<br />

After collecting these pole-and-residue pairs, the dir2cas function computes<br />

the numerator and denominator of the biquads by employing the<br />

residuez function in the reverse fashion.<br />

These parallel-form coefficients are then used in the function<br />

parfiltr, which implements the parallel form. The parfiltr function<br />

uses the filter function in a loop using the coefficients of each biquad<br />

stored in the B and A matrices. The input is first filtered through the FIR<br />

part C and stored in the first row of a w matrix. Then the outputs of all<br />

biquad filters are computed for the same input and stored as subsequent<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!