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 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