Errors using propagateOrbit after function update
12 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaire
Réponses (1)
Ayush
le 3 Sep 2025
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:
- 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.
- 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:
- Input syntax and state values: propagateOrbit
- About Two-line element structure: tleread
Hope this helps clarify your options.
0 commentaires
Voir également
Catégories
En savoir plus sur Satellite and Orbital Mechanics dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!