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 IIR Digital Filters 555<br />

□ EXAMPLE 10.6 In this example simulate the results for the system given in Example 10.5 using<br />

the Qfix function with B =3bits. In addition, also examine limit-cycle behavior<br />

for the truncation operation in the multiplier and for the case when the system<br />

is a lowpass filter with coefficient α =0.5.<br />

Solution<br />

The MATLAB scripts:<br />

% Highpass filter, rounding operation in multiplier<br />

a = -0.5; yn1 = 0; m = 0:10; y = [yn1, zeros(1,length(m))];<br />

x = 0.875*impseq(m(1),m(1)-1,m(end));<br />

for n = m+2<br />

yn1 = y(n-1);<br />

y(n) = QFix(a*yn1,3,’round’,’satur’) + x(n);<br />

end<br />

subplot(’position’,[0.08,0.2,0.24,0.6]);<br />

plot([-1,20],[0,0],’w’); axis([-1,10,-1,1]); hold on;<br />

Hs_1 = stem([-1,m],y,’filled’);set(Hs_1,’markersize’,3,’color’,[0,1,0]);<br />

set(gca,’ytick’,[-1:0.25:1],’fontsize’,6); ylabel(’Amplitude’,’fontsize’,8);<br />

title(’\alpha = -0.5, Rounding’,’fontsize’,10);<br />

xlabel(’Sample index n’,’fontsize’,8);<br />

% Lowpass filter, rounding operation in multiplier<br />

a = 0.5; yn1 = 0; m = 0:10; y = [yn1, zeros(1,length(m))];<br />

x = 0.875*impseq(m(1),m(1)-1,m(end));<br />

for n = m+2<br />

yn1 = y(n-1);<br />

y(n) = QFix(a*yn1,3,’round’,’satur’) + x(n);<br />

end<br />

subplot(’position’,[0.42,0.2,0.24,0.6]);<br />

plot([-1,20],[0,0],’w’); axis([-1,10,-1,1]); hold on;<br />

Hs_1 = stem([-1,m],y,’filled’);set(Hs_1,’markersize’,3,’color’,[0,1,0]);<br />

set(gca,’ytick’,[-1:0.25:1],’fontsize’,6); ylabel(’Amplitude’,’fontsize’,8);<br />

title(’\alpha = 0.5, Rounding’,’fontsize’,10);<br />

xlabel(’Sample index n’,’fontsize’,8);<br />

% Highpass filter, Truncation operation in multiplier<br />

a = -0.5; yn1 = 0; m = 0:10; y = [yn1, zeros(1,length(m))];<br />

x = 0.875*impseq(m(1),m(1)-1,m(end));<br />

for n = m+2<br />

yn1 = y(n-1);<br />

y(n) = QFix(a*yn1,3,’trunc’,’satur’) + x(n);<br />

end<br />

subplot(’position’,[0.76,0.2,0.24,0.6]);<br />

plot([-1,20],[0,0],’w’); axis([-1,10,-1,1]); hold on;<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!