Plot graph form satellite position
2 views (last 30 days)
Show older comments
I am using TLE file of satellite to extract the position and velocity. I want to plot the graph for the same but i am getting error while doing so. Here i am using timetable to plot the graph.
startTime = datetime(2024,3,1,12,38,08);
stopTime = datetime(2024,3,5,15,38,08);
sampleTime = 7200;
sc = satelliteScenario(startTime,stopTime,sampleTime);
tleFile = "o3b.tle" ;
sat1 = satellite(sc,tleFile, ...
"Name","sat1", ...
"OrbitPropagator","sgp4");
elements1 = orbitalElements(sat1);
[position,velocity]= states(sat1);
t=datetime(2024,3,1,12,38,08):datetime(2024,3,5,15,38,08);
TT = array2timetable(position,'RowTimes',t);
plot(TT.t,TT.position);
xlabel("Time")
ylabel("Relative position (km)")
legend("Sat2","Sat3")
0 Comments
Answers (1)
Himanshu
on 22 Mar 2024
Hello,
I understand that you are using MATLAB to work with satellite data, specifically by creating a satellite scenario, loading a satellite from a TLE file, and plotting its position over time.
Since more information about the "o3b.tle" file is not available, I assume the error might have occurred while creating the time vector.
The attempt to create a vector of datetime objects using datetime(2024,3,1,12,38,08):datetime(2024,3,5,15,38,08) might not work as expected because you're trying to create a vector without specifying the step size.
To resolve the issue, you can replace this with the following code:
t = datetime(2024,3,1,12,38,08):seconds(sampleTime):datetime(2024,3,5,15,38,08);
I hope this helps.
0 Comments
See Also
Categories
Find more on Reference Applications in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!