Closed form solution of a system of nonlinear differential equations
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
The following code graphs the solution to a a system of nonlinear differential equations. How can I find the closed form solution to the system that expresses y as a function of x?
function dydt = odeproject(t,y,A,B)
if nargin < 3 || isempty(A)
A = 1;
end
if nargin < 4 || isempty(B)
B = 2;
end
tspan = [0 0.5];
y0 = [2 7.524];
[t,y] = ode45(@(t,y) odefcn(t,y,A,B), tspan, y0);
plot(t,y(:,1),'-o',t,y(:,2),'-.')
end
function dydt = odefcn(t,y,A,B)
dydt = zeros(2,1);
dydt(1) = A(1);
dydt(2) = B(1);
dBdt = y(2) * sqrt((y(2)*y(2)+y(1)*y(1)));
dAdt = y(1) * sqrt((y(2)*y(2)+y(1)*y(1))) -9.81;
end
5 comentarios
Walter Roberson
el 5 de Feb. de 2020
You can do a change of variables to rewrite as
XP' = XP * sqrt(XP^2 +. YP^2)
YP' = YP * sqrt(XP^2 +. YP^2) - 9.81
and then run that as a system of two variables. If you need x and y you can do numeric integration such as cumtrapz. If you need a more accurate x and y you would use a system with four parameters.
Respuestas (0)
Ver también
Categorías
Más información sobre Systems of Nonlinear Equations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!