Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: How do I pass a value to a function called by ode45?
Replies: 5   Last Post: Feb 7, 2013 10:42 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Jeff

Posts: 113
Registered: 11/22/09
Re: How do I pass a value to a function called by ode45?
Posted: Feb 7, 2013 10:42 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Steven_Lord" <slord@mathworks.com> wrote in message
>
> ODE45 requires the function that you pass into it as a function handle for
> the first input to accept two input arguments.
>
> Your function f requires three input arguments.
>
> If we have a function that accepted the two input arguments from ODE45 and
> passed them and another value into f, to serve as an adapter or go-between
> for ODE45 and the f function, they will both be satisfied. The anonymous
> function IS that adapter/go-between. The "@(t, y)" section of the anonymous
> function indicates that it accepts two inputs (and so is a valid first input
> for ODE45) and the "f(t, y, beta)" section calls f with three input
> arguments (as it requires.)
>
> --
> Steve Lord
> slord@mathworks.com
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com


Ahhh. In other words, the anonymous function "@(t,y)" is a function with one line. That line is "f(t,y,beta)".
Pretty neat.
Thanks for explanation.



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.