How can I fix this program with ODE45?
이전 댓글 표시
Code:
clc, close all;
hours = 3600;
days = 24*hours;
deg = pi/180;
mu = 398600;
RE = 6378;
wE = [ 0 0 7.2921159e-5]';
CD = 2.2;
m = 100;
A = pi/4*(1^2);
rp = RE + 215;
ra = RE + 939;
RA = 339.94*deg;
i = 65.1*deg;
w = 58*deg;
TA = 332*deg;
e = (ra-rp)/(ra+rp);
a = (rp + ra)/2;
h = sqrt(mu*a*(1-e^2));
T = 2*pi/sqrt(mu)*a^1.5;
coe0 = [h e RA i w TA];
[R0, V0] = sv_from_coe(coe0, mu);
r0 = norm(R0);
v0 = norm(V0);
t0 = 0;
tf = 120*days;
y0 = [R0 V0]';
nout = 40000;
tspan = linspace(t0, tf, nout);
% Set error tolerances, initial step size, and termination event:
options = odeset(’reltol’, 1.e-8, ...
’abstol’, 1.e-8, ...
’initialstep’, T/10000, ...
’events’, @terminate);
global alt %Altitude
[t,y] = ode45(@rates, tspan, y0,options); %t is the solution times
Result:

Please, help me to answer my last project with this method. I'm still confusing about this problem. Anything idea?
답변 (1개)
Ameer Hamza
2020년 10월 26일
편집: Ameer Hamza
2020년 10월 26일
You are using the wrong character (’) in your code. MATLAB does not recognize it to create strings. Use the apostrophe symbol (') instead. For example, copy and paste the lines in your code and delete the older lines
options = odeset('reltol', 1.e-8, ...
'abstol', 1.e-8, ...
'initialstep', T/10000, ...
'events', @terminate);
카테고리
도움말 센터 및 File Exchange에서 Programming에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!