From: Sunset Raisin on
Dear all,

I want to solve a set of stiff differential equations and some of the outputs must be in the range of lower/upper limits.

By Simulink (Version7.0), I can solve this problem by simply choosing the 'ode23tb' solver, checking the 'Limit output' box and filling in the upper/lower saturation limits of the integrator blocks corresponding to those limited outputs.

However, now I have to solve this problem by calling ODE23tb in Matlab. The syntax is:

[T,Y] = ode23tb(odefun,tspan,y0,options)

Here is my question: How to pass those output limits as parameters to ODE23tb solver?

Any hint would be greatly appreciated!
From: Steven Lord on

"Sunset Raisin" <elinor_xie(a)hotmail.com> wrote in message
news:hrood3$elk$1(a)fred.mathworks.com...
> Dear all,
>
> I want to solve a set of stiff differential equations and some of the
> outputs must be in the range of lower/upper limits.

What should happen if one or more of the outputs exceeds that range?

> By Simulink (Version7.0), I can solve this problem by simply choosing the
> 'ode23tb' solver, checking the 'Limit output' box and filling in the
> upper/lower saturation limits of the integrator blocks corresponding to
> those limited outputs.
>
> However, now I have to solve this problem by calling ODE23tb in Matlab.
> The syntax is:
>
> [T,Y] = ode23tb(odefun,tspan,y0,options)
>
> Here is my question: How to pass those output limits as parameters to
> ODE23tb solver?

My suggestion is not to do so. My suggestion is to use an events function
to detect when the outputs are no longer in your required range, then stop
the simulation, modify either the conditions or the ODEs to adjust, and
restart simulation from the point at which it stopped. See the BALLODE demo
for an example that does something like this.

Alternately, if you just need your problem solution to remain nonnegative,
and your problem does not involve a mass matrix, use the NonNegative option
to constrain one or more of the solution components to nonnegativity.

http://www.mathworks.com/access/helpdesk/help/techdoc/ref/odeset.html#f92-1016858

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ


 | 
Pages: 1
Prev: GUI using method
Next: Numerical Intgration