i have some problems of my ode45 code !!
Info
This question is closed. Reopen it to edit or answer.
Show older comments
(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   dH(2,1)=cd*rho(1)*a*H(1)^2-dmdt*ve;   to   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..........
Answers (1)
Star Strider
on 11 Jun 2016
0 votes
When ode45 has problems, try ode15s. It may succeed where ode45 does not.
1 Comment
kyu hong lee
on 11 Jun 2016
This question is closed.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!