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

4 次查看(过去 30 天)
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 个评论
Torsten
Torsten 2025-2-10
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 2025-2-10
@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.

请先登录,再进行评论。

回答(1 个)

Divyam
Divyam 2025-2-28
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 个评论
Sam Chak
Sam Chak 2025-2-28
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?

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Nonlinear Dynamics 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by