Errors using propagateOrbit after function update

조회 수: 11 (최근 30일)
Nicholas
Nicholas 2025년 7월 15일
답변: Ayush 2025년 9월 3일
I was using the propagateOrbit function to generate time series of state vectors from an initial state vector, start time, and stop time. I have a datetime array from start to stop then make call:
propagateOrbit(datetimes, startState(1:3), startState(4:6), PropModel='sgp4');
This was working up until a few weeks ago. I'm using R2024b and I know that some changes were made to the function in R2025a, but I'm not sure if that would break things. This is the error I get:
Array indices must be positive integers or logical values.
Error in Aero.internal.spaceweather.validateFluxData
Error in Aero.internal.spaceweather.validateFluxData
Error in Aero.spacecraft.NumericalPropagatorOptions/localSetSpaceWeatherDataFile
Error in Aero.spacecraft.NumericalPropagatorOptions
Error in propagateOrbit
Error in generateTruthData (line 64)
propagateOrbit(datetimes, startState(1:3), startState(4:6), PropModel='sgp4');
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This tells me that it's trying to use the numerical propagator (which I don't specify options for), but I'm specifying SGP4 as the propagation model. Could it be an issue with the state vectors? Is anyone else running into a similar issue? Thanks!
  댓글 수: 1
Torsten
Torsten 2025년 7월 15일
편집: Torsten 2025년 7월 15일
Did you check "datetimes" and "startState" before the call to "propagateOrbit" ? Can you supply data for the inputs to reproduce the error ?

댓글을 달려면 로그인하십시오.

답변 (1개)

Ayush
Ayush 2025년 9월 3일
Hi Nicholas,
I understand that you are working with “Aerospace Toolbox” and facing error while using the “propagateOrbit” function to generate a time series of state vectors from an initial state vector and a datetime array, specifying the SGP4 propagation model.
From the below attached MATLAB documentation, the input syntax for “propagateOrbit” is as follows:
[positions,velocities] = propagateOrbit(time,rEpoch,vEpoch)
I have replicated your code in my system (MATLAB R2024b):
Since, the values of “datetimes”, “startState” is not mentioned in your query, I have used these values from MATLAB documentation example.
This is the code which is working fine for me and giving appropriate results for “r” (position) and “v” (velocity):
rEpoch = [5927630.386747557; ...
3087663.891097251; ...
1174446.969646237];
vEpoch = [-5190.330300215130; ...
8212.486957313564; ...
4605.538019512981];
[r, v] = propagateOrbit(datetime(2022, 1, 3, 12, 0, 0), rEpoch,vEpoch, 'PropModel', 'sgp4');
disp([r,v])
There are few other possible workarounds to avoid the error:
  1. Check your “startState” and “datetimes”: Ensure that “startState(1:3)” and “startState(4:6)” in your code are not parallel as mentioned in the attached documentation. And, it is preferred to have “datetimes” in UTC.
  2. Use Two Line element (TLE) structure:
To access one example on TLE, you can type the following in the command window:
openExample('aero/ReadDataFromTLEFileAndCalculatePositionAndVelocityExample')
Below is the code to use “propagateOrbit” using TLE file in above example:
tleStruct = tleread('leoSatelliteConstellation.tle')
[r,v] = propagateOrbit(datetime(2022, 1, 3, 12, 0, 0),tleStruct,"PropModel","sgp4");
Following documents will be helpful:
  1. Input syntax and state values: propagateOrbit
  2. About Two-line element structure: tleread
Hope this helps clarify your options.

카테고리

Help CenterFile Exchange에서 Satellite and Orbital Mechanics에 대해 자세히 알아보기

제품


릴리스

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by