필터 지우기
필터 지우기

I have problem of ode45. please help me T_T

조회 수: 1 (최근 30일)
kyu hong lee
kyu hong lee 2016년 6월 11일
편집: Jan Orwat 2016년 6월 11일
(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..........
+ someone said try ode15s instead ode45, but ode15s didn't work neither

답변 (1개)

Jan Orwat
Jan Orwat 2016년 6월 11일
편집: Jan Orwat 2016년 6월 11일
1. It seems your function rocket.m represents system of equations
dH= H
dH= aH₁² + 127530
Verify, if it's what you are looking for.
2. Why do you declare global variables? Are those necessary? They aren't used once. MATLAB allows use of global variables, but it is not recommended. In this case
3. I cleaned up rocked.m from all unused or redundant variables. Here's what is left:
function dH=rocket(~,H)
a = 0.8; % m^2
thrust = 13000*9.81;
dH(1,1) = H(2);
dH(2,1) = a*H(1)^2+thrust;
Make sure if it's correct. If it calculates what it's supposed to do, then go to point 3.
4. Choose proper solver. Usually it is good to start with ode45. More about ODE solvers.

카테고리

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