?? sjdt.m
字號(hào):
%===========================================================
% 程序名:sjdt1
% 本程序繪制系統(tǒng)函數(shù)的零點(diǎn)、極點(diǎn)在s平面上的分布圖,同時(shí)繪制
% 出系統(tǒng)的沖擊響應(yīng)曲線。
% A:系統(tǒng)函數(shù)分母多項(xiàng)式系數(shù)向量,實(shí)驗(yàn)者從鍵盤上輸入
% B:系統(tǒng)函數(shù)分子多項(xiàng)式系數(shù)向量,實(shí)驗(yàn)者從鍵盤上輸入
% p:函數(shù)返回的系統(tǒng)函數(shù)極點(diǎn)位置行向量
% q:函數(shù)返回的系統(tǒng)函數(shù)零點(diǎn)位置行向量
%===========================================================
b=input('請輸入系統(tǒng)函數(shù)分子多項(xiàng)式系數(shù):');
a=input('請輸入系統(tǒng)函數(shù)分母多項(xiàng)式系數(shù):');
p=roots(a); %求系統(tǒng)極點(diǎn)
q=roots(b); %求系統(tǒng)零點(diǎn)
p=p'; %將極點(diǎn)列向量轉(zhuǎn)置為行向量
q=q'; %將零點(diǎn)列向量轉(zhuǎn)置為行向量
x=max(abs([p q])); %確定縱坐標(biāo)范圍
x=x+1;
y=x; %確定橫坐標(biāo)范圍
clf
subplot(2,1,1);
axis([-x x -y y]); %確定坐標(biāo)軸顯示范圍
axis('square')
%===========================================================
plot([-x x],[0 0]);hold on; %畫橫坐標(biāo)軸
plot([0 0],[-y y]);hold on; %畫縱坐標(biāo)軸
plot(real(p),imag(p),'x');hold on; %畫極點(diǎn)
plot(real(q),imag(q),'o');hold on; %畫零點(diǎn)
grid on;
title('The zero-pole diagram');
ylabel('jw');
xlabel('real');
%===========================================================
% 繪制沖激響應(yīng)曲線
%===========================================================
subplot(2,1,2);
impulse(b,a);
xlabel('time t');
ylabel('The magnitude');
title('The impulse response curve')
grid on;
%============================================================
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -