How to get algebraic solution and symbolic Jacobian of this simple equation?

1 Ansicht (letzte 30 Tage)
I am trying to simplify this set of algebraic equations. Then, I would like to have Matlab calculate the Jacobian for me. But it does not seem to work as I expect.
Consider this simple MWE:
% State Variables
syms x_0 x_1 x_2 x_3
% Input Variables
syms u_1 u_2 u_3
% Constants
syms k_1 V_liq dvs
% 3 Algebraic Equations
stateEquations = [...
x_1 == (x_0*(V_liq - u_1/dvs*1e3)*1e-3 + u_1)*1e3/V_liq*exp(-k_1), ...
x_2 == (x_1*(V_liq - u_2/dvs*1e3)*1e-3 + u_2)*1e3/V_liq*exp(-k_1), ...
x_3 == (x_2*(V_liq - u_3/dvs*1e3)*1e-3 + u_3)*1e3/V_liq*exp(-k_1)];
dstate_x3 = solve(stateEquations, x_3)
dstate_du = jacobian(dstate_x3, [u_1 u_2 u_3])
SInce dstate_x3 is empty, the Jacobian is also empty. But I simply want Matlab to replace x_2 in eq. 3 by its right-hand side, and x_1 by its right-hand side...
Could you please give me a hint on how to achieve this with Symbolic Math Toolbox? (Deriving it manually would be very time-consuming, especially with x_i, i > 3)

Akzeptierte Antwort

Massimo Frittelli
Massimo Frittelli am 24 Feb. 2020
See my answer to your crossposted question on StackOverflow.

Weitere Antworten (0)

Produkte


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by