ODE45() & Importing Variables in to Functions Inside It
2 views (last 30 days)
Show older comments
I am using ode45 on my function; "derivs_func_5". It provides derivatives for ode45.
That function needs to have a value imported in to it "r" before ode45 hits it to provide those derivatives.
This is what the working code looks like:
[t,coords] = ode45(@derivs_func_5,[t_init t_fin],[x_init y_init v_x_init
v_y_init],ode_options);
This is what I am trying to do but matlab is not letting me do:
r=5;
[t,coords] = ode45(@derivs_func_5(r),[t_init t_fin],[x_init y_init v_x_init
v_y_init],ode_options);
Is there any way to set input variables for a function what appears inside ode45 function?
thanks
0 Comments
Accepted Answer
Walter Roberson
on 8 Dec 2012
[t,coords] = ode45(@(t,y) derivs_func_5(t,y,r), [t_init t_fin],[x_init y_init v_x_init v_y_init], ode_options);
More Answers (0)
See Also
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!