How can I express a set of nonlinear differential equations in the form 𝑥 ˙ = 𝐴 ( 𝑥 ) ⋅ 𝑥 + 𝐵 using MATLAB code ?

4 visualizzazioni (ultimi 30 giorni)
dXdt = @(X) [
2*(x(1) + 0.005)^2 + 3*(x(1) + 0.005)*(x(2) + 0.003);
2*(x(1) + 0.005) + 4*(x(2) + 0.003)^2;
(x(1) + 0.005)^3 + (x(2) + 0.003)*(x(3) + 0.05);
2*(x(3) + 0.005) + (x(4) + 0.025)^2;
(x(1) + 0.005)*(x(5) + 0.0236) + (x(2) + 0.003) + (x(4) + 0.0125)
];
Given a set of nonlinear differential equations for dxdt , how can I express the system in the form x_dot = A(X)*X+B using MATLAB code?
X=[x(1), x(2)....x(5)] is the states
  2 Commenti
Torsten
Torsten il 10 Feb 2025
Given a set of nonlinear differential equations for dxdt , how can I express the system in the form x_dot = A(X)*X+B using MATLAB code?
Why do you want to do that ? MATLAB can solve the original nonlinear system directly.
Sam Chak
Sam Chak il 10 Feb 2025
@Manish Kumar, If you are not referring to Jacobian linearization within the System Dynamics course, you must be implying Carleman linearization, which is typically not covered in undergraduate courses.

Accedi per commentare.

Risposte (1)

Divyam
Divyam il 28 Feb 2025
Assuming that you are referring to Jacobian linearization, for expressing a set of non-linear differential equations in the form , you can use the 'jacobian' function to find the linear part . Then you can identify any constant terms or terms that do not depend linearly on the state vector to form B.
syms x1 x2 x3 x4 x5 real
% Define the state vector
X = [x1; x2; x3; x4; x5];
% Define the nonlinear system
dXdt = [
2*(x1 + 0.005)^2 + 3*(x1 + 0.005)*(x2 + 0.003);
2*(x1 + 0.005) + 4*(x2 + 0.003)^2;
(x1 + 0.005)^3 + (x2 + 0.003)*(x3 + 0.05);
2*(x3 + 0.005) + (x4 + 0.025)^2;
(x1 + 0.005)*(x5 + 0.0236) + (x2 + 0.003) + (x4 + 0.0125)
];
% Compute the Jacobian matrix A(X)
A = jacobian(dXdt, X);
% Compute the constant term B by substituting X = 0
B = simplify(subs(dXdt, X, zeros(size(X))) - A * zeros(size(X)));
disp('A(X) = ');
A(X) =
disp(A);
disp('B = ');
B =
disp(B);
For more information regarding the 'jacobian' function, refer to the following documentation: https://www.mathworks.com/help/symbolic/sym.jacobian.html
  1 Commento
Sam Chak
Sam Chak il 28 Feb 2025
Hi @Divyam,
But if you make as the Jacobian matrix , then this product term is simply untrue according to the principle of linearization or approximation via Taylor series.
You can test performing the Jacobian on . Does approximate at every point where is differentiable?

Accedi per commentare.

Categorie

Scopri di più su Nonlinear Dynamics in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by