What to do in the case of a matrix 2x2 .......tf2ss
22 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Fourier Analysis and Filtering 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!