Berikut ini ialah script MATLAB untuk mengubah dari state space menjadi transfer function.
clear all, close all, clc;
%% State space representation
A = [-11 -18;
1 0]
% the state matrix
B = [1; 0]
% the input vector
C = [0 1]
% the output vector
D = zeros(size(C,1),size(B,2))
% the feedforward
%% Verify the controllability and observability
Cm = ctrb(A,B)
% Controllability matrix
Om = obsv(A,C)
% Observability matrix
if rank(Cm) == size(A,1)
'It is controllable'
else
'It is not controllable'
end
if rank(Om) == size(A,1)
'It is observable'
else
'It is not observable'
end
%% Transform into transfer function
[num,den] = ss2tf(A,B,C,D)
sys = tf(num,den)
pole(sys)
% yields
% s = -9
% s = -2
step(sys)
% plot the step response
Berikut ini ialah step response dari sistem tersebut.%% State space representation
A = [-11 -18;
1 0]
% the state matrix
B = [1; 0]
% the input vector
C = [0 1]
% the output vector
D = zeros(size(C,1),size(B,2))
% the feedforward
%% Verify the controllability and observability
Cm = ctrb(A,B)
% Controllability matrix
Om = obsv(A,C)
% Observability matrix
if rank(Cm) == size(A,1)
'It is controllable'
else
'It is not controllable'
end
if rank(Om) == size(A,1)
'It is observable'
else
'It is not observable'
end
%% Transform into transfer function
[num,den] = ss2tf(A,B,C,D)
sys = tf(num,den)
pole(sys)
% yields
% s = -9
% s = -2
step(sys)
% plot the step response
Lihat juga tentang.
Kendali state space MATLAB.
Sumber http://lang8088.blogspot.com
EmoticonEmoticon