필터 지우기
필터 지우기

ode-solver vs gui

조회 수: 2 (최근 30일)
pawan kumar
pawan kumar 2011년 10월 4일
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
Walter Roberson
Walter Roberson 2011년 10월 4일
Duplicate is at http://www.mathworks.com/matlabcentral/answers/16928-error-using-ode45-in-gui

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2011년 10월 4일
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.

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by