How to solve a system of second order nonlinear differential equations

66 visualizzazioni (ultimi 30 giorni)
Hello, I am having troubles solving a system of second order nonlinear equations in MATALB
Here is the equations:
1.01 * (x'') + 0.025 * (θ'') * cos(θ) - 0.025 * (θ')^2 * sin(θ) + 200 * x^3 + 20 * (x') = 0
(x'') * cos(θ) + 2.5 * (θ'') + 9.8 * sin(θ) = 0

Risposta accettata

Ameer Hamza
Ameer Hamza il 18 Nov 2020
Modificato: Ameer Hamza il 18 Nov 2020
If you have the symbolic toolbox, It will make things easier as shown in following code
syms x(t) theta(t)
d1x = diff(x,1);
d2x = diff(x,2);
d1theta = diff(theta,1);
d2theta = diff(theta,2);
eq1 = 1.01*d2x + 0.025*d2theta*cos(theta) - 0.025*d1theta^2*sin(theta) + 200*x^3 + 20*d1x == 0;
eq2 = d2x*cos(theta) + 2.5*d2theta + 9.8 * sin(theta) == 0;
[F, S] = odeToVectorField(eq1, eq2);
odeFun = matlabFunction(F, 'Vars', {t, 'Y'});
[t, y] = ode45(odeFun, [0 10], [1; 0; 0.1; 0]);
plot(t, y);
legend({'$\theta$', '$\dot{\theta}$', '$x$', '$\dot{x}$'}, ...
'FontSize', 16, ...
'Interpreter', 'latex', ...
'Location', 'best');

Più risposte (1)

Lewis Fer
Lewis Fer il 10 Giu 2021
Hello, I am having troubles solving a system of second order nonlinear equations with boundary conditions using MATALB
Here is the equations:
f''(t)=3*f(t)*g(t) -g(t)+5*t;
g''(t)=-4f(t)*g(t)+f(t)-7*t;
the boundary conditions are: f'(0)=0 et h'(o)=5;
g(0)=3 et h'(2)=h(2)

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by