Matlab ODEs: unable to meet integration tolerances ( using different types of commands for odes)

1 view (last 30 days)
My ODEs system is:
function dydt = SIR1ode(t,y)
[params,zeta,mu,IC]=example(2);
c1 = params(1); c2= params(2);c3= params(3); c4= params(4);
S1 = y(1); S2 = y(2); S3= y(3);
dS1 = -c1*S1-c2*S2^2+2*c3*S2;
dS2 = c2*S1^2 - (c3+c4)*S2;
dS3 = c4*S2;
dydt = [dS1;dS2;dS3];
I call this function from my main script:
tspan = [0,0.2];
% % deterministic model:
[T,Y] = ode23s(@SIR1ode,tspan,[400 798 0]);
Matlab output is:
Warning: Failure at t=3.818112e-04. Unable to meet integration tolerances without
reducing the step size below the smallest value allowed (1.356466e-18) at time t.
> In ode23s at 402
When I tried to plot the solution I find that the initial condition is not taken into account and all the curves start from 0 which is not in harmony with my initial condition [400 798 0].
How can solve this issue? I tried different commands of odes like ODE15S and ode45... but still have the same problem.

Answers (1)

Torsten
Torsten on 24 Jul 2015
If your solution curves all started from 0, MATLAB would not have problems integrating your system because all solution variables remained at 0 for all times (look at your derivatives).
So this cannot be true.
My guess is that your solution blows up such that MATLAB cannot integrate beyond 3.8e-4 s.
Best wishes
Torsten.

Categories

Find more on Programming in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!