error using ode45 in gui
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaire
Jan
le 28 Sep 2011
Please use proper code formatting to improve the readability. Follow the "Markup help" link to learn the details.
Réponses (4)
Grzegorz Knor
le 28 Sep 2011
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 commentaires
Grzegorz Knor
le 29 Sep 2011
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
le 28 Sep 2011
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 commentaires
Walter Roberson
le 29 Sep 2011
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 commentaires
Walter Roberson
le 4 Oct 2011
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
le 10 Oct 2011
2 commentaires
Walter Roberson
le 10 Oct 2011
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.
Voir également
Catégories
En savoir plus sur Environment and Settings dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!