What to do in the case of a matrix 2x2 .......tf2ss

조회 수: 9 (최근 30일)
belal hariz belgacem
belal hariz belgacem 2019년 11월 2일
답변: Star Strider 2019년 11월 2일
Convert it to state-space form using tf2ss.
b = [0 2 3; 1 2 1];
a = [1 0.4 1];
[A,B,C,D] = tf2ss(b,a)
A = 2×2
-0.4000 -1.0000
1.0000 0
B = 2×1
1
0
C = 2×2
2.0000 3.0000
1.6000 0
D = 2×1
0
1

답변 (1개)

Star Strider
Star Strider 2019년 11월 2일
Note that the present problem uses the Control System Toolbox. The tf2ss function is in the Signal Processing Toolbox. To convert Control System Toolbox models from transfer functions to state space, use ss instead.
The correct procedure to do what you want is:
s = tf('s'); % Define Continuous Time
b = {[0 2 3]; [1 2 1]}; % Numerator Cell Array
a = [1 0.4 1]; % Denominator Vector (Cell Array If Different Denominators)
systf = tf(b,a) % Define Transfer Function
sysss = ss(systf) % Convert To State Space Representation
producing:
systf =
From input to output...
2 s + 3
1: ---------------
s^2 + 0.4 s + 1
s^2 + 2 s + 1
2: ---------------
s^2 + 0.4 s + 1
Continuous-time transfer function.
sysss =
A =
x1 x2
x1 -0.4 -1
x2 1 0
B =
u1
x1 2
x2 0
C =
x1 x2
y1 1 1.5
y2 0.8 0
D =
u1
y1 0
y2 1
Continuous-time state-space model.
Remember that to simulate it, the input signal ‘u’ must be the same column size as ‘B’, for example:
[u,t] = gensig('square',4,10,0.1);
u = u*ones(1,size(sysss.B,2)); % Create Appropriate Size for ‘u’
lsim(sysss,u,t)
This will automatically adjust to give the same vector to each input of a MIMO or MISO system. If you want different vectors to different inputs, they need to be individually created.
Experiment to get different results.

카테고리

Help CenterFile Exchange에서 Dynamic System Models에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by