Calling a function using ode45 in App Designer results in unrecognized function

2 ビュー (過去 30 日間)
Pat Gipper
Pat Gipper 2021 年 1 月 7 日
回答済み: Pat Gipper 2021 年 2 月 8 日
In a private method function in App Designer I am using an ode45 call that refers to another function defined within the same app and private method section. Code View underlines the function name saying "Use fra_int(app, ...) to call this function", this despite already including app as it is recommending. The code sample is shown below.
sol_id = ode45(@(ts,y) fra_int(app,ts,y,id,t), [min(t),max(t)], 0);
The function itself doesn't indicate any problems. The intent is to use ode45 to integrate the input "id" over the time span defined. Any suggestions? Thanks in advance!
function dydt = fra_int(~,ts,~,u,t)
% 1st derivative at time ts is linear interpolation over vectors t & u
dydt = interp1(t,u,ts);
end
  1 件のコメント
Pat Gipper
Pat Gipper 2021 年 1 月 7 日
Solved my own problem. I inserted function fra_int prior to the end statement of the function making the call. Once I had done this I no longer needed to include the "app" in in the ode45 call, and the first "~" is removed from the function definition.

サインインしてコメントする。

回答 (1 件)

Pat Gipper
Pat Gipper 2021 年 2 月 8 日
Note that I had answered my own question.

カテゴリ

Help Center および File ExchangeOrdinary Differential Equations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by