Solving nonlinear implicit differential equation of the form F(t,y(t),y'(t),y''(t), y'''(t), ...)=0 in MATLAB using ode15i
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Saeid
el 8 de Jun. de 2020
Editada: Ameer Hamza
el 13 de Jun. de 2020
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?
1 comentario
Respuesta aceptada
Ameer Hamza
el 13 de Jun. de 2020
Editada: Ameer Hamza
el 13 de Jun. de 2020
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 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Symbolic Math Toolbox en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!