02.10.2019 Views

UploadFile_6417

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

224 Chapter 6 IMPLEMENTATION OF DISCRETE-TIME FILTERS<br />

rows in the w matrix. Finally, all the columns of the w matrix are summed<br />

to yield the output.<br />

function y = parfiltr(C,B,A,x);<br />

% PARALLEL form realization of IIR filters<br />

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

% [y] = parfiltr(C,B,A,x);<br />

% y = output sequence<br />

% C = polynomial (FIR) part when M >= N<br />

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

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

% x = input sequence<br />

%<br />

[K,L] = size(B); N = length(x); w = zeros(K+1,N);<br />

w(1,:) = filter(C,1,x);<br />

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

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

end<br />

y = sum(w);<br />

To obtain a direct form from a parallel form, the function par2dir can<br />

be used. It computes poles and residues of each proper biquad and combines<br />

these into system poles and residues. Another call of the residuez<br />

function in reverse order computes the numerator and denominator<br />

polynomials.<br />

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

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

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

% [b,a] = par2dir(C,B,A)<br />

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

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

% C = Polynomial part of PARALLEL form<br />

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

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

%<br />

[K,L] = size(A); R = []; P = [];<br />

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

[r,p,k]=residuez(B(i,:),A(i,:)); R = [R;r]; P = [P;p];<br />

end<br />

[b,a] = residuez(R,P,C); b = b(:)’; a = a(:)’;<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!