フィルターのクリア

What do to with ode45 symfun error?

2 ビュー (過去 30 日間)
I G
I G 2018 年 5 月 1 日
編集済み: Jan 2018 年 5 月 1 日
but every time when I want to execute it I got:
'Undefinied function 'exist' for input arguments of type 'symfun'.
Error in odearguments line 59, if (exist(ode)==2).
Error in ode45 line 113 [neq,tspan,ntsoan,next,t0,tfinal,tdir...]
I have not idea what to do? I checked, my matlab version has symbolic mathtoolbox.
  1 件のコメント
Jan
Jan 2018 年 5 月 1 日
I've removed the duplicate question.

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

回答 (1 件)

Jan
Jan 2018 年 5 月 1 日
The message means, that you provide a symbolic function, but ode45 handles numerical functions only. Please post your inputs and how you call this tool.
  2 件のコメント
I G
I G 2018 年 5 月 1 日
I use exactly same code from mentioned link in my question, please look there. I am not able to post nothing else now.
Jan
Jan 2018 年 5 月 1 日
編集済み: Jan 2018 年 5 月 1 日
The original code has a hilarious detail: It starts a function with "clc; close all; clear all;". This indicates securly, that the programmer does not know, what he or she is doing. Clearing all variables on top of a function, where no variables are existing, is a dumb cargo cult programming. After this first line of code, I would not trust the programmer anymore.
Nevertheless, the shown code does not include any symbolic calculations, but "function dUdy = odefun(y,U)" is clearly a numerical function.
Note that it is not clear, which code you actually run. But it is definitely not only the pieces of code shown on this page. Try it again. Insert all code in functions. I guess you have inserted the code in a script and omitted the clear all (which is something I usually like!). In scripts this might be useful: clear variables , but the better solution is to use functions.

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

カテゴリ

Help Center および File ExchangeNumeric Solvers についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by