How can i get orbital elements at the stop time of the simulation.

4 views (last 30 days)
Toshi on 4 Mar 2024
Answered: akshatsood on 22 Mar 2024
startTime = datetime(2024,3,1,22,07,37);
stopTime = startTime + days(3);
sampleTime = 60;
sc = satelliteScenario(startTime,stopTime,sampleTime);
tleFile = "o3b.tle" ;
sat1 = satellite(sc,tleFile);
sat1 = satellite(sc,tleFile, ...
"Name","sat1", ...
"OrbitPropagator","sgp4");
elements1 = orbitalElements(sat1);
[positionSGP4,velocitySGP4] = states(sat1);
display(elements1);
display(velocitySGP4);
display(positionSGP4);
satelliteScenarioViewer(sc);

akshatsood on 22 Mar 2024
I see that you want to retireve the orbital elements at the stop time of the simulation. Your current approach sets up the satellite scenario, adds a satellite using TLE data, and then immediately queries for the orbital elements and state vectors (position and velocity). However, this approach captures the state at the beginning of the simulation by default. To obtain the orbital elements at the stop time, you need to explicitly specify the time at which you want to query the orbital elements and states. To do so, use the "states" function with the "stopTime" as an input to get the position and velocity at the stop time.
% calculate the position and velocity at the stop time
[positionStop, velocityStop] = states(sat1, stopTime);
% display the position and velocity at the stop time
display(positionStop);
display(velocityStop);
However, it is important to note that the "orbitalElements" function directly doesn't accept position and velocity as inputs to return the orbital elements at a specific time. You would typically use the position and velocity to understand the satellite's state or to perform further custom calculations.
I hope this helps.