Effacer les filtres
Effacer les filtres

Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

i have some problems of my ode45 code !!

1 vue (au cours des 30 derniers jours)
kyu hong lee
kyu hong lee le 11 Juin 2016
Clôturé : MATLAB Answer Bot le 20 Août 2021
(sorry about my english skill)
first, this is rocket.m file
function dH=rocket(t,H)
global km mildo press temp;
m = 6100; % kg
a = 0.8; % m^2
ve = 2060.1; % m/s
thrust = 13000*9.81;
pe = thrust/a;
dmdt = -(thrust)/ve;
rho = 1;
pa = 1;
tem = 1;
%M = (331.5+(0.6*tem));
veeff = ve-a*(pe-pa)/dmdt; % ve.eff
%v = ;
cd = 1;
dH(1,1) = H(2);
dH(2,1) = cd*rho(1)*a*H(1)^2-dmdt*ve;
and this is rocket_test.m file
[t H] = ode45(@(t,H)rocket(t,H),[0 10],[0 0]);
H1=H(:,1);
H2=H(:,2);
plot(t,H1,t,H2)
legend('height','vel')
set(gca,'fontsize',20)
when i run rocket_test.m code, the error massage is
Warning: Failure at t=1.930812e-01. Unable to meet integration tolerances without
reducing the step size below the smallest value allowed (4.440892e-16) at time t.
> In ode45 (line 308)
In rocket_test (line 2)
and when i change &nbsp dH(2,1)=cd*rho(1)*a*H(1)^2-dmdt*ve; &nbsp to &nbsp dH(2,1)=cd*rho(1)*a*H(1)-dmdt*ve; at rocket.m file, it works.
so i think H(1) ^2 the square is the problem.
but when i test below code, it works.
function dH=rocket(t,H)
dH(1,1) = H(2);
dH(2,1) = H(1)^2;
i can't find what is the problems..........

Réponses (1)

Star Strider
Star Strider le 11 Juin 2016
When ode45 has problems, try ode15s. It may succeed where ode45 does not.
  1 commentaire
kyu hong lee
kyu hong lee le 11 Juin 2016
ode15s doesnt work too... T_T

Cette question est clôturée.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by