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.

Round-off Effects in FIR Digital Filters 587<br />

bins = [-K+0.5:1:K-0.5]; % Bin values from -K to K<br />

Q = bins/DbM; % Normalized bins<br />

YTN = 2^(-bM);<br />

% Ytick marks interval<br />

YLM = 20*YTN;<br />

% Yaxis limit<br />

% Quantize the input and the filter coefficients<br />

h1 = QFix(h1,B,’round’,’satur’); % h1 quantized to B bits<br />

h2 = QFix(h2,B,’round’,’satur’); % h1 quantized to B bits<br />

xn = QFix(xn,B,’round’,’satur’); % Input quantized to B bits<br />

% Filter output without multiplication quantization<br />

yn = casfiltr(b0,Bh,Ah,xn); % output using Casfiltr routine<br />

% Filter output with multi quant (1 multiplier/section)<br />

xq = QFix(xn,B,’round’,’satur’); % Section-1 scaled input<br />

wn = filter(h1,1,xq);<br />

% Sec-1 unquantized output<br />

wq = QFix(wn,B,’round’,’satur’); % Sec-1 quantized output<br />

wq = QFix(wq,B,’round’,’satur’); % Section-2 scaled input<br />

yq = filter(h2,1,wq);<br />

% Sec-2 unquantized output<br />

yq = QFix(yq,B,’round’,’satur’); % Sec-2 quantized output<br />

% Output Error Analysis<br />

qn = yn-yq;<br />

% Outout error sequence<br />

varyn = var(yn); varqn = var(qn); % Signal and noise power<br />

qqmax = max(qn); qqmin = min(qn); % Maximun and minimum of the error<br />

qnmax = max(abs([qqmax,qqmin])); % Absolute maximum range of the error<br />

qnavg = mean(qn); qnstd = std(qn); % Mean and std dev of the error<br />

qn = round(qn*(2^bM)/(2*qnmax)+0.5); % Normalized en (interger between -K & K)<br />

qn = sort([qn,-K:1:(K+1)]); %<br />

H = diff(find(diff(qn)))-1; % Error histogram<br />

H = H/N;<br />

% Normalized histogram<br />

Hmax = max(H); Hmin = min(H);<br />

% Max and Min of the normalized histogram<br />

% Output SNRs<br />

SNR_C = 10*log10(varyn/varqn); % Computed SNR<br />

SNR_T = 6.02*(B+1) + 10*log10(sum(h.*h)) ...<br />

- 10*log10(1+sum(h2.*h2)); % Theoretical SNR<br />

The plot is shown in Figure 10.29. The error distribution appears to have a<br />

Gaussian envelope, but the error is not continuously distributed. This behavior<br />

indicates that the output error takes only a fixed set of values, which is due<br />

to a particular set of coefficient values. The computed SNR is 70.85 dB,<br />

which agrees with the above theoretical value. Thus, our assumptions are<br />

reasonable.<br />

□<br />

10.3.4 FLOATING-POINT ARITHMETIC<br />

Analysis for the floating-point arithmetic is more complicated and tedious.<br />

Hence we will consider only the direct-form realization with simplified<br />

assumptions. Figure 10.30 shows a direct-form realization with a floatingpoint<br />

arithmetic model. In this realization, {η i (n)}, 1≤ i ≤ M − 1 are<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!