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.

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

% 8-bit word-length quantization<br />

N2 = 7; [bahat,L2,B2] = QCoeff([b;a],N2);<br />

TITLE2 = sprintf(’%i-bits (1+%i+%i)’,N2+1,L2,B2);<br />

bhat2 = bahat(1,:); ahat2 = bahat(2,:);<br />

Hhat2 = freqz(bhat2,ahat2,w); magHhat2 = abs(Hhat2);<br />

magHhat2db = 20*log10(magHhat2); zhat2 = roots(bhat2);<br />

% Plots<br />

Hf_1 = figure(’paperunits’,’inches’,’paperposition’,[0,0,6,5]);<br />

% Comparison of Log-Magnitude Responses: 16 bits<br />

subplot(2,2,1); plot(w/pi,magHdb,’g’,’linewidth’,1.5); axis([0,1,-80,5]);<br />

hold on; plot(w/pi,magHhat1db,’r’,’linewidth’,1); hold off;<br />

xlabel(’Digital Frequency in \pi units’,’fontsize’,10);<br />

ylabel(’Decibels’,’fontsize’,10);<br />

title([’Log-Mag plot: ’,TITLE1],’fontsize’,10,’fontweight’,’bold’);<br />

% Comparison of Pole-Zero Plots: 16 bits<br />

subplot(2,2,3); [HZ,HP,Hl] = zplane([b],[a]); axis([-2,2,-2,2]); hold on;<br />

set(HZ,’color’,’g’,’linewidth’,1,’markersize’,4);<br />

set(HP,’color’,’g’,’linewidth’,1,’markersize’,4);<br />

plot(real(zhat1),imag(zhat1),’r+’,’linewidth’,1);<br />

title([’PZ Plot: ’,TITLE1],’fontsize’,10,’fontweight’,’bold’);<br />

hold off;<br />

% Comparison of Log-Magnitude Responses: 8 bits<br />

subplot(2,2,2); plot(w/pi,magHdb,’g’,’linewidth’,1.5); axis([0,1,-80,5]);<br />

hold on; plot(w/pi,magHhat2db,’r’,’linewidth’,1); hold off;<br />

xlabel(’Digital Frequency in \pi units’,’fontsize’,10);<br />

ylabel(’Decibels’,’fontsize’,10);<br />

title([’Log-Mag plot: ’,TITLE2],’fontsize’,10,’fontweight’,’bold’);<br />

% Comparison of Pole-Zero Plots: 8 bits<br />

subplot(2,2,4); [HZ,HP,Hl] = zplane([b],[a]); axis([-2,2,-2,2]); hold on;<br />

set(HZ,’color’,’g’,’linewidth’,1,’markersize’,4);<br />

set(HP,’color’,’g’,’linewidth’,1,’markersize’,4);<br />

plot(real(zhat2),imag(zhat2),’r+’,’linewidth’,1);<br />

title([’PZ Plot: ’,TITLE2],’fontsize’,10,’fontweight’,’bold’);<br />

hold off;<br />

The log-magnitude responses and zero-pole locations of the resulting filters are<br />

plotted in Figure 6.34 along with those of the original filter. When 16 bits<br />

are used, the resulting filter is virtually indistinguishable from the original one.<br />

However, when 8 bits are used, the filter behavior is severely distorted. The filter<br />

is still stable, but it does not satisfy the design specifications.<br />

□<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!