2D ODE with constant? how to solve
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Réponse acceptée
Sulaymon Eshkabilov
le 4 Août 2021
Most parts of your code is ok, but within the loop, you have overlooked sth and thus, you final solutions are not quite accurate. Here is ODE45 simulation which can be compared with your simulation results.
ICs=[0.6;0.6];
a=0.10;
b=10;
t=[0,60];
F = @(t, z)([a-z(1)+z(1).^2*z(2);b-z(1).^2*z(2)]);
OPTs = odeset('reltol', 1e-6, 'abstol', 1e-9);
[time, z]=ode45(F, t, ICs, OPTs);
figure(2)
plot(time,z(:,1),'b',time,z(:,2),'r')
xlabel('time')
ylabel('x(t) y(t)')
legend('x(t)', 'y(t)', 'location', 'best')
title('Schnackenberg eqn simulation'), xlim([0, 5])
figure(1)
plot(z(:,1),z(:,2),'k')
title('Simulation using ODE45'), grid on
xlabel('x(t)')
ylabel('y(t)')
0 commentaires
Plus de réponses (1)
Sulaymon Eshkabilov
le 4 Août 2021
Use odex (ode23, ode45, ode113, etc.) solvers. See this doc how to employ them in your exercise: https://www.mathworks.com/help/matlab/ref/ode45.html?searchHighlight=ode45&s_tid=srchtitle
Voir également
Catégories
En savoir plus sur Ordinary Differential Equations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


