Filter löschen
Filter löschen

ode-solver vs gui

2 Ansichten (letzte 30 Tage)
pawan kumar
pawan kumar am 4 Okt. 2011
is it possibleto make gui of programme in which odesolver is used
i have made the programme for flatfire trajectory using ode solver (ode45), with event location .if i run it dirrectly from its solver it execute efficiently .
but when i try to execute this programme using a toggle button or push button it gives error
here is the function programme
function [value,isterminal,dircn] = fnflatfiredragwind(t,c,flag,w1,w2,w3,k)
g = 9.8;
% c(1) = x; c(2) = dx/dt = vx ; c(3) = y ; c(4) = dy/dt = vy ; c(5) = w
% c(6) = dc/dt = vz
if nargin<7 || isempty(flag)
value = [c(2); -k*(c(2)-w1)^2; c(4); (-k*(c(2)-w1)*(c(4)-w2))-g; c(6); -k*(c(2)-w1)*(c(6)-w3)];
else
switch flag case 'events'
value = c(3);
isterminal = 1;
dircn = 0;
otherwise
error('function not programmed for this event');
end
end
and here is the solver programme
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'));
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);
please clarify my problem. i had asked problem regarding this before but answer is not satisfactory
  1 Kommentar
Walter Roberson
Walter Roberson am 4 Okt. 2011
Duplicate is at http://www.mathworks.com/matlabcentral/answers/16928-error-using-ode45-in-gui

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Walter Roberson
Walter Roberson am 4 Okt. 2011
Please do not create duplicate posts for the same question. Your error in this question is the same as your error the previous time you asked it.

Community Treasure Hunt

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

Start Hunting!

Translated by