ODE45() & Importing Variables in to Functions Inside It

3 visualizaciones (últimos 30 días)
sono
sono el 8 de Dic. de 2012
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

Respuesta aceptada

Walter Roberson
Walter Roberson el 8 de Dic. de 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);

Más respuestas (0)

Categorías

Más información sobre Ordinary Differential Equations en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by