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