error using ode45 in gui
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentario
Jan
el 28 de Sept. de 2011
Please use proper code formatting to improve the readability. Follow the "Markup help" link to learn the details.
Respuestas (4)
Grzegorz Knor
el 28 de Sept. de 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 comentarios
Grzegorz Knor
el 29 de Sept. de 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
el 28 de Sept. de 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 comentarios
Walter Roberson
el 29 de Sept. de 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 comentarios
Walter Roberson
el 4 de Oct. de 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
el 10 de Oct. de 2011
2 comentarios
Walter Roberson
el 10 de Oct. de 2011
Any program that has "clear all" in it is 99%+ likely to be broken.
Walter Roberson
el 10 de Oct. de 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.
Ver también
Categorías
Más información sobre Environment and Settings en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!