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.

586 Chapter 10 ROUND-OFF EFFECTS IN DIGITAL FILTERS<br />

or<br />

( M−1<br />

)<br />

∑<br />

SNR dB =6.02(B+1)+10 log 10 |h(n)| 2<br />

0<br />

−10 log 10<br />

( K<br />

∑<br />

i=1<br />

M−2i<br />

∑<br />

n=1<br />

|ĝ i (n)| 2 )<br />

(10.95)<br />

10.3.3 ANALYSIS USING MATLAB<br />

Using the casfiltr function, we can compute the output of the infiniteprecision<br />

cascade structure. Using the scaling approach outlined above,<br />

each second-order section can be scaled and used in the simulation of<br />

quantized outputs. Again, all calculations can be done in vector fashion,<br />

which improves the execution speed. These and other simulation steps are<br />

detailed in the following example.<br />

□ EXAMPLE 10.14 Consider the 4th-order FIR filter given in Example 10.13. Its cascade-form<br />

realization has two sections along with a gain constant b 0, which can be obtained<br />

using the dir2cas function:<br />

H 1(z) =1+1.4859z −1 +2.8901z −2 , H 2(z) =1+0.5141z −1 +0.3460z −2 , and b 0 =0.1<br />

(10.96)<br />

Note that some of these coefficients are greater than 1, which will cause problems<br />

with coefficient quantization when only B fractional bits are used. Hence we<br />

need to scale each section as explained. The scaled values are<br />

Ĥ 1(z) =0.1860 + 0.2764z −1 +0.5376z −2 , Ĥ 2(z) =0.5376 + 0.2764z −1 +0.1860z −2<br />

(10.97)<br />

and ˆb 0 =1.Thus wedonot need to scale the input. Now ĝ 1(n) =ĥ2(n) and<br />

ĝ 2(n) =1in(10.94). Thus, from (10.95) the output SNR is 70.96 dB, which<br />

compares well with the one-multiplier direct-form implementation (72.41 dB).<br />

These calculations and error histogram plotting are illustrated in the following<br />

MATLAB script.<br />

% Example Parameters<br />

B = 12;<br />

% # of fractional bits<br />

N = 100000;<br />

% # of samples<br />

xn = (2*rand(1,N)-1); % Input sequence - Uniform Distribution<br />

h = [0.1,0.2,0.4,0.2,0.1]; % Filter parameters<br />

M = length(h);<br />

% Filter length<br />

[b0,Bh,Ah] = dir2cas(h,1); % Cascade sections<br />

h1 = Bh(1,:);<br />

% Section-1<br />

h2 = Bh(2,:);<br />

% Section-2<br />

h1 = h1/sum(h1);<br />

% Scaled so Gain=1<br />

h2 = h2/sum(h2);<br />

% Scaled so Gain=1<br />

% Local variables<br />

bM = 7; DbM = 2^bM; % bin parameter<br />

BB = 2^B;<br />

% useful factor in quantization<br />

K = round(DbM/2); % Half number of bins<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!