Second order to first order system
Show older comments
Hi, How this second order system can be converted to a first order system:?

not really sure how to get this solution?

any help will be appreciated. Thanks
3 Comments
William Rose
on 1 Oct 2022
@Cesar, this is intersting but is not a Matlab question. And it smells a lot like homework...
Check the left hand side of the first equation. I suspect there is a + sign missing that should be in there.
Star Strider
on 1 Oct 2022
There is an error in the first equation.
It should be:
The Symbolic Math Toolbox can get part way there using odeToVectorField, however it would require effort to get the ‘A’ matrix from the vector field (first output) result. The other vectors you would simply have to create.
Cesar
on 2 Oct 2022
Answers (1)
One approach (that involves doing an interim Laplace transform on the differential equation) —
omega = 2;
zeta = sqrt(3)/4;
sympref('AbbreviateOutput', false);
syms s t u(t) U X x(t) y(t)
eqn = diff(x, 2) + 2*zeta*omega*diff(x) + (omega^2)*x
inp = (omega^2)*u
[V, S] = odeToVectorField(eqn)
Leqn = laplace(eqn == inp,t,s)
Leqn = subs(Leqn, {laplace(x(t),t,s), x(0) subs(diff(x(t),t),0), laplace(u(t),t,s)}, {X, 0, 0, U})
X = solve(Leqn,X)
[n,d] = numden(X)
np = sym2poly(n/U)
dp = sym2poly(d)
systf = tf(np, dp)
sysss = ss(systf)
The input is defined as
(or
), and the Control System Toolbox normalises the numerator and denomminator. Setting the input to 1 instead of 4 and then substituting appropriately later may give you the essential duplicate of the state space system you described.
I will leave that for you to experiment with. This code does the ‘heavy lifting’ to get your differential equation into a state space realisation. Tweak it to get the result you want.
.
Categories
Find more on Signal Integrity Kits for Industry Standards 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!




