Clear Filters
Clear Filters

How to calculate semiMajorAxis and trueAnomaly from TLE file

25 views (last 30 days)
Hi,
I am trying to add satelltie to satellite scenario by following the documentaion.
The general way is to simply use the TLE file
sat1 = satellite(sc,tleFile,"Name","Sat1")
If I want to find the Keplerian elements the function orbitalElements(sat1) can give eccentricity, inclination, rightAscensionOfAscendingNode and argumentOfPeriapsis. But how does MATLAB computes semiMajorAxis and trueAnomaly?
Any help is appreicated.
Thank you

Answers (2)

Sam Chak
Sam Chak on 25 Jul 2024
Edited: Sam Chak on 25 Jul 2024
Use the tleread() command.
Otherwise, you can also manually extract the info as detailed here:
After that, apply the equations that you learned in Orbital Mechanics to determine the Semi-major axis.
  1 Comment
Raghav Rathi
Raghav Rathi on 26 Jul 2024
Thanks for your reply, but tleread() is pretty much the same as orbitalElements() in terms of output.
When you create a satelliteScenario() using a TLE file, it also generates the orbit of the satellite.
For instance below is an example created using TLE file.
Since it can create the orbit of the satellite, I was wondering if there was a way to get the information about the semi major axis through a matlab function, as most of the information that is needed for the calculation is present.

Sign in to comment.


Garmit Pant
Garmit Pant on 12 Aug 2024
Hello Raghav,
I see that you require MATLAB functions to compute the 'semiMajorAxis' and 'trueAnomaly' of a satellite from its TLE file. This can be achieved by the following two methods:
  • Using the “orbitalElements” Function: The “orbitalElements” function calculates the ‘SemiMajorAxis’ and ‘TrueAnomaly’ of a satellite if the “OrbitalPropagator” property is set to ‘two-body-keplerian’. The following code snippet adds the satellite to the scenario using the “satellite” method to read the file and returns the orbital elements using the “orbitalElements” function:
sc = satelliteScenario;
tleFile = "eccentricOrbitSatellite.tle";
sat1 = satellite(sc,tleFile,OrbitPropagator="two-body-keplerian");
elements1 = orbitalElements(sat1)
elements1 = struct with fields:
SemiMajorAxis: 2.6609e+07 Eccentricity: 0.7401 Inclination: 60.0625 RightAscensionOfAscendingNode: 29.8255 ArgumentOfPeriapsis: 279.8444 TrueAnomaly: 210.1601 Period: 4.3196e+04
  • Using the “ijk2keplerian” Function: The “ijk2keplerian” function is used to calculate Keplerian orbit elements using position and velocity vectors. You can read the data from a TLE file using “tleread”, use it as an input to “propagateOrbit” to calculate the position and velocity of the satellite corresponding to an input time, and subsequently use the position and velocity data to calculate Keplerian orbit elements using “ijk2keplerian”. The following code snippet demonstrates this workflow:
tleStruct = tleread('leoSatelliteConstellation.tle');
[r,v] = propagateOrbit(datetime(2022, 1, 3, 12, 0, 0),tleStruct);
[SMA,ecc,incl,RAAN,argp,nu,truelon,arglat,lonper] = ijk2keplerian(r(:,:,1), v(:,:,1))
SMA = 7.2168e+06
ecc = 0.0020
incl = 55.1282
RAAN = 284.6862
argp = 50.6712
nu = 200.9497
truelon = NaN
arglat = NaN
lonper = NaN
For further understanding, kindly refer to the following MathWorks Documentation:
I hope you find the above explanation and suggestions useful!
  1 Comment
Raghav Rathi
Raghav Rathi on 15 Aug 2024
Thanks for your answer.
I tried the above method but the values seems to be off.
I generally use the below method to calculate the orbital elements.
% Contents of TLE_file.tle (I have attached it as .txt)
% 1 48133C 21027AT 24181.44840278 -.00013871 00000+0 -92894-3 0 1813
% 2 48133 53.0545 67.0105 0001358 83.1645 3.7056 15.06430375 12
startTime = datetime('29-Jun-2024 16:54:32');
stopTime = startTime + seconds(20);
sampleTime = 1;
sc = satelliteScenario(startTime,stopTime,sampleTime);
sat = satellite(sc, 'TLE_file.tle');
mu = 3.986004418*1e14;
n = 15.06430375;
semiMajorAxis = nthroot(mu,3)/(((2*n*pi)/86400)^(2/3)) ;
orbitalElements(sat)
OUTPUT:
MeanMotion: 0.0628
Eccentricity: 1.3580e-04
Inclination: 53.0545
RightAscensionOfAscendingNode: 67.0105
ArgumentOfPeriapsis: 83.1645
MeanAnomaly: 3.7056
Period: 5.7354e+03
Epoch: 29-Jun-2024 10:45:42
BStar: -9.2894e-04
semiMajorAxis: 6.9252e+06
Now, using the method you suggested,
tleStruct = tleread('/home/raghav/dbg/sig9.tle');
[r,v] = propagateOrbit(datetime('29-Jun-2024 16:54:32'),tleStruct);
[SMA,ecc,incl,RAAN,argp,nu,truelon,arglat,lonper] = ijk2keplerian(r(:,:,1), v(:,:,1))
OUTPUT:
SMA = 6.9273e+06
ecc = 0.001386
incl = 53.1830
RAAN = 65.6127
argp = 87.2706
nu = 309.2472
If I understasnd your previous explaination correctly, even though both the methods are initializing the satellite using TLE file, the 2nd method we are calculating keplerian elements from the i-j-k sysyem, hence they are different?

Sign in to comment.

Categories

Find more on CubeSat and Satellites in Help Center and File Exchange

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!