📄 fig3_11.m
字号:
% Figure 3.11
% BM
% August 98
clear
clf
colordef(1,'black')
subplot(121)
rmax = +1;
rmin = -3;
imax = +4;
imin = -imax;
axis( [ rmin rmax imin imax ] );
hold on
axis('square')
title('s-plane')
xlabel('real')
ylabel('imag')
grid
subplot(122)
Tmax = 5;
dt = 0.001;
T = 0:dt:Tmax;
axis( [0 Tmax -2 +2] )
title('impulse response')
xlabel('time')
ylabel('h(t)')
hold on
fprintf(1,'Figure 3.11: Impulse response & pole postion.\n');
fprintf(1,' : Left mouse button places pole in s-plane at crosshair.\n');
fprintf(1,' : Right mouse button for final placement.\n');
subplot(121)
[x,y] = ginput(1);
if x > rmax, x = rmax, end;
if x < rmin, x = rmin, end;
if y > imax, y = imax, end;
if y < imin, y = imin, end;
l1 = line('Xdata',x,'Ydata',y,'Marker','x','Color','y','EraseMode','xor');
l2 = line('Xdata',x,'Ydata',-y,'Marker','x','Color','y','EraseMode','xor');
subplot(122)
den = poly([x+j*y x-j*y]);
num = [ 1 -x ];
[YY,XX] = impulse(num,den,T);
env = exp(x*T);
l3 = line('Xdata',T,'Ydata',YY(:,1),'LineStyle','-','Color','y','EraseMode','xor');
l4 = line('Xdata',T,'Ydata',env,'LineStyle',':','Color','b','EraseMode','xor');
l5 = line('Xdata',T,'Ydata',-env,'LineStyle',':','Color','b','EraseMode','xor');
but = 1;
while but == 1
subplot(121)
[x,y,but] = ginput(1);
if x > rmax, x = rmax; end;
if x < rmin, x = rmin; end;
if y > imax, y = imax; end;
if y < imin, y = imin; end;
set(l1,'Xdata',x,'Ydata',y);
set(l2,'Xdata',x,'Ydata',-y);
subplot(122)
den = poly([x+j*y x-j*y]);
num = [ 1 -x ];
[YY,XX] = impulse(num,den,T);
env = exp(x*T);
set(l3,'Xdata',T,'Ydata',YY(:,1));
set(l4,'Xdata',T,'Ydata',env);
set(l5,'Xdata',T,'Ydata',-env);
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -