Plot graph form satellite position

3 次查看(过去 30 天)
Toshi
Toshi 2024-3-19
回答: Himanshu 2024-3-22
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")

回答(1 个)

Himanshu
Himanshu 2024-3-22
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.

类别

Help CenterFile Exchange 中查找有关 Reference Applications 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by