ODE45() & Importing Variables in to Functions Inside It

조회 수: 2 (최근 30일)
sono
sono 2012년 12월 8일
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

채택된 답변

Walter Roberson
Walter Roberson 2012년 12월 8일
[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);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by