Reader Comments
Post a new comment on this article
Post Your Discussion Comment
Please follow our guidelines for comments and review our competing interests policy. Comments that do not conform to our guidelines will be promptly removed and the user account disabled. The following must be avoided:
- Remarks that could be interpreted as allegations of misconduct
- Unsupported assertions or statements
- Inflammatory or insulting language
Thank You!
Thank you for taking the time to flag this posting; we review flagged postings on a regular basis.
closeabout ODE solver tolerance options in the Matlab code file runSimulations.m
Posted by zhike_zi on 28 Sep 2011 at 12:05 GMT
For some stress scenarios, the users should pay attention to the setting of the ODE solver tolerance options in the code file runSimulations.m. For short pulse of stress stimulation (e.g. Ton <=1 min), the users need to decrease the tolerance options for the ode23s solver. We found there are some typos in the original Matlab code file "runSimulations.m".
Therefore, we suggest the following modification for the code in runSimulations.m file.
1. change line 44 from "options = odeset('RelTol',1e-16,'AbsTol', 1e-10);" to "options = odeset('RelTol',1e-6,'AbsTol', 1e-10);"
2. add options to the argument of the ode23s solver, namely
(a) change line 53 from "[t,y] = ode23s(@ODE4OsmoticChanges, time_course1, initials);" to "[t,y] = ode23s(@ODE4OsmoticChanges, time_course1, initials, options);"
(b) change line 70 from "[t,y] = ode23s(@ODE4OsmoticChanges, time_course2, initials);" to "[t,y] = ode23s(@ODE4OsmoticChanges, time_course2, initials, options);"
(c) change line 84 from "[t,y] = ode23s(@ODE4OsmoticChanges, time_course3, initials);" to "[t,y] = ode23s(@ODE4OsmoticChanges, time_course3, initials, options);"
(d) change line 98 from "[t,y] = ode23s(@ODE4OsmoticChanges, time_course4, initials, options);" to "[t,y] = ode23s(@ODE4OsmoticChanges, time_course4, initials, options);"
The changes do not affect the simulation results in the original code, but it is more suitable for simulations of other stress conditions. We suggest the users to adjust the options of the absolute and relative tolerance of the ODE solver if the simulation does not work.