error using ode45 in gui
1 回表示 (過去 30 日間)
古いコメントを表示
while debugging code for flat-fire using ode45 it gives error
err0r:-
??? Error while evaluating uicontrol Callback
??? Error using ==> feval
Undefined function or method 'fnflatfiredragwind' for input
arguments of type 'double'.
Error in ==> guitry>togglebutton1_Callback at 187
[t,c,te,ze,ie] =
ode45('fnflatfiredragwind',tspan,c0,options,w1,w2,w3,k);
??? Error while evaluating uicontrol Callback
*
here is the function defined in toggle button
function togglebutton1_Callback(hObject, eventdata, handles)
v0 = str2num(get(handles.edit1,'string'));
theta = str2num(get(handles.edit2,'string'));
theta = theta*pi/180;
w1 = str2num(get(handles.edit3,'string'));
w2 = str2num(get(handles.edit4,'string'));
w3 = str2num(get(handles.edit5,'string'));
k = str2num(get(handles.edit6,'string'));
set(handles.text1,'string',result);
c0 = [0;v0*cos(theta);0;v0*sin(theta);0;0];
options = odeset('events','on');
tspan = [0 10];
[t,c,te,ze,ie] = ode45('fnflatfiredragwind',tspan,c0,options,w1,w2,w3,k);
what is this error ????????????????
please help me for this
thanks
pawan kumar
1 件のコメント
Jan
2011 年 9 月 28 日
Please use proper code formatting to improve the readability. Follow the "Markup help" link to learn the details.
回答 (4 件)
Grzegorz Knor
2011 年 9 月 28 日
Replace line:
[t,c,te,ze,ie] = ode45('fnflatfiredragwind',tspan,c0,options,w1,w2,w3,k);
with:
[t,c,te,ze,ie] = ode45(@fnflatfiredragwind,tspan,c0,options,w1,w2,w3,k);
5 件のコメント
Grzegorz Knor
2011 年 9 月 29 日
You don't pass the k argument to the function. Please correct this line:
function [value,isterminal,dircn] = fnflatfiredragwind(t,c,flag,w1,w2,w3,k)
Jan
2011 年 9 月 28 日
The error means, that the file "fnflatfiredragwind.m" cannot be found in the Matlab path and the current directory (see cd). Where is it? Is it a local subfunction? Then Grzegorz's idea of using a function handle might help.
0 件のコメント
Walter Roberson
2011 年 9 月 29 日
Convert
[t,c,te,ze,ie] =
ode45(@fnflatfiredragwind,tspan,c0,options,w1,w2,w3,k);
to
[t,c,te,ze,ie] =
ode45(@(t) fnflatfiredragwind(t,w1,w2,w3,k),tspan,c0,options);
convert
function [value,isterminal,dircn] = fnflatfiredragwind(t,c,flag,w1,w2,w3)
to
function [value,isterminal,dircn] = fnflatfiredragwind(t,c,flag,w1,w2,w3,k)
2 件のコメント
Walter Roberson
2011 年 10 月 4 日
Correction:
[t,c,te,ze,ie] =
ode45(@(t) fnflatfiredragwind(t,w1,w2,w3,k),tspan,c0,options);
should be
[t,c,te,ze,ie] =
ode45(@(t,c) fnflatfiredragwind(t,c,[],w1,w2,w3,k),tspan,c0,options);
pawan kumar
2011 年 10 月 10 日
2 件のコメント
Walter Roberson
2011 年 10 月 10 日
Any program that has "clear all" in it is 99%+ likely to be broken.
Walter Roberson
2011 年 10 月 10 日
Please point me to a reference page or user guide page that shows passing additional variables by placing them after the "options" structure in an ode*() call. I have been unable to find such a page myself; all I have been able to find so far is pages that say specifically that YOU CANNOT DO THAT.
参考
カテゴリ
Help Center および File Exchange で Environment and Settings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!