How to convert a fourth-order ordinary differential equation into a system of first-order ordinary differential equations in order to solve it.

60 visualizaciones (últimos 30 días)
Hello everyone,
I am currently trying to define and convert a fourth-order ordinary differential equation into a system of first-order ordinary differential equations in order to solve it using the Runge-Kutta method.
The fourth-order ordinary differential equation I am trying to solve is as follows.
y is a function of x, and a, b, c, and d are constants.
To convert it into a system of first-order ordinary differential equations, I differentiated the left-hand side and rearranged the equation in terms of y′′′′.
However, I am not obtaining the desired solution at this point.
Could you please guide me on the correct way to define the function?
Thank you for your assistance.
  3 comentarios
James Tursa
James Tursa el 7 de Dic. de 2024 a las 1:26
What is it about your current solution that you don't like? Can you show us your code?
啓輝
啓輝 el 9 de Dic. de 2024 a las 0:59
Thank you all for your comments. I apologize for the delayed response.
The initial conditions are as follows. We assume y'(0) here and envision a problem where we search for the optimal value.
y(0) = 2e-9
y'(0) = 1e-11
y''(0) = 0
y'''(0) = 3.5e5
The code is as follows.
function dydx = f(x, y, A_Ham, sigma, a, b, c, d)
y1 = y(1);
y2 = y(2);
y3 = y(3);
y4 = y(4);
% term1
term1 = a * (y3 * y1 - y2 * y2) / y1^2;
% term2
term2 = -b * ( ...
(3 * y1^2 * y2 * y4 / (1 + y2^2)^1.5) ...
- (3 * y1^3 * y2 * y3 * y4 / (1 + y2^2)^2.5)...
);
% term3
term3 = c * ( ...
((3 * y1^2 * y2^2 * y3^2 + y1^3 * y3^3 + 2 * y1^3 * y2 * y3 * y4) / (1 + y2^2)^2.5) ...
- (5 * y1^3 * y2^2 * y3^3 / (1 + y2^2)^3.5)...
);
% term4
term4 = d * sqrt(1 + y2^2);
% term5
term5 = -b * (sigma * delta^3) / (1 + delta_prime^2)^1.5;
y4 = (term4 - (term1 + term2 + term3)) / term5;
dydx = [y1;
y2;
y3;
y4];
end

Iniciar sesión para comentar.

Respuesta aceptada

Torsten
Torsten el 9 de Dic. de 2024 a las 1:28
Editada: Torsten el 9 de Dic. de 2024 a las 1:28
If all conditions are given at x = 0, it's an easy problem:
Define
z(x) = integral_{x'=0}^{x'=x} d*sqrt(1+y'(x')^2) dx'
The system of differential equations to be solved is then given by
z' = d*sqrt(1+y'^2), z(0) = 0 (1)
(a*y'/y - b*y^3*y'''/(1+y'^2) + c*y^3*y'*y''^2/(1+y'^2)^2.5) - (a*y'(0)/y(0) - b*y(0)^3*y(0)'''/(1+y'(0)^2) + c*y(0)^3*y'(0)*y''(0)^2/(1+y'(0)^2)^2.5) = z (2)
Now solve (2) for y''' and convert it to a system of three first-order equations for y,y' and y''.
Then use a MATLAB ode-integrator to solve (1) and (2) as a system of four first-order equations for z, y, y' and y''.

Más respuestas (0)

Categorías

Más información sobre Ordinary Differential Equations en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by