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 219<br />

for i = 1:1:K<br />

w(i+1,:) = filter(B(i,:),A(i,:),w(i,:));<br />

end<br />

y = b0*w(K+1,:);<br />

It employs the filter function in a loop using the coefficients of<br />

each biquad stored in B and A matrices. The input is scaled by b0,<br />

and the output of each filter operation is used as an input to the next<br />

filter operation. The output of the final filter operation is the overall<br />

output.<br />

The following MATLAB function, cas2dir, converts a cascade form<br />

to a direct form. This is a simple operation that involves multiplication of<br />

several 2nd-order polynomials. For this purpose, the MATLAB function<br />

conv is used in a loop over K factors. The SP toolbox function, sos2tf<br />

also performs a similar operation.<br />

function [b,a] = cas2dir(b0,B,A);<br />

% CASCADE-to-DIRECT form conversion<br />

% ---------------------------------<br />

% [b,a] = cas2dir(b0,B,A)<br />

% b = numerator polynomial coefficients of DIRECT form<br />

% a = denominator polynomial coefficients of DIRECT form<br />

% b0 = gain coefficient<br />

% B = K by 3 matrix of real coefficients containing bk’s<br />

% A = K by 3 matrix of real coefficients containing ak’s<br />

%<br />

[K,L] = size(B);<br />

b = [1]; a = [1];<br />

for i=1:1:K<br />

b=conv(b,B(i,:)); a=conv(a,A(i,:));<br />

end<br />

b = b*b0;<br />

□ EXAMPLE 6.1 A filter is described by the following difference equation:<br />

16y(n)+12y(n − 1) + 2y(n − 2) − 4y(n − 3) − y(n − 4)<br />

= x(n) − 3x(n − 1) + 11x(n − 2) − 27x(n − 3)+18x(n − 4)<br />

Determine its cascaded form structure.<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!