Second order to first order system

조회 수: 20 (최근 30일)
Cesar
Cesar 2022년 10월 1일
답변: Star Strider 2022년 10월 2일
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
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.
Cesar
Cesar 2022년 10월 2일
@Star Strider thanks for your reply. Maybe I was not clear enough. This is what I have:
omega = 2;
zeta = sqrt(3)/4;
sympref('AbbreviateOutput', false);
syms x(t) y(t) u
eqn = diff(x, 2) + 2*zeta*omega*diff(x) + (omega^2)*x == (omega^2)*u;
[V, S] = odeToVectorField(eqn)
A = [0 1; -4 -sqrt(3)];
B = [0; 4];
C = [1 0];
D = 0;
sys = ss(A, B, C, D)
However this solution is different to the one in this comment. I would like to get this solution. not sure how to do it...Any help will be appreciated. Thanks

댓글을 달려면 로그인하십시오.

답변 (1개)

Star Strider
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
eqn(t) = 
inp = (omega^2)*u
inp(t) = 
[V, S] = odeToVectorField(eqn)
V = 
S = 
Leqn = laplace(eqn == inp,t,s)
Leqn = 
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})
Leqn = 
X = solve(Leqn,X)
X = 
[n,d] = numden(X)
n = 
d = 
np = sym2poly(n/U)
np = 4
dp = sym2poly(d)
dp = 1×3
1.0000 1.7321 4.0000
systf = tf(np, dp)
systf = 4 ----------------- s^2 + 1.732 s + 4 Continuous-time transfer function.
sysss = ss(systf)
sysss = A = x1 x2 x1 -1.732 -2 x2 2 0 B = u1 x1 2 x2 0 C = x1 x2 y1 0 1 D = u1 y1 0 Continuous-time state-space model.
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.
.

카테고리

Help CenterFile Exchange에서 State-Space Control Design and Estimation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by