?? ex_13_01_2.m
字號:
% ex_13_01_2.m : 習(xí)題 13.1
clear all;
b=1
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(b,a,512,1);
H = 20*log10(abs(h)/max(abs(h)));
figure('color','w')
%----------------------------------------------------
a1=truncation(m_a1,1);
a2=truncation(m_a2,1);
at=[1 a1(2)+a2(2) a1(2)*a2(2)];
at1=roots(at)
%abs(at1)
[ht,w] = freqz(b,at,512,1);
Ht = 20*log10(abs(ht)/max(abs(ht))+eps);
subplot(441)
plot(w,H,'b',w,Ht,'r:');grid
subplot(442)
zplane(b,at);xlabel(' ');ylabel(' ');
a1=rounding(m_a1,1);
a2=rounding(m_a2,1);
ar=[1 a1(2)+a2(2) a1(2)*a2(2)];
ar1=roots(ar)
%abs(ar1)
[hr,w] = freqz(b,ar,512,1);
Hr = 20*log10(abs(hr)/max(abs(hr))+eps);
subplot(443)
plot(w,H,'b',w,Hr,'r:');grid
subplot(444)
zplane(b,ar);xlabel(' ');ylabel(' ');
a1=truncation(m_a1,2);
a2=truncation(m_a2,2);
at=[1 a1(2)+a2(2) a1(2)*a2(2)];
at2=roots(at)
%abs(at1)
[ht,w] = freqz(b,at,512,1);
Ht = 20*log10(abs(ht)/max(abs(ht))+eps);
subplot(445)
plot(w,H,'b',w,Ht,'r:');grid
subplot(446)
zplane(b,at);xlabel(' ');ylabel(' ');
a1=rounding(m_a1,2);
a2=rounding(m_a2,2);
ar=[1 a1(2)+a2(2) a1(2)*a2(2)];
ar2=roots(ar)
%abs(ar1)
[hr,w] = freqz(b,ar,512,1);
Hr = 20*log10(abs(hr)/max(abs(hr))+eps);
subplot(447)
plot(w,H,'b',w,Hr,'r:');grid
subplot(448)
zplane(b,ar);xlabel(' ');ylabel(' ');
a1=truncation(m_a1,3);
a2=truncation(m_a2,3);
at=[1 a1(2)+a2(2) a1(2)*a2(2)];
at3=roots(at)
%abs(at1)
[ht,w] = freqz(b,at,512,1);
Ht = 20*log10(abs(ht)/max(abs(ht))+eps);
subplot(449)
plot(w,H,'b',w,Ht,'r:');grid
subplot(4,4,10)
zplane(b,at);xlabel(' ');ylabel(' ');
a1=rounding(m_a1,3);
a2=rounding(m_a2,3);
ar=[1 a1(2)+a2(2) a1(2)*a2(2)];
ar3=roots(ar)
%abs(ar1)
[hr,w] = freqz(b,ar,512,1);
Hr = 20*log10(abs(hr)/max(abs(hr))+eps);
subplot(4,4,11)
plot(w,H,'b',w,Hr,'r:');grid
subplot(4,4,12)
zplane(b,ar);xlabel(' ');ylabel(' ');
a1=truncation(m_a1,4);
a2=truncation(m_a2,4);
at=[1 a1(2)+a2(2) a1(2)*a2(2)];
at4=roots(at)
%abs(at1)
[ht,w] = freqz(b,at,512,1);
Ht = 20*log10(abs(ht)/max(abs(ht))+eps);
subplot(4,4,13)
plot(w,H,'b',w,Ht,'r:');grid
subplot(4,4,14)
zplane(b,at);xlabel(' ');ylabel(' ');
a1=rounding(m_a1,4);
a2=rounding(m_a2,4);
ar=[1 a1(2)+a2(2) a1(2)*a2(2)];
ar4=roots(ar)
%abs(ar1)
[hr,w] = freqz(b,ar,512,1);
Hr = 20*log10(abs(hr)/max(abs(hr))+eps);
subplot(4,4,15)
plot(w,H,'b',w,Hr,'r:');grid
subplot(4,4,16)
zplane(b,ar);xlabel(' ');ylabel(' ');
%--------------------------------------------------------------------
figure('color','w');
a1=truncation(m_a1,5);
a2=truncation(m_a2,5);
at=[1 a1(2)+a2(2) a1(2)*a2(2)];
at5=roots(at)
%abs(at1)
[ht,w] = freqz(b,at,512,1);
Ht = 20*log10(abs(ht)/max(abs(ht))+eps);
subplot(441)
plot(w,H,'b',w,Ht,'r:');grid
subplot(442)
zplane(b,at);xlabel(' ');ylabel(' ');
a1=rounding(m_a1,5);
a2=rounding(m_a2,5);
ar=[1 a1(2)+a2(2) a1(2)*a2(2)];
ar5=roots(ar)
%abs(ar1)
[hr,w] = freqz(b,ar,512,1);
Hr = 20*log10(abs(hr)/max(abs(hr))+eps);
subplot(443)
plot(w,H,'b',w,Hr,'r:');grid
subplot(444)
zplane(b,ar);xlabel(' ');ylabel(' ');
a1=truncation(m_a1,6);
a2=truncation(m_a2,6);
at=[1 a1(2)+a2(2) a1(2)*a2(2)];
at6=roots(at)
%abs(at1)
[ht,w] = freqz(b,at,512,1);
Ht = 20*log10(abs(ht)/max(abs(ht))+eps);
subplot(445)
plot(w,H,'b',w,Ht,'r:');grid
subplot(446)
zplane(b,at);xlabel(' ');ylabel(' ');
a1=rounding(m_a1,6);
a2=rounding(m_a2,6);
ar=[1 a1(2)+a2(2) a1(2)*a2(2)];
ar6=roots(ar)
%abs(ar1)
[hr,w] = freqz(b,ar,512,1);
Hr = 20*log10(abs(hr)/max(abs(hr))+eps);
subplot(447)
plot(w,H,'b',w,Hr,'r:');grid
subplot(448)
zplane(b,ar);xlabel(' ');ylabel(' ');
a1=truncation(m_a1,7);
a2=truncation(m_a2,7);
at=[1 a1(2)+a2(2) a1(2)*a2(2)];
at7=roots(at)
%abs(at1)
[ht,w] = freqz(b,at,512,1);
Ht = 20*log10(abs(ht)/max(abs(ht))+eps);
subplot(449)
plot(w,H,'b',w,Ht,'r:');grid
subplot(4,4,10)
zplane(b,at);xlabel(' ');ylabel(' ');
a1=rounding(m_a1,7);
a2=rounding(m_a2,7);
ar=[1 a1(2)+a2(2) a1(2)*a2(2)];
ar7=roots(ar)
%abs(ar1)
[hr,w] = freqz(b,ar,512,1);
Hr = 20*log10(abs(hr)/max(abs(hr))+eps);
subplot(4,4,11)
plot(w,H,'b',w,Hr,'r:');grid
subplot(4,4,12)
zplane(b,ar);xlabel(' ');ylabel(' ');
a1=truncation(m_a1,8);
a2=truncation(m_a2,8);
at=[1 a1(2)+a2(2) a1(2)*a2(2)];
at8=roots(at)
%abs(at1)
[ht,w] = freqz(b,at,512,1);
Ht = 20*log10(abs(ht)/max(abs(ht))+eps);
subplot(4,4,13)
plot(w,H,'b',w,Ht,'r:');grid
subplot(4,4,14)
zplane(b,at);xlabel(' ');ylabel(' ');
a1=rounding(m_a1,8);
a2=rounding(m_a2,8);
ar=[1 a1(2)+a2(2) a1(2)*a2(2)];
ar8=roots(ar)
%abs(ar1)
[hr,w] = freqz(b,ar,512,1);
Hr = 20*log10(abs(hr)/max(abs(hr))+eps);
subplot(4,4,15)
plot(w,H,'b',w,Hr,'r:');grid
subplot(4,4,16)
zplane(b,ar);xlabel(' ');ylabel(' ');
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -