Matlab twobody algorithm is not working precisely
조회 수: 2 (최근 30일)
이전 댓글 표시
I checked matlab twobody algorithm with accoring to the AGI STK with Howard Curtis and David Vallado books and Matlab propagateOrbit function . AGI STK Curtis and Vallado book are compatible with each other. Matlab function inject an error 1m for every day totally 60 m for 60 day propagation. This Bug effects also HPOP algorithm
mu = 398600.4415;
load('STKtwoBody.mat')
r0 = [-6786.08143734318400674965 -1210.16092926545320551668 12.95464131748462754956];% in km
v0 = [ -0.15900031559336824660 0.97232513551400689966 7.54021643425097654045];% in km
startTime=datetime(2020,1,1,6,0,0);
stopTime =datetime(2020,3,1,6,0,0);
timeStep=60;
time = startTime:seconds(timeStep):stopTime;
Nsample=length(time);
rSTK=rSTK(:,1:Nsample);
vSTK=vSTK(:,1:Nsample);
km2m=1e3;
[rMatlab,vMatlab]= propagateOrbit(time,r0'*km2m,v0'*km2m,PropModel="two-body-keplerian");
rMatlab=rMatlab/km2m;
rVallado = zeros(3, Nsample);
vVallado = zeros(3, Nsample);
rVallado(:,1)=r0;
vVallado(:,1)=v0;
rCurtis=rVallado;
vCurtis=vVallado;
for i=1:Nsample-1
[rVallado(:,i+1),vVallado(:,i+1)] = kepler(r0,v0,timeStep*i,mu);
[rCurtis(:,i+1),vCurtis(:,i+1)] = rv_from_r0v0(r0,v0,timeStep*i,mu);
end
r=rSTK;
figure('color',[1 1 1]);
plot(time,vecnorm(r-rCurtis)*km2m,'b','linewidth',2); hold on;
plot(time,vecnorm(r-rVallado)*km2m,'m','linewidth',2); hold on;
plot(time,vecnorm(r-rMatlab)*km2m,'k','linewidth',2); hold on;
xlabel('Time (day)'); ylabel('Position Magnitude Absolute Error (meters)');
legend('Curtis vs STK', 'Vallado vs STK', 'MATLAB vs STK', 'Location', 'best');
title('Comparison of Two-Body Propagators against STK');
grid on;
datetick('x','dd-mmm-yy','keeplimits');
댓글 수: 0
답변 (1개)
Torsten
2025년 7월 25일
이동: Torsten
2025년 7월 25일
If you think you found a bug, contact MATLAB Support (Product Usage):
Did you try the numerical method ?
numericalPropOpts = Aero.spacecraft.NumericalPropagatorOptions( ...
ODESet=odeset(RelTol=1e-8,AbsTol=1e-8));
[rMatlab,vMatlab]= propagateOrbit(time,r0'*km2m,v0'*km2m,PropModel="numerical",NumericalPropagatorOptions=numericalPropOpts)
참고 항목
카테고리
Help Center 및 File Exchange에서 Aerospace Applications에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
