Friday, February 26, 2010

GNU Octaveで2次系のステップ応答

GNU Octave(MATLAB互換の数値解析ソフト)で2次系のステップ応答ステップ応答を求めてみる。

ステップ応答は、以下の関数を用いる。
[Y, T] = step (SYS, INP, TSTOP, N)
伝達関数は、以下の関数を用いる。
tf (NUM, DEN, TSAM, INNAME, OUTNAME)

①ζ=0.3, 1.0, 2.0 (ωn=1.0)のとき、

%2次系のステップ応答,ζ依存性
clf

%ωn=1.0,ζ=0.3,時間=20sec,データ数=1000のとき
[y,t]=step(tf([1.0^2],[1 2*0.3*1.0 1.0^2]), 1, 20, 1000);
plot(t,y,"1")
legend("zeta=0.3")
hold on;

%ωn=1.0,ζ=1.0,時間=20sec,データ数=1000のとき
[y,t]=step(tf([1.0^2],[1 2*1.0*1.0 1.0^2]), 1, 20, 1000);
plot(t,y,"2")
legend("zeta=1.0")
hold on;

%ωn=1.0,ζ=2.0,時間=20sec,データ数=1000のとき
[y,t]=step(tf([1.0^2],[1 2*2.0*1.0 1.0^2]), 1, 20, 1000);
plot(t,y,"3")
legend("zeta=2.0")
hold on;

%x軸=0~20,y軸=0~1.4
axis([0 20 0 1.4])
xlabel("time(sec)")
%ylabel("")
title("Step Responce (omega_n = 1.0)")
grid;

%pngファイルに保存
print -dpng step1.png



②ωn=0.5, 1.0, 2.0 (ζ=0.3)のとき、

%2次系のステップ応答,ωn依存性
clf

%ωn=0.5,ζ=0.3,時間=20sec,データ数=1000のとき
[y,t]=step(tf([0.5^2],[1 2*0.3*0.5 0.5^2]), 1, 20, 1000);
plot(t,y,"1")
legend("omega_n=0.5")
hold on;

%ωn=1.0,ζ=0.3,時間=20sec,データ数=1000のとき
[y,t]=step(tf([1.0^2],[1 2*0.3*1.0 1.0^2]), 1, 20, 1000);
plot(t,y,"2")
legend("omega_n=1.0")
hold on;

%ωn=2.0,ζ=0.3,時間=20sec,データ数=1000のとき
[y,t]=step(tf([2.0^2],[1 2*0.3*2.0 2.0^2]), 1, 20, 1000);
plot(t,y,"3")
legend("omega_n=2.0")
hold on;

%x軸=0~20,y軸=0~1.4
axis([0 20 0 1.4])
xlabel("time(sec)")
%ylabel("")
title("Step Responce (zeta = 0.3)")
grid;

%pngファイルに保存
print -dpng step2.png

Older Post Older Post