Solve symbolic equation in order to get parameters of an equation

3 次查看(过去 30 天)
Greetings.
I have a system of the form :
I have written the equations individually in order to get them inside matlab as such:
syms phi real
syms p real
syms R real
syms K real
syms L real
syms J real
syms V real
syms b real
syms s [2 2]
phi_dot=-R/L*phi-K/J*p+V
p_dot=K/L*phi-b/J*p
Now, I'd like to get the matrix [-R -K; K -b] from an eqn. My idea was to use this:
eqn = [phi_dot; p_dot]==s*[phi;p]+[1;0]*V
solve(eqn,s)
But it only solves the first row. All parameter s should be in terms of the other parameters and not in terms of phi or p. Does anybody has experience with something like this?

回答(1 个)

Torsten
Torsten 2023-7-28
编辑:Torsten 2023-7-28
syms phi(t) p(t)
syms R L K J V b phi0 p0 real
eqn1 = diff(phi,t) == -R/L * phi - K/J * p + V;
eqn2 = diff(p,t) == K/L * phi -b/J * p;
eqns = [eqn1,eqn2];
conds = [phi(0) == phi0, p(0) == p0];
sol = dsolve(eqns,conds)
sol = struct with fields:
p: exp(-(t*(L*b + (J^2*R^2 - 4*J*K^2*L - 2*J*L*R*b + L^2*b^2)^(1/2) + J*R))/(2*J*L))*((K^2*p0*(J^2*R^2 - 4*J*K^2*L - 2*J*L*R*b + L^2*b^2)^(1/2) - 2*J*K^3*phi0 + R*b*p0*(J^2*R^2 - 4*J*K^2*L -… phi: - exp(-(t*(L*b - (J^2*R^2 - 4*J*K^2*L - 2*J*L*R*b + L^2*b^2)^(1/2) + J*R))/(2*J*L))*((K^2*p0*(J^2*R^2 - 4*J*K^2*L - 2*J*L*R*b + L^2*b^2)^(1/2) + 2*J*K^3*phi0 + R*b*p0*(J^2*R^2 - 4*J*K^2*L…
Now if you have data for phi, p, phi_dot and p_dot depending on t and you know L,J and V, you might be able to estimate the parameters R, K and b of the matrix.

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by