What does this error message mean?
??? Error using ==> odearguments at 120
Inputs must be floats, namely single or double.
Error in ==> ode45 at 172
[neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, odeFcn, ...
Error in ==> Testfunction at 32
[t,x] = ode45(@somefn, tspan, x0);
Thanks in advance for any help!

 採用された回答

Jan
Jan 2012 年 3 月 28 日

1 投票

The message means, that the subfunction odearguments recieves non-float values, although it needs this type. The message is actually clear in this point.
Are tspan or x0 both floating point types? You can check this by:
class(tspan)
class(x0)

3 件のコメント

Richard
Richard 2012 年 3 月 28 日
Thank you, @Jan! I have found that class(x0) is 'sym' by your suggested method.
But I don't know why it is a symbol, what I did was:
a0 = input('a0:');
b0 = input('b0:');
c0 = f(a0,b0) %where f is some function defined earlier in the form f = @(a,b) ...
x0=[a0, b0, c0]
Jan
Jan 2012 年 3 月 28 日
What did you type in at the input prompts? Perhaps variables, which have been declared as SYMs before?
Richard
Richard 2012 年 3 月 28 日
I have written up this question here:
http://www.mathworks.co.uk/matlabcentral/answers/33756-symbols-vs-floating-points
But no, the inputs are numbers and I found that if I deleted c0, MATLAB is quite happy.
I don't understand what's wrong with c0 though. When I run it without c0, I get, for example
{x0 =
10 10}
class(x0)=double
whereas with c0, I get
{x0=
[10, 10, 20]}
,say, and
class(x0)=sym
So Matlab does get numbers, I don't know why the square brackets though and why the class.

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

その他の回答 (1 件)

shobhit kumar
shobhit kumar 2013 年 12 月 25 日

1 投票

i have the same problem but when i check class of x0 and tspan it is double than why i got the same error

カテゴリ

製品

質問済み:

2012 年 3 月 28 日

回答済み:

2013 年 12 月 25 日

Community Treasure Hunt

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

Start Hunting!

Translated by