Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: passing the parameters to the ode15s
Replies: 4   Last Post: Apr 2, 2014 8:30 PM

 Messages: [ Previous | Next ]
 Torsten Posts: 1,717 Registered: 11/8/10
Re: passing the parameters to the ode15s
Posted: Mar 26, 2014 8:48 AM

"sorada " <soradak@sut.ac.th> wrote in message <lgug18\$5p7\$1@newscl01ah.mathworks.com>...
> Hi all
> I have a problem in passing the parameter in function handling of ODE15s.
>
> my differential equation in the function handle are
> function dTdy = ff(y,T)
> dTg = (A1*(T(1)-T(2))/(B1)) ...
> +(A2*(T(1)-Tamb)/(B1));
> dTp=A1*(T(1)-T(2))/(B2)+((hfg+Cv*(T(1)-T(2)))/(B3))*A3;
> end
>
> A1, A2, A3, B1,B2 and B3 = f(T(1),T(2),M,W)
> where M,W are not constant.
> I have equation to calculate all parameter. But I don't know how to passing the M and W in to the function handling.
>
> MM = eye(4,4);
> y0 = [Tamb;Tpfold(1)];
> yspan = [0:DelY:2.125];
> options = odeset('Mass',MM,'RelTol',1e-1,'AbsTol',[1e-1 1e-1 1e-3 1e-3],...
> 'Vectorized','off');
> [y,T] = ode15s(@ff,yspan,y0,options)
>
> Do anyone has any suggestion for me?
> What I should do?
> Thank you in advance
> Ann

http://www.mathworks.de/de/help/optim/ug/passing-extra-parameters.html
Using anonymous functions to pass parameters also works with ODE15S instead of fminunc.

Best wishes
Torsten.

Date Subject Author
3/26/14 Torsten
3/26/14 Steven Lord