How do I pass known variables into my ODE45 function?

조회 수: 14 (최근 30일)
Bobby H
Bobby H 2016년 2월 6일
댓글: Bilal Tahseen 2020년 8월 30일
Hi,
I am attempting to pass a set of variables (a1,a2,a3,...an - these numbers can be integers,vectors and arrays) into an ODE function to avoid having to call these variables on each iteration of the ODE as the call function is quiet slow. I want to make it so that I call the variables (from excel files) before the ODE and use these variables as inputs to the ODE, therefore avoiding the need to call the function in the ODE function itself, but do not know how to do this.
Could anybody help with letting me know the syntax to read these variables into the ODE?
The set up of my ODE code is shown here:
at = 1e-5*ones(Neqn,1); % Absolute tolerance for ODE
tE = 0; % Start time for ODE
endtime = 50e3; % End time for ODE
span = [tE endtime]; % ODE time span
options = odeset('RelTol',1e-4,'AbsTol',at);
[t,y] = ode45(@Reactor_simple_ODE,span,init,options);

채택된 답변

Walter Roberson
Walter Roberson 2016년 2월 6일
  댓글 수: 5
Yokesh
Yokesh 2019년 6월 23일
It works, I appreciate it @Torsten
Bilal Tahseen
Bilal Tahseen 2020년 8월 30일
It works, Thanks @Torsten

댓글을 달려면 로그인하십시오.

추가 답변 (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