How to solve a system of second order nonlinear differential equations

조회 수: 91 (최근 30일)
Yichao Shi
Yichao Shi 2020년 11월 18일
이동: Dyuman Joshi 2024년 4월 4일 3:59
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
  댓글 수: 1
Lewis Fer
Lewis Fer 2021년 6월 10일
이동: Dyuman Joshi 2024년 4월 4일 3:59
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)

댓글을 달려면 로그인하십시오.

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 11월 18일
편집: Ameer Hamza 2020년 11월 18일
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');

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by