Converting differential equations to State-Space/Transfer Function representation
381 views (last 30 days)
Show older comments
I'm trying to solve some Control Systems questions, but having trouble with a few of them:
Basically, the question asks for the state-space representation of each system.
I used odeToVectorField for systems a and b:
syms y(t) u(t) t
yd = diff(y);
ydd = diff(y, 2);
yddd = diff(y, 3);
EQD = ydd + 3*yd + y == u
[SS, Sbs] = odeToVectorField(EQD)
EQD2 = yddd + 5*ydd + 8*yd + 12*y == u
[SS2, Sbs2] = odeToVectorField(EQD2)
from which I can get the state-space representation.
But when I get to the other systems (for example, system f), it gets trickier, and most of the systems can't even be solved using odeToVectorField.
syms y(t) u(t) t
yd = diff(y);
ydd = diff(y, 2);
yddd = diff(y, 3);
yi = int(y, 0, t);
ud = diff(u);
EQD = ydd + 2*yd + y + yi == ud + 5*u
[SS, Sbs] = odeToVectorField(EQD)
Is there an easier way to get the state-space representation (or transfer function) directly from the differential equations? And how can I do the same for the more complex differential equations (like f and g, for example)?
Thank you
0 Comments
Accepted Answer
Paul
on 23 Nov 2021
Edited: Paul
on 23 Nov 2021
There really is no need to use the symbolic stuff (though you can if you really want, at least for part of the problem). Suppose Z(s) is the Laplace transform of z(t). You just need know how to express the Laplace transform of dz(t)/dt and integral(z(t)) (using bad notation) in terms of Z(s). You will find these relationships in your class notes or text book or any number of on line sources. Once you know how to do that, you'll be able to solve each of those equations for the ratio Y(s)/U(s). At that point you can use ss() to find a (not "the") state space representation.
For example, suppose you found: Y(s)/U(s) = (2s + 1)/(s^2 + s + 2). You can find a state space model as
ss(tf([2 1],[1 1 2]))
But you'll have to find Y(s)/U(s) first.
Problem g is trickier. There you'll have to find the matrix M(s) such that [Y1(s);Y2(s)] = M(s)*[U1(s);U2(s), then express M as a tf object, and then use ss(M).
5 Comments
Paul
on 24 Nov 2021
Here you go
syms y(t) u(t) tau
eqn = diff(y(t),t,2)+2*diff(y(t),t) + y + int(y(tau),tau,0,t) == diff(u(t),t) + 5*u(t)
Leqn = laplace(eqn)
syms Dy0
Leqn = subs(Leqn,subs(diff(y(t), t), t, 0),Dy0)
Leqn = subs(Leqn,[y(0) Dy0 u(0)],[0 0 0])
syms Y U s
Leqn = subs(Leqn,[laplace(y(t),t,s) laplace(u(t),t,s)],[Y U])
Y = solve(Leqn,Y)
H(s) = Y/U
H = simplify(H)
More Answers (1)
Samim Unlusoy
on 22 Dec 2022
The following approach may be useful. State equations for the classical ordinary matrix differential equations
[M]{yddot} + [C]{ydot} + [K]{y} = [F]{q}
are given by:
[0] [I] [0]
{xdot} = [A]{x} + [B]{u] = {x} + {u}
-inv[M] [K] -inv[M] [C] inv[M] [C]
0 Comments
See Also
Categories
Find more on Equation Solving in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!