gnssconstellation
Satellite locations at specified time
Syntax
Description
Examples
Get Current Satellite Positions and Velocities
Get the current satellite positions and velocities from the GNSS satellites. Access the orbital parameters from IS-GPS-200K Interface Specification and calculate the position and velocities in ECEF coordinates for the given time. Display the satellite positions.
t = datetime('now','TimeZone','Local'); [satPos,satVel] = gnssconstellation(t); disp(satPos)
1.0e+07 * -1.9231 -1.5686 0.9462 0.1076 2.1067 1.6138 0.8897 -1.3197 -2.1263 1.6548 -0.1718 -2.0703 -0.5985 2.4889 -0.7079 0.2726 2.0983 -1.6053 -1.7559 0.6795 1.8733 1.4491 -2.1428 -0.6023 -1.3750 -0.6560 2.1756 -2.6379 0.2995 -0.0770 0.6927 1.4315 -2.1272 1.9461 0.9151 -1.5587 1.5037 -1.3512 1.7226 -0.9782 -2.3391 0.7910 1.7480 1.9543 0.4237 1.9726 1.2382 1.2766 -1.5187 0.4409 -2.1338 0.0843 -1.9981 1.7478 1.5068 0.3435 2.1601 -1.3057 2.2894 -0.3287 -0.2815 -2.0914 -1.6127 -1.7381 1.4475 -1.3921 -1.4005 1.3838 1.7826 -1.1818 -1.2937 -1.9960 -2.1135 -0.7891 -1.4017 2.5928 -0.4726 -0.3291 2.5131 0.3255 0.7953
Get Satellite Look Angles for Receiver Position
Use the lookangles
function to get the azimuth and elevation angles of satellites for given satellite and receiver positions. Specify a mask angle of 5 degrees. Get the satellite positions using the gnssconstellation
function.
Specify a receiver position in geodetic coordinates (latitude, longitude, altitude).
recPos = [42 -71 50];
Get the satellite positions for the current time.
t = datetime('now');
gpsSatPos = gnssconstellation(t);
Specify a mask angle of 5 degrees.
maskAngle = 5;
Get the azimuth and elevation look angles for the satellite positions. The vis
output indicates which satellites are visible. Get the total using nnz
.
[az,el,vis] = lookangles(recPos,gpsSatPos,maskAngle);
fprintf('%d satellites visible at %s.\n',nnz(vis),t);
10 satellites visible at 26-Feb-2022 15:12:51.
Retrieve Satellite Positions, Velocities, and IDs from RINEX File
Read one set of GPS satellites from the GPS navigation message in a RINEX file.
filename = "GODS00USA_R_20211750000_01D_GN.rnx";
data = rinexread(filename);
gpsData = data.GPS;
[~,satIdx] = unique(gpsData.SatelliteID);
gpsData = gpsData(satIdx,:);
Get the satellite positions, velocities, and IDs at the first time step.
t = gpsData.Time(1); [satPos,satVel,satID] = gnssconstellation(t,RINEXData=gpsData)
satPos = 31×3
107 ×
-1.5630 -0.1882 2.1186
1.3808 2.1970 -0.4861
-2.0061 0.7606 1.5492
-2.5625 -0.0140 -0.7096
1.4896 0.5448 -2.1487
0.6129 2.5407 0.4615
-1.0081 1.3751 -1.9877
-2.5811 -0.6135 -0.3246
-1.9289 0.8690 -1.6134
0.9542 -2.2526 1.0113
⋮
satVel = 31×3
103 ×
-0.8888 -2.5914 -0.8416
0.0362 0.7543 3.1043
1.1203 -1.6505 2.2591
-0.8301 -0.4385 2.9967
-1.6023 2.1607 -0.5493
-0.3948 -0.4708 3.1591
-1.0322 -2.4133 -1.1748
0.4370 -0.1710 -3.1339
-1.9860 -0.5032 2.1087
0.9968 -0.8308 -2.8502
⋮
satID = 31×1
1
2
3
4
5
6
7
8
9
10
⋮
Input Arguments
t
— Current time for satellite simulation
scalar datetime
array
Current time for the satellite simulation, specified as a scalar datetime
array.
The default time zone for a datetime
array is UTC. For
information on specifying a different time zone, see datetime
.
GPS start time is Jan 6, 1980 midnight, UTC. Specifying any
datetime
prior to this time will use the GPS start time.
Example:
datetime('now','TimeZone','Local');
Data Types: datetime
navData
— RINEX navigation data
structure
RINEX navigation data, specified as a structure returned by the
rinexread
function. The contents of the struct vary depending on
the type of satellite system. The gnssconstellation
function
supports only GPS or Galileo data read from a RINEX file. For more information on the
contents of the structure, see the rinexread
function More About section.
Example: RINEXData=rinexread("GODS00USA_R_20211750000_01D_GN.rnx")
Output Arguments
satPos
— Satellite positions
N-by-3 matrix of scalars
Satellite positions in the Earth-centered Earth-fixed (ECEF) coordinate system in meters, returned as an N-by-3 matrix of scalars. N is the number of satellites in the constellation.
Data Types: single
| double
satVel
— Satellite velocities
N-by-3 matrix of scalar
Satellite velocities in the Earth-centered Earth-fixed (ECEF) coordinate system in meters per second, returned as an N-by-3 matrix of scalars. N is the number of satellites in the constellation.
Data Types: single
| double
satID
— Satellite identification numbers
N-element column vector
Satellite identification numbers, returned as an N-element column vector. N is the number of satellites in the constellation.
Data Types: single
| double
More About
Orbital Parameters
The initial satellite positions and velocities are defined by orbital parameters in Table A.2-2 in GPS SPS Performance Standard, and are given in Earth-centered Earth-fixed (ECEF) coordinates.
Position calculations use equations from Table 30-II in the same IS-GPS-200K Interface Specification.
Velocity calculations use equations 8.21–8.27 in [1].
References
[1] Groves, Paul D. Principles of GNSS, Inertial, and Multisensor Integrated Navigation Systems. Boston: Artech House, 2013.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Only MEX functions are supported for code generation.
Version History
See Also
Objects
Functions
Apri esempio
Si dispone di una versione modificata di questo esempio. Desideri aprire questo esempio con le tue modifiche?
Comando MATLAB
Hai fatto clic su un collegamento che corrisponde a questo comando MATLAB:
Esegui il comando inserendolo nella finestra di comando MATLAB. I browser web non supportano i comandi MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)