📄 ex_13_02_1.m
字号:
% ex_13_02_1.m : 习题 13.2
clear all;
b1=-21.4524;
b2=22.4524;
m_a1=[1 -0.901];
m_a2=[1 -0.943];
a=[1 m_a1(2)+m_a2(2) m_a1(2)*m_a2(2)];
aa=roots(a)
abs(aa);
[h,w] = freqz(1,a,512,1);
H = 20*log10(abs(h)/max(abs(h)));
figure('color','w')
%----------------------------------------------------
a1=truncation(m_a1,1);
a2=truncation(m_a2,1);
[ht1,w] = freqz(b1,a1,512,1);
[ht2,w] = freqz(b2,a2,512,1);
at11=roots(a1)
at12=roots(a2)
ht=ht1+ht2;
Ht = 20*log10(abs(ht)/max(abs(ht))+eps);
subplot(441)
plot(w,H,'b',w,Ht,'r:');grid
at=[1 a1(2)+a2(2) a1(2)*a2(2)];
subplot(442)
zplane(1,at);xlabel(' ');ylabel(' ');
a1=rounding(m_a1,1);
a2=rounding(m_a2,1);
[hr1,w] = freqz(b1,a1,512,1);
[hr2,w] = freqz(b2,a2,512,1);
ar11=roots(a1)
ar12=roots(a2)
hr=hr1+hr2;
Hr = 20*log10(abs(hr)/max(abs(hr))+eps);
subplot(443)
plot(w,H,'b',w,Hr,'r:');grid
ar=[1 a1(2)+a2(2) a1(2)*a2(2)];
subplot(444)
zplane(1,ar);xlabel(' ');ylabel(' ');
a1=truncation(m_a1,2);
a2=truncation(m_a2,2);
[ht1,w] = freqz(b1,a1,512,1);
[ht2,w] = freqz(b2,a2,512,1);
at21=roots(a1)
at22=roots(a2)
ht=ht1+ht2;
Ht = 20*log10(abs(ht)/max(abs(ht))+eps);
subplot(445)
plot(w,H,'b',w,Ht,'r:');grid
at=[1 a1(2)+a2(2) a1(2)*a2(2)];
subplot(446)
zplane(1,at);xlabel(' ');ylabel(' ');
a1=rounding(m_a1,2);
a2=rounding(m_a2,2);
[hr1,w] = freqz(b1,a1,512,1);
[hr2,w] = freqz(b2,a2,512,1);
ar21=roots(a1)
ar22=roots(a2)
hr=hr1+hr2;
Hr = 20*log10(abs(hr)/max(abs(hr))+eps);
subplot(447)
plot(w,H,'b',w,Hr,'r:');grid
ar=[1 a1(2)+a2(2) a1(2)*a2(2)];
subplot(448)
zplane(1,ar);xlabel(' ');ylabel(' ');
a1=truncation(m_a1,3);
a2=truncation(m_a2,3);
[ht1,w] = freqz(b1,a1,512,1);
[ht2,w] = freqz(b2,a2,512,1);
at31=roots(a1)
at32=roots(a2)
ht=ht1+ht2;
Ht = 20*log10(abs(ht)/max(abs(ht))+eps);
subplot(449)
plot(w,H,'b',w,Ht,'r:');grid
at=[1 a1(2)+a2(2) a1(2)*a2(2)];
subplot(4,4,10)
zplane(1,at);xlabel(' ');ylabel(' ');
a1=rounding(m_a1,3);
a2=rounding(m_a2,3);
[hr1,w] = freqz(b1,a1,512,1);
[hr2,w] = freqz(b2,a2,512,1);
ar31=roots(a1)
ar32=roots(a2)
hr=hr1+hr2;
Hr = 20*log10(abs(hr)/max(abs(hr))+eps);
subplot(4,4,11)
plot(w,H,'b',w,Hr,'r:');grid
ar=[1 a1(2)+a2(2) a1(2)*a2(2)];
subplot(4,4,12)
zplane(1,ar);xlabel(' ');ylabel(' ');
a1=truncation(m_a1,4);
a2=truncation(m_a2,4);
[ht1,w] = freqz(b1,a1,512,1);
[ht2,w] = freqz(b2,a2,512,1);
at41=roots(a1)
at42=roots(a2)
ht=ht1+ht2;
Ht = 20*log10(abs(ht)/max(abs(ht))+eps);
subplot(4,4,13)
plot(w,H,'b',w,Ht,'r:');grid
at=[1 a1(2)+a2(2) a1(2)*a2(2)];
subplot(4,4,14)
zplane(1,at);xlabel(' ');ylabel(' ');
a1=rounding(m_a1,4);
a2=rounding(m_a2,4);
[hr1,w] = freqz(b1,a1,512,1);
[hr2,w] = freqz(b2,a2,512,1);
ar41=roots(a1)
ar42=roots(a2)
hr=hr1+hr2;
Hr = 20*log10(abs(hr)/max(abs(hr))+eps);
subplot(4,4,15)
plot(w,H,'b',w,Hr,'r:');grid
ar=[1 a1(2)+a2(2) a1(2)*a2(2)];
subplot(4,4,16)
zplane(1,ar);xlabel(' ');ylabel(' ');
%--------------------------------------------------------------------
figure('color','w');
a1=truncation(m_a1,5);
a2=truncation(m_a2,5);
[ht1,w] = freqz(b1,a1,512,1);
[ht2,w] = freqz(b2,a2,512,1);
at51=roots(a1)
at52=roots(a2)
ht=ht1+ht2;
Ht = 20*log10(abs(ht)/max(abs(ht))+eps);
subplot(441)
plot(w,H,'b',w,Ht,'r:');grid
at=[1 a1(2)+a2(2) a1(2)*a2(2)];
subplot(442)
zplane(1,at);xlabel(' ');ylabel(' ');
a1=rounding(m_a1,5);
a2=rounding(m_a2,5);
[hr1,w] = freqz(b1,a1,512,1);
[hr2,w] = freqz(b2,a2,512,1);
ar51=roots(a1)
ar52=roots(a2)
hr=hr1+hr2;
Hr = 20*log10(abs(hr)/max(abs(hr))+eps);
subplot(443)
plot(w,H,'b',w,Hr,'r:');grid
ar=[1 a1(2)+a2(2) a1(2)*a2(2)];
subplot(444)
zplane(1,ar);xlabel(' ');ylabel(' ');
a1=truncation(m_a1,6);
a2=truncation(m_a2,6);
[ht1,w] = freqz(b1,a1,512,1);
[ht2,w] = freqz(b2,a2,512,1);
at61=roots(a1)
at62=roots(a2)
ht=ht1+ht2;
Ht = 20*log10(abs(ht)/max(abs(ht))+eps);
subplot(445)
plot(w,H,'b',w,Ht,'r:');grid
at=[1 a1(2)+a2(2) a1(2)*a2(2)];
subplot(4,4,6)
zplane(1,at);xlabel(' ');ylabel(' ');
a1=rounding(m_a1,6);
a2=rounding(m_a2,6);
[hr1,w] = freqz(b1,a1,512,1);
[hr2,w] = freqz(b2,a2,512,1);
ar61=roots(a1)
ar62=roots(a2)
hr=hr1+hr2;
Hr = 20*log10(abs(hr)/max(abs(hr))+eps);
subplot(447)
plot(w,H,'b',w,Hr,'r:');grid
ar=[1 a1(2)+a2(2) a1(2)*a2(2)];
subplot(448)
zplane(1,ar);xlabel(' ');ylabel(' ');
a1=truncation(m_a1,7);
a2=truncation(m_a2,7);
[ht1,w] = freqz(b1,a1,512,1);
[ht2,w] = freqz(b2,a2,512,1);
at71=roots(a1)
at72=roots(a2)
Ht=ht1+ht2;
ht = 20*log10(abs(ht)/max(abs(ht))+eps);
subplot(449)
plot(w,H,'b',w,Ht,'r:');grid
at=[1 a1(2)+a2(2) a1(2)*a2(2)];
subplot(4,4,10)
zplane(1,at);xlabel(' ');ylabel(' ');
a1=rounding(m_a1,7);
a2=rounding(m_a2,7);
[hr1,w] = freqz(b1,a1,512,1);
[hr2,w] = freqz(b2,a2,512,1);
ar71=roots(a1)
ar72=roots(a2)
hr=hr1+hr2;
Hr = 20*log10(abs(hr)/max(abs(hr))+eps);
subplot(4,4,11)
plot(w,H,'b',w,Hr,'r:');grid
ar=[1 a1(2)+a2(2) a1(2)*a2(2)];
subplot(4,4,12)
zplane(1,ar);xlabel(' ');ylabel(' ');
a1=truncation(m_a1,8);
a2=truncation(m_a2,8);
[ht1,w] = freqz(b1,a1,512,1);
[ht2,w] = freqz(b2,a2,512,1);
at81=roots(a1)
at82=roots(a2)
ht=ht1+ht2;
Ht = 20*log10(abs(ht)/max(abs(ht))+eps);
subplot(4,4,13)
plot(w,H,'b',w,Ht,'r:');grid
at=[1 a1(2)+a2(2) a1(2)*a2(2)];
subplot(4,4,14)
zplane(1,at);xlabel(' ');ylabel(' ');
a1=rounding(m_a1,8);
a2=rounding(m_a2,8);
[hr1,w] = freqz(b1,a1,512,1);
[hr2,w] = freqz(b2,a2,512,1);
ar81=roots(a1)
ar82=roots(a2)
hr=hr1+hr2;
Hr = 20*log10(abs(hr)/max(abs(hr))+eps);
subplot(4,4,15)
plot(w,H,'b',w,Hr,'r:');grid
ar=[1 a1(2)+a2(2) a1(2)*a2(2)];
subplot(4,4,16)
zplane(1,ar);xlabel(' ');ylabel(' ');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -