receiverposition
Estimate GNSS receiver position and velocity
Syntax
Description
Examples
Read observation and navigation data from the RINEX files.
[obsdata,obshdr] = rinexread("GODS00USA_R_20211750000_01H_30S_MO.rnx"); [navmsg,navhdr] = rinexread("GODS00USA_R_20211750000_01D_GN.rnx");
Get GNSS measurements from the observation and navigation data.
meas = gnssmeasurements(obsdata.GPS,navmsg.GPS);
Estimate the receiver position from the GNSS measurements and display the receiver position for the first time stamp of the RINEX file.
lla = receiverposition(meas); lla(1,:)
ans = 1×3
39.0205 -76.8273 36.6238
Use the receiverposition function to estimate a GNSS receiver position. Get the satellite positions and velocities using the gnssconstellation function. Generate pseudoranges from these positions using the pseudoranges function.
Specify a receiver position in geodetic coordinates (latitude, longitude, altitude) and a receiver velocity in the local navigation frame.
recPos = [42 -71 50]; recVel = [1 2 3];
Get the satellite positions for the current time.
t = datetime('now');
[gpsSatPos,gpsSatVel] = gnssconstellation(t);Get the pseudoranges and pseudorange rates between the GNSS receiver and the satellites.
[p,pdot] = pseudoranges(recPos,gpsSatPos,recVel,gpsSatVel);
Use the pseudoranges to estimate the receiver position and velocity. The values close to your original receiver position and velocity used to generate the satellite position and pseudoranges.
[lla,gnssVel] = receiverposition(p,gpsSatPos,pdot,gpsSatVel)
lla = 1×3
42.0000 -71.0000 49.5625
gnssVel = 1×3
1.0000 2.0140 2.9972
Read the data from a RINEX navigation and observation messages. These RINEX files contain GNSS data for March 29, 2025.
navFileName = "GODE00USA_R_20250880000_01D_GN.rnx"; obsFileName = "GODE00USA_R_20250880800_01H_30S_MO.rnx"; [rnxnavdata,rnxnavhdr] = rinexread(navFileName); [rnxobsdata,rnxobshdr] = rinexread(obsFileName);
Create ionosphere and troposphere delay models. Use the Klobuchar model for the ionosphere delay model with the GPS alpha and beta coefficients from the header file.
ionoParams = rnxnavhdr.IonosphericCorrections; alpha = ionoParams(1).Parameters; beta = ionoParams(2).Parameters; ionoDelayModel = gnssIonosphere("klobuchar",alpha,beta); tropoDelayModel = gnssTroposphere("saastamoinen");
Create the GNSS options for estimating the receiver position.
opts = gnssoptions(Ionosphere=ionoDelayModel,Troposphere=tropoDelayModel);
Get the GNSS measurements for the GPS satellites using the RINEX navigation and observation messages. Show the data for the first three time steps.
gpsData = gnssmeasurements(rnxobsdata.GPS,rnxnavdata.GPS); gpsData(1:3,:)
ans=3×8 timetable
Time SatelliteID Pseudorange SatellitePosition SatelliteClockBias PseudorangeRate SatelliteVelocity SatelliteClockDrift EphemerisAccuracy
____________________ ___________ ___________ _________________________________________ __________________ _______________ _____________________________ ___________________ _________________
29-Mar-2025 08:00:00 1 2.4375e+07 -2.126e+07 -1.4117e+07 7.4018e+06 0.00019738 NaN -471.47 -855.01 -2983 1.8076e-11 2
29-Mar-2025 08:00:00 2 2.566e+07 -2.0524e+07 -1.6951e+07 -2.4589e+06 -0.00020789 NaN 429.94 23.954 -3140.9 9.436e-12 2
29-Mar-2025 08:00:00 3 2.2235e+07 -1.2415e+07 -9.5047e+06 2.132e+07 0.0006808 NaN 578.88 -2675.8 -837.42 3.5243e-12 2
Calculate the receiver positions by using the GPS measurements and the options specified by the gnssoptions object. Show the receiver positions for the first three time steps.
[recPos,recVel,hdop,vdop,info] = receiverposition(gpsData,opts); recPos(1:3,:)
ans = 3×3
39.0217 -76.8268 13.7420
39.0217 -76.8269 13.0003
39.0217 -76.8268 12.2894
Input Arguments
Pseudoranges between the satellites and receiver, specified as an N-element vector in meters. N is the number of satellites in the constellation.
Data Types: single | double
Satellite positions in the Earth-centered Earth-fixed (ECEF) coordinate system in meters, specified as an N-by-3 matrix of scalars. N is the number of satellites in the constellation.
Data Types: single | double
Pseudorange rates between the satellites and receiver, specified as an N-element vector in meters per second. N is the number of satellites in the constellation.
Data Types: single | double
Velocity readings of the GNSS receiver in the Earth-centered Earth-fixed (ECEF) coordinate system in meters per second, specified as a N-by-3 matrix of scalars. N is the number of satellites in the constellation.
Data Types: single | double
Raw GNSS measurements, specified as a timetable.
Use the gnssmeasurements function to get these measurements.
Options for calculating receiver position from GNSS measurements, specified as a
gnssoptions
object.
Output Arguments
Receiver position in geodetic coordinates, returned as a three-element vector of the form [latitude longitude altitude]
Data Types: single | double
Receiver velocity in the local navigation frame using north-east-down (NED) coordinates, returned as a three-element vector of the form [vx vy vz].
Data Types: single | double
Horizontal dilution of precision, returned as a scalar.
Data Types: double
Vertical dilution of precision, returned as a scalar.
Data Types: double
Information about clock bias, clock drift, and time dilution of precision (TDOP), returned as a structure containing these fields:
ClockBias— Estimated bias error in receiver clock, in seconds.ClockDrift— Estimated drift error in receiver clock, in seconds per second.TDOP— Time dilution of precision.
Algorithms
For single-point positioning, the receiverposition function estimates a
the position of a GNSS receiver using pseudorange measurements from multiple satellites. It
uses an iterated weighted least squares (WLS) approach to solve for the receiver position
and clock bias.
At each iteration i, the estimated state vector is updated as:
x — Receiver position rr and receiver clock bias Δtr.
c is the speed of light in meters per second.
H — Jacobian matrix containing the line-of-sight (LOS) vectors esr between satellites s and the receiver r for m total satellites.
y — Measurement vector containing the pseudorange measurements from all m satellites visible to the receiver.
is a pseudorange measurement from a satellite s with respect to receiver r.
W — Weight matrix.
h(x) — Predicted pseudorange measurement for estimated state.
For more information about the weights and predicted pseudorange measurement equations, see the Pseudorange Measurement and Weights section.
The predicted pseudorange measurement equation that the receiverposition
function uses is defined as:
— Geometric range of satellite s with respect to receiver r. For more information about calculating the geometric range, see Geometric Range Between Satellite and Receiver
c — Speed of light in meters per second.
— Clock bias of receiver r in seconds.
— Clock bias of satellite s in seconds.
— Ionospheric delay of satellite s with respect to receiver r in meters.
— Tropospheric delay of satellite s with respect to receiver r in meters.
And the weight matrix weighs each measurement according to its expected error, so less reliable measurements have less influence on the estimated position.
The total variance for a satellite s is defined as:
— Satellite system error factor of satellite s. This table shows the factor for each satellite system.
Satellite System Factor GPS, Galileo, BeiDou 1 GLONASS 1.5 SBAS 3 — Code or carrier-phase error ratio of receiver r. The
receiverpositionfunction assumes a value of100.— Carrier-phase error factors in meters. The
receiverpositionfunction assumes a value of0.003meters for both factors.— Elevation angle of satellite s with respect to receiver r, in meters.
— Standard deviation of ephemeris and clock error, in meters. This value is determined by indexing into this vector with the user range accuracy (URA) index:
[2.4 3.4 4.85 6.85 9.65 13.65 24 48 96 192 384 768 1536 3072 6144]Note that this index is zero-based.
— Standard deviation of ionosphere correction model error, in meters.
The value depends on the ionosphere correction model you specify in the
Ionosphereproperty ofgnssopts.is the ionospheric delay, in meters.
For more information about the Klobuchar model, see Klobuchar Delay Model.
— Standard deviation of troposphere correction model error, in meters.
The value depends on the troposphere correction model you specify in the
Troposphereproperty ofgnssopts.is the elevation angle of satellite s with respect to receiver r, in meters.
For more information about the Saastamoinen model, see Saastamoinen Delay Model.
— Standard deviation of code bias error, in meters. The
receiverpositionfunction assumes a value of0.3meters.
Note
Prior to R2026a, the pseudorange measurements and weight equations are:
Im is an identity matrix, which weighs all m satellite measurements equally for receiver position estimation.
The satellite clock bias is the difference between the time kept by the onboard clock of a satellite and the actual GNSS system time.
The satellite clock bias of satellite s at transmission time ts is given as:
The equation has three components:
Satellite clock parameters
— Satellite clock bias parameter
— Satellite clock drift parameter
— Satellite clock drift rate parameter
toe — Time of ephemeris
Relativistic correction
μ — Earth gravitational constant
c — Speed of light in meters per second
e — Eccentricity
A — Eccentric anomaly in radians
Group delay parameter
b — for Li pseudorange
TGD — Group delay parameter, in seconds
The geometric range is the Euclidean between the position of a satellite and the position of a receiver at an instance of time.
The geometric range between the satellite s and the receiver r is defined as:
rr(tr) — Receiver position in ECEF at reception time tr. Units in meters.
rs(ts) — Satellite position in ECEF at reception time ts. Units in meters.
ωe — Earth’s rotation rate in radians per second from the WGS84 model. This corrects for the Earth's rotation during the travel of the signal.
c — Speed of light in meters per second.
xs(ts) — Satellite x-position in ECEF at transmission time ts. Units in meters.
ys(ts) — Satellite y-position in ECEF at transmission time ts. Units in meters.
xr(tr) — Receiver x-position in ECEF at transmission time tr. Units in meters.
xr(tr) — Receiver y-position in ECEF at transmission time tr. Units in meters.
The satellite transmission time ts is defined as:
Psr — Pseudorange measurement, in meters, of satellite s with respect to receiver r.
— Satellite clock bias, in seconds, of satellite sat transmission time ts.
The satellite clock bias that the receiverposition function
uses for geometric range calculation is derived using only the clock bias parameters part of
the clock bias equation:
For more information about satellite clock bias, see the Satellite Clock Bias section.
References
[1] Groves, Paul D. Principles of GNSS, Inertial, and Multisensor Integrated Navigation Systems. 2nd ed. GNSS Technology and Application Series. Boston: Artech House, 2013.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Version History
Introduced in R2021aThe receiverposition function now calculate receiver position from
raw GNSS measurements. Use the gnssmeasurements
function to generate the measurements to specify the receiverposition
function, and use the gnssoptions object
to specify biases and atmospheric delay models.
See Also
Objects
Functions
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
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)