Why do I get different solutions for these two systems of differential equations? Which solver is recommended?
Show older comments
%First Function
function dF=Bisymmfuenf(t,F,mu)
kappa=100; alpha=3.5; k=0.44; phi=1.5; gamma=0.2; s=0.005; c=0.01; dF=zeros(5,1);
gcw=1-s*(F(1)^2+F(2)^2)-c*(F(3)^2+F(4)^2);
gccw=1-s*(F(3)^2+F(4)^2)-c*(F(1)^2+F(2)^2);
dF(1)=kappa*(F(1)-alpha*F(2))*(gcw*F(5)-1)-k*(F(3)*cos(phi)-F(4)*sin(phi));
dF(2)=kappa*(F(2)+alpha*F(1))*(gcw*F(5)-1)-k*(F(4)*cos(phi)+F(3)*sin(phi));
dF(3)=kappa*(F(3)-alpha*F(4))*(gccw*F(5)-1)-k*(F(1)*cos(phi)-F(2)*sin(phi));
dF(4)=kappa*(F(4)+alpha*F(3))*(gccw*F(5)-1)-k*(F(2)*cos(phi)+F(1)*sin(phi));
dF(5)=gamma*(mu-F(5)-gcw*F(5)*(F(1)^2+F(2)^2)-gccw*F(5)*(F(3)^2+F(4)^2));
%Second Funktion
function dF=Bimatfuenf (t,F,mu)
alpha=3.5; kappa=100; s=0.005; c=0.01; gamma=0.2; k=0.44; phi=1.5; dF=zeros(5,1);
dF(1)=kappa*((1-s*(F(1)^2+F(2)^2)-c*(F(3)^2+F(4)^2))*F(5)-1)*(F(1)-alpha*F(2))-k*(cos(phi)*F(3)-sin(phi)*F(4)); dF(2)=kappa*((1-s*(F(1)^2+F(2)^2)-c*(F(3)^2+F(4)^2))*F(5)-1)*(alpha*F(1)+F(2))-k*(cos(phi)*F(4)+sin(phi)*F(3)); dF(3)=kappa*((1-s*(F(3)^2+F(4)^2)-c*(F(1)^2+F(2)^2))*F(5)-1)*(F(3)-alpha*F(4))-k*(cos(phi)*F(1)-sin(phi)*F(2)); dF(4)=kappa*((1-s*(F(3)^2+F(4)^2)-c*(F(1)^2+F(2)^2))*F(5)-1)*(alpha*F(3)+F(4))-k*(cos(phi)*F(2)+sin(phi)*F(1)); dF(5)=gamma*(mu-F(5)-(1-s*(F(1)^2+F(2)^2)-c*(F(3)^2+F(4)^2))*F(5)*(F(1)^2+F(2)^2)-(1-s*(F(3)^2+F(4)^2)-c*(F(1)^2+F(2)^2))*F(5)*(F(3)^2+F(4)^2));
%I call them like this
tspan=0:0.001:1000; E0fuenf=[0.001 0 0.002 0 0]; mu=1; [t,Bisymmfuenf10ode15s]=ode15s(@Bisymmfuenf,tspan,E0fuenf,[],mu); [t,Bimatfuenf10ode15s]=ode15s(@Bimatfuenf,tspan,E0fuenf,[],mu); %or with ode45
[t,Bisymmfuenf10ode45]=ode45(@Bisymmfuenf,tspan,E0fuenf,[],mu); [t,Bimatfuenf10ode45]=ode45(@Bimatfuenf,tspan,E0fuenf,[],mu);
1 Comment
Torsten
on 30 Nov 2015
Before calling the solvers, try
options = odeset('RelTol',1e-8,'AbsTol',1e-8);
Best wishes
Torsten.
Answers (0)
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!