calling a c file to use ode45
조회 수: 3 (최근 30일)
이전 댓글 표시
I am trying to call a c file that hold a derivative function. I want to call it with ode45, or something similar.
댓글 수: 1
James Tursa
2024년 8월 2일
Have you ever written a mex function before? What does the derivative function C signature look like?
답변 (1개)
Steven Lord
2024년 7월 31일
You can pass a function handle to a MEX-file that you've created from a C or C++ file into ode45 as long as the signature of that MEX-file matches the signature ode45 requires its ODE function (the first input) to have. See the description of the odefun input argument on the ode45 documentation page.
"The function dydt = odefun(t,y), for a scalar t and a column vector y, must return a column vector dydt of data type single or double that corresponds to f(t,y). odefun must accept both input arguments t and y, even if one of the arguments is not used in the function."
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!