フィルターのクリア

Problem in ode15s, undefined function for input arguments of type double

2 ビュー (過去 30 日間)
John Delis
John Delis 2016 年 11 月 21 日
回答済み: Walter Roberson 2016 年 11 月 21 日
I am trying to use ode15s on a time-variant dynamic system. When i try to run my script i get the following error:
Error using feval
Undefined function 'leading_vehicle.m' for input arguments of type 'double'.
Error in odearguments (line 88)
f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ode15s (line 149)
[neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, odeFcn, ...
Error in simulation (line 3)
[t, q_i_1]=ode15s('leading_vehicle.m', tspan, leading_initial);
The function leading_vehicle.m is in the current directory of matlab, so thats definitely not the case of my problem. My code is the following:
function Dq = leading_vehicle( t, q )
Dq=[u(t)*cos(q(3)); u(t)*sin(q(3)); (1/a)*tan(g(t))*u(t)];
end
function fa=u(t)
fa=t;
end
function fb=g(t)
fb=0*t;
end
tspan=[0 20];
leading_initial=[3; 0; 0]; %initial conditions of leading vehicle
[t, q_i_1]=ode15s('leading_vehicle.m', tspan, leading_initial);
  1 件のコメント
David Goodmanson
David Goodmanson 2016 年 11 月 21 日
Hi John, aside from a possible misspelling error, looks like Matlab can't find the function either on the Matlab path or in the current directory. Have you tried, just before your ode15s call, "cd" and "dir *.m" ?

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

回答 (2 件)

James Tursa
James Tursa 2016 年 11 月 21 日
Try giving a function handle to oce15s instead of a character string file name. E.g.,
[t, q_i_1]=ode15s(@leading_vehicle, tspan, leading_initial);

Walter Roberson
Walter Roberson 2016 年 11 月 21 日
Do not include the .m in the string.
[t, q_i_1]=ode15s('leading_vehicle', tspan, leading_initial);

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by