Info

此问题已关闭。 请重新打开它进行编辑或回答。

i have some problems of my ode45 code !!

1 次查看(过去 30 天)
kyu hong lee
kyu hong lee 2016-6-11
关闭: MATLAB Answer Bot 2021-8-20
(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..........

回答(1 个)

Star Strider
Star Strider 2016-6-11
When ode45 has problems, try ode15s. It may succeed where ode45 does not.

此问题已关闭。

标签

Community Treasure Hunt

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

Start Hunting!

Translated by