Plot graph form satellite position

2 ビュー (過去 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 Center および File ExchangeReference Applications についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by