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.

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

1<br />

0.75<br />

0.5<br />

0.25<br />

xhat<br />

0<br />

−0.25<br />

−0.5<br />

−0.75<br />

x<br />

xhat<br />

−1<br />

−1 −0.75 −0.5 −0.25 0<br />

x<br />

0.25<br />

0.5<br />

0.75<br />

1<br />

FIGURE 6.25<br />

Truncation error characteristics in the sign-magnitude format<br />

□ EXAMPLE 6.20 Let −1 < x < 1 and B = 2. Using MATLAB, verify the truncation error<br />

characteristics.<br />

Solution<br />

The resolution is ∆ = 2 −2 =0.25. Using the following MATLAB script, we can<br />

verify the truncation error e T relations given in (6.48) and (6.49).<br />

x = [-1+2^(-10):2^(-10):1-2^(-10)]; % Sign-Mag numbers between -1 and 1<br />

B = 2;<br />

% Number of bits for Truncation<br />

xhat = fix(x*2^B)/2^B<br />

% Truncation<br />

plot(x,x,’g’,x,xhat,’r’,’linewidth’,1); % Plot<br />

The resulting plots of x and ˆx are shown in Figure 6.25. Note that the plot of<br />

ˆx has a staircase shape and that it satisfies (6.48) and (6.49).<br />

□<br />

One’s-complement format For x ≥ 0, we have the same characteristics<br />

for e T as in sign-magnitude format—that is,<br />

−2 −B ≤ e T ≤ 0, for x ≥ 0 (6.50)<br />

For x

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!