📄 zpole.m
字号:
%===========================================================
% 程序名:zpole.m
% 本程序绘制系统函数的零点、极点在s平面上的分布图,同时绘制
% 出系统的冲击响应曲线。
% A:系统函数分母多项式系数向量,实验者从键盘上输入
% B:系统函数分子多项式系数向量,实验者从键盘上输入
% p:函数返回的系统函数极点位置行向量
% q:函数返回的系统函数零点位置行向量
%===========================================================
clear;
b=input('Type in the coefficient vector of numerator polynomial:');
a=input('Type in the coefficient vector of denominator polynomial:');
p=roots(a); %求系统极点
q=roots(b); %求系统零点
p=p'; %将极点列向量转置为行向量
q=q'; %将零点列向量转置为行向量
x=max(abs([p q])); %确定纵坐标范围
x=x+1;
y=x; %确定横坐标范围
clf
subplot(2,2,1);
axis([-x x -y y]); %确定坐标轴显示范围
axis('square')
plot([-x x],[0 0]);hold on; %画横坐标轴
plot([0 0],[-y y]);hold on; %画纵坐标轴
plot(real(p),imag(p),'x');hold on; %画极点
plot(real(q),imag(q),'o');hold on; %画零点
grid on;
title('zero-pole diagram');
xlabel('real axis');ylabel('imaginal axis')
text(0.1*max(x),max(y),'jw')
%===========================================================
% 绘制冲激响应曲线
%===========================================================
subplot(2,2,2);
impulse(b,a);
xlabel('time');
ylabel('amplitude');
title('impulse response')
grid on;
%============================================================
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -