Using ode45 for solution curve
Mostrar comentarios más antiguos
Equations:
df/dt= 4f(t) - 3f(t)p(t)
dp/dt= -2p(t) + f(t)p(t)
Question: For the solution curve that starts at (1,1), how many units of time does it take before the curve returns to (1,1)? Try to get it within two decimal places. Repeat for the curve that starts at (0.5,0.5).
Here is the code that creates the solution curve:
gh = @(t,x) [4*x(1) - 3*x(1).*x(2); -2*x(2) + x(1).*x(2)];
tspan = linspace(0, 5, 250);
figure; hold on
for c = 0:0.1:5
[t,x] = ode45(gh, tspan, [c; c]);
plot(x(:,1), x(:,2))
end
axis tight
I was told there is a way to use ode45 to find how many units of time, but I am not sure how?
1 comentario
Bob
el 16 de Ag. de 2016
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Ordinary Differential Equations en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!