Editing ode functions to pass variables
7 views (last 30 days)
Show older comments
Hi,
I am trying to edit an ode function (saving my own version separately).
The reason I am doing this is to pass some variables through the function using the assignin/evalin commands. (I am transporting to a called function not the base, from the function called by the ode function).
Anyway the problem I am having is in line 151 of ode15s
The error I get is that odearguments does not accept an input of type 'function_handle', however I have not touched this line, and the only perceptible change at this point (i removed the others) is the change in the function name (i.e. ode15s becomes myode15s), and the save location.
Trying to 'edit odearguments' to find the problem and address it appears not to work.
I wish to be clear that my code works, but this problem has cropped up in parameterising it so I can feed the program through multiple cores and run it in parallel for different values. I was previously using the assignin and evalin commands with 'base'. The plan here is to insert them in to the ode script with 'caller' to effectively nest two levels of passing it through the called functions.
The only successful alternatives I can see around this are:
- use a file to write the variables I am pulling out to, and then reading them in the desired workspace. - use anonymous functions (something I have read about but am unfamiliar with) - call the function separately from the the ode in order to ascertain the values
These options seem like they would be computationally much slower, and as I need to run this code many times every speed advantage will be great in the long run.
Thanks, James.
0 Comments
Answers (0)
See Also
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!