Solving nonlinear implicit differential equation of the form F(t,y(t),y'(t),y''(t), y'''(t), ...)=0 in MATLAB using ode15i

조회 수: 6 (최근 30일)
Is it possible to solve implicit differential equations of the form F(t,y(t),y'(t),y''(t), ..., y(n))=0 in Matlab? The specific case that I handle is:
a*(y")^2+y' * [y'''+ b*y"+c*y'] +d*(y’)^2+k*y*y" = 0
ode15i documentation refers only to and mentions examples of the case where y' appears in the equations, but is there a way I could solve implicit equations with higher derivatives of y?

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 6월 13일
편집: Ameer Hamza 2020년 6월 13일
If you have symbolic toolbox. you can use odeToVectorField to convert the 3rd order-ODE to a system of 3 first-order ODE as long as there as no exponent over term. The following shows the solution to your ODE. Values of parameters are assumed randomly
syms y(t)
a = 1;
b = 0.3;
c = 0.5;
d = 0.9;
k = 2;
eq = a*diff(y,2)^2 + diff(y,1)*(diff(y,3) + b*diff(y,2) + c*diff(y,1)) + d*diff(y,1)^2 + k*y*diff(y,2) == 0;
eq = odeToVectorField(eq);
odefun = matlabFunction(eq, 'Vars', {'t', 'Y'});
tspan = [0 10];
ic = [1; 1; 0];
[t, y] = ode45(odefun, tspan, ic);
plot(t, y)
legend({'$y$', '$\dot{y}$', '$\ddot{y}$'}, ...
'FontSize', 18, ...
'Interpreter', 'latex', ...
'Location', 'best')
If you don't have the Symbolic toolbox, then you will need to manually convert the ODE into a system of first-order ODE. See this example: https://www.mathworks.com/help/matlab/ref/ode45.html#bu3uj8b

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by