?? q2.m
字號(hào):
close all
clear all
figure(1)
hold on
A=[1 -1.352 1.338 -0.662 0.240];
B=[1 0 0 0 0];
d=['r' 'g' 'b' 'c'];
for i=1:4
W = wgn(1,400,0);
X(i,:)=filter(B,A,W);
t=200:328;
end
subplot(2,2,1),plot(t,X(1,t));
subplot(2,2,2),plot(t,X(2,t));
subplot(2,2,3),plot(t,X(3,t));
subplot(2,2,4),plot(t,X(4,t));
clear all
figure(2)
hold on
A=[1 -2.760 3.809 -2.654 0.924];
B=[1 0 0 0 0 ];
d=['r' 'g' 'b' 'c'];
for i=1:4
W = wgn(1,400,0);
X(i,:)=filter(B,A,W);
t=200:328;
end
subplot(2,2,1),plot(t,X(1,t));
subplot(2,2,2),plot(t,X(2,t));
subplot(2,2,3),plot(t,X(3,t));
subplot(2,2,4),plot(t,X(4,t));
clear all
figure(3)
hold on
w=1:328;
p1=1./(abs(1-1.352.*exp(-i.*w)+1.338.*exp(-2.*i.*w)-0.662.*exp(-3.*i.*w)+0.24.*exp(-4.*i.*w))).^2;
p2=1./(abs(1-2.76.*exp(-i.*w)+3.809.*exp(-2.*i.*w)-2.654.*exp(-3.*i.*w)+0.924.*exp(-4.*i.*w))).^2;
subplot(2,1,1),plot(w,p1,'r');
subplot(2,1,2),plot(w,p2,'b');
clear all
figure(4)
a1=-1.352;a2=1.338;a3=-0.662;a4=0.240;
a21=-2.760;a22=3.809;a23=-2.654;a24=0.924;
A1=[1,a1,a2,a3,a4;a1,1+a2,a3,a4,0;a2,a1+a3,1+a4,0,0;a3,a4+a2,a1,1,0;a4,a3,a2,a1,1];
A2=[1,a21,a22,a23,a24;a21,1+a22,a23,a24,0;a22,a21+a23,1+a24,0,0;a23,a24+a22,a21,1,0;a24,a23,a22,a21,1];
b=[1,0,0,0,0]';
R1=A1\b;
R2=A2\b;
for t=6:21
R1(t)=-(a1*R1(t-1)+a2*R1(t-2)+a3*R1(t-3)+a4*R1(t-4));
R2(t)=-(a21*R2(t-1)+a22*R2(t-2)+a23*R2(t-3)+a24*R2(t-4));
end
for i=1:21
Z1(i)=R1(22-i);
Z2(i)=R2(22-i);
end
Z1(22:41)= R1(2:21);
Z2(22:41)= R2(2:21);
subplot(2,1,1) ,stem(0:40,Z1);
subplot(2,1,2) ,stem(0:40,Z2);
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -