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.

Lattice Filter Structures 241<br />

Therefore, linear-phase FIR filters cannot be implemented using lattice<br />

structures.<br />

6.4.2 MATLAB IMPLEMENTATION<br />

Given the coefficients {b n } of the direct form, we can obtain the lattice filter<br />

coefficients {K m } using (6.20). This is done by the following MATLAB<br />

function dir2latc. Note that the equation to compute J m (z) implies that<br />

the polynomial J m (z) isafliplr operation on the A m (z) polynomial.<br />

function [K] = dir2latc(b)<br />

% FIR Direct form to All-Zero Lattice form Conversion<br />

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

% [K] = dir2latc(b)<br />

% K = Lattice filter coefficients (reflection coefficients)<br />

% b = FIR direct form coefficients (impulse response)<br />

%<br />

M = length(b); K = zeros(1,M); b1 = b(1);<br />

if b1 == 0<br />

error(’b(1) is equal to zero’)<br />

end<br />

K(1) = b1; A = b/b1;<br />

for m=M:-1:2<br />

K(m) = A(m); J = fliplr(A);<br />

A = (A-K(m)*J)/(1-K(m)*K(m)); A = A(1:m-1);<br />

end<br />

The lattice filter is implemented using (6.16) and (6.17), which is done by<br />

a latcfilt function, as shown here.<br />

function [y] = latcfilt(K,x)<br />

% LATTICE form realization of FIR filters<br />

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

% y = latcfilt(K,x)<br />

% y = output sequence<br />

% K = LATTICE filter (reflection) coefficient array<br />

% x = input sequence<br />

%<br />

Nx = length(x)-1; x = K(1)*x;<br />

M = length(K)-1; K = K(2:M+1); fg = [x; [0 x(1:Nx)]];<br />

for m = 1:M<br />

fg = [1,K(m);K(m),1]*fg;<br />

fg(2,:) = [0 fg(2,1:Nx)];<br />

end<br />

y = fg(1,:);<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!