Obtain position and velocity of satellite
[___] = states(___,'CoordinateFrame',
returns the outputs in the coordinates specified by
Obtain States of Satellite in ECEF Frame
Create a satellite scenario object.
startTime = datetime(2021,5,25); % May 25, 2021, 12:00 AM UTC stopTime = datetime(2021,5,26); % May 26, 2021, 12:00 AM UTC sampleTime = 60; % In seconds sc = satelliteScenario(startTime,stopTime,sampleTime);
Add a satellite to the scenario.
tleFile = "eccentricOrbitSatellite.tle"; sat = satellite(sc,tleFile);
Obtain the position and velocity of the satellite in the Earth-centered Earth-fixed (ECEF) frame corresponding to May 25, 2021, 10:30 PM UTC.
time = datetime(2021,5,25,22,30,0); [position,velocity] = states(sat,time,"CoordinateFrame","ecef")
position = 3×1 107 × -0.9431 -3.0675 2.7404
velocity = 3×1 103 × -1.2166 0.4198 -1.6730
sat — Satellite
row vector of
Satellite, specified as a row vector of
timeIn — Time at which output is calculated
Time at which the output is calculated, specified as a
datetime scalar. If
no time zone is specified in
timeIn, the time zone is assumed to be
Universal Time Coordinated (UTC).
C — Coordinate frame
Coordinate frame in which the outputs are returned, specified as
'ecef'option returns the position and velocity coordinates in the Earth Centered Earth Fixed (ECEF) frame. For more information on ECEF frames, see Earth-Centered Earth-Fixed Coordinates.
'inertial'option returns the position and velocity coordinates in the GCRF frame.
'geographic'option returns the position as [lat; lon; altitude], where lat and lon are latitude and longitude in degrees and altitude is the height above the surface of the Earth in meters. The velocity returned is in the North-East-Down (NED) frame.
pos — Position history
velocity — Velocity history
Velocity history of the satellites in meters/second, returned as a 3-by-n-by-m array in the GCRF frame.
timeOut — Time samples of position and velocity
scalar | vector
Time samples of the position and velocity of the satellites, returned as a scalar or
vector. If time histories of the position and velocity of the satellite are returned,
timeOut is a row vector.