help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Solving ODE system in Octave


From: timothy kinyanjui
Subject: Re: Solving ODE system in Octave
Date: Fri, 12 Jun 2009 14:46:32 -0700 (PDT)




From: Thomas Treichl <address@hidden>
To: timothy kinyanjui <address@hidden>
Cc: octave <address@hidden>
Sent: Friday, June 12, 2009 10:27:20 PM
Subject: Re: Solving ODE system in Octave

timothy kinyanjui schrieb:
>
>
> ------------------------------------------------------------------------
> *From:* Thomas Treichl <address@hidden>
> *To:* timothy kinyanjui <address@hidden>
> *Cc:* octave <address@hidden>
> *Sent:* Friday, June 12, 2009 9:01:10 PM
> *Subject:* Re: Solving ODE system in Octave
>
> timothy kinyanjui schrieb:
>  >
>  > ------------------------------------------------------------------------
>  > *From:* Thomas Treichl <address@hidden <mailto:address@hidden>>
>  > *To:* timothy kinyanjui <address@hidden <mailto:address@hidden>>
>  > *Cc:* octave <address@hidden <mailto:address@hidden>>
>  > *Sent:* Friday, June 12, 2009 11:20:06 AM
>  > *Subject:* Re: Solving ODE system in Octave
>  >
>  > timothy kinyanjui schrieb:
>  >  > Hi all?
>  >  >  I have set up a system of differential equations to solve an age structured model for disease transmission. I have it running okay in MATLAB. However, I want to move my models from MATLAB to Octave.
>  >  > On running the model in Octave, it generates the following errors:
>  >  >  > [time,Mv,M,S,I,R,Ir]=solve_rate1([0 30],3,beta,options);
>  >  > Number of arguments supplied correct.
>  >  >
>  >  > ***** Integration in progress. Please wait... *****
>  >  > --------------------------------
>  >  > error: Unknown parameter name "BDF" or no valid parameter value
>  >  > error: evaluating if command near line 278, column 9
>  >  > error: evaluating switch command near line 55, column 5
>  >  > error: evaluating for command near line 53, column 3
>  >  > error: called from `odepkg_structure_check' in file `C:\Program Files\Octave\3.0.5_gcc-4.3.0\share\octave\packages\odepkg-0.6.4\odepkg_structure_check.m'
>  >  > error: evaluating assignment _expression_ near line 82, column 19
>  >  > error: evaluating if command near line 75, column 5
>  >  > error: evaluating if command near line 53, column 3
>  >  > error: called from `ode45' in file `C:\Program Files\Octave\3.0.5_gcc-4.3.0\share\octave\packages\odepkg-0.6.4\ode45.m'
>  >  > error: evaluating if command near line 66, column 5
>  >  > error: evaluating while command near line 64, column 1
>  >  > error: called from `solve_rate1' in file `d:\model_data\work\two_age_structure_model\solve_rate1.m'
>  >  > octave-3.0.5.exe:15:d:\model_data\work\two_age_structure_model
>  >  >
>  >  > Is there a missing package that I may be required to install. I have used the ODE solver: ode45.
>  >  > Waiting to hear from you.
>  >  > regards,
>  >  > tim
>  >
>  > Can you please send and output of your 'options' structure (and if you can send even more information about your code so that we can help)
>  >
>  >  Thomas
>  > Here is the options function that I have supplied to the ode45 function.
>  >  options =
>  > {
>  >  AbsTol = 1.0000e-020
>  >  BDF = [](0x0)
>  >  Events = [](0x0)
>  >  InitialStep = 0.0010000
>  >  Jacobian = [](0x0)
>  >  JConstant = [](0x0)
>  >  JPattern = [](0x0)
>  >  Mass = [](0x0)
>  >  MassConstant = [](0x0)
>  >  MassSingular = [](0x0)
>  >  MaxOrder = [](0x0)
>  >  MaxStep = [](0x0)
>  >  NormControl = on
>  >  OutputFcn = [](0x0)
>  >  OutputSel = [](0x0)
>  >  Refine = [](0x0)
>  >  RelTol = 3.0000e-014
>  >  Stats = off
>  >  Vectorized = on
>  >  MStateDependence = [](0x0)
>  >  MvPattern = [](0x0)
>  >  InitialSlope = [](0x0)
>  >  Reltol = [](0x0)
>  > }
>  >
>  > regards,
>  > tim
>
> Ok, can you please set options.BDF="off" and try again?
> Best regards,
>  Thomas
> Thanks Thomas.
> I have changed BDF to off but it could still not run.
> I defined another new options structure in Octave using options=odeset( ); This created another default structure.
> On using the new optiins structure, the following error occured.
>  error: Solving has not been successful. The iterative integration loop exited at time t = 18.000000 before endpoint at tend = 18.000000 was reached. This may happen if the stepsize grows smaller than defined in vminstepsize. Try to reduce the value of "InitialStep" and/or "MaxStep" with the command "odeset".
> octave-3.0.5.exe:141:d:\model_data\work\two_age_structure_model
>  I therefore reduced the InitialStep and the MaxStep to the values shown in the options structure below but the same error was generated. I really do not know what is missing.
> options =
> {
>  RelTol = [](0x0)
>  AbsTol = [](0x0)
>  NormControl = off
>  NonNegative = [](0x0)
>  OutputFcn = [](0x0)
>  OutputSel = [](0x0)
>  OutputSave = [](0x0)
>  Refine = 0
>  Stats = off
>  InitialStep = 1.0000e-200
>  MaxStep = 1.0000e-200
>  Events = [](0x0)
>  Jacobian = [](0x0)
>  JPattern = [](0x0)
>  Vectorized = off
>  Mass = [](0x0)
>  MStateDependence = weak
>  MvPattern = [](0x0)
>  MassSingular = maybe
>  InitialSlope = [](0x0)
>  MaxOrder = [](0x0)
>  BDF = off
> }
> tim

So the first error has gone, which is good. There seems to be a bug in OdePkg which causes this BDF problem, I'll look into this some when soon.

The second error somehow is strange, this shouldn't happen. I see t=18 and t_end=18 and the break in the loop?! So this either is a problem of OdePkg 0.6.4 or the bug is still there. What about using ode23 and ode78 instead, does this solve your problem. Can you see something strange if you use set 'OutputFcn' to @odeplot?

  Thomas
 
Thanks Thomas.
I have tried using the alternative ODE solvers but the problem still exists.
Figure generated by @odeplot seems to be what I expect to see.
 
tim



reply via email to

[Prev in Thread] Current Thread [Next in Thread]