Second order to first order system
18 次查看(过去 30 天)
显示 更早的评论
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 个评论
Star Strider
2022-10-1
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.
回答(1 个)
Star Strider
2022-10-2
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.
.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!