Solve symbolic equation in order to get parameters of an equation
2 views (last 30 days)
Show older comments
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 Comment
Sam Chak
on 28 Jul 2023
Hi @naga240
Do you want to get the state I from an initial value to a steady value at a specific time t?
Answers (1)
Torsten
on 28 Jul 2023
Edited: Torsten
on 28 Jul 2023
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)
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.
0 Comments
See Also
Categories
Find more on Symbolic Math Toolbox 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!