EAS-591T – Space Geodetic Measurements of Active Crustal Motions



Manipulation of GPS data

GPS observations are usually archived in an ASCII format called RINEX (for “Receiver INdependent EXchange” format. See http://www.ngs.noaa.gov/CORS/Rinex2.html for a complete explanation of the format.


There are RINEX observation files for storing phase and pseudorange observables, and RINEX navigation files for storing satellite ephemerides.


RINEX files for a number of permanent stations, in particular the ones that participate in the IGS, are freely available on data servers on the internet. Check out http://igscb.jpl.nasa.gov/ or http://sopac.ucsd.edu for various maps with all available stations and for station description (type of equipment, etc…).


The following anonymous ftp sites archive the IGS data:



ftp address


Scripps Institution of Oceanography, San Diego



Institut Géographique National, Paris



Institüt für Angewändte Geodäsie, Frankfurt






(YEAR = civil year, DAY = day of year)

Get and read a RINEX data file

Þ    Ftp the RINEX observation file from January 10, 2002, for station SJDV

Þ    Read and interpret the RINEX header

Þ    Get the site descrition file for that station and verify that the RINEX file header is correct


Read RINEX observation file and manipulate GPS observables.


1. Reading the RINEX observation file.

Matlab is not very efficient at reading ascii data files. We could write a function to read RINEX observation files, but it would be extremely slow. It is more efficient to write such a function in C (or Fortran?) and compile it in Matlab. We will use the C program readrinex.c. Copy it in your working directory and compile it using:

>> mex readrinex.c

This will create a Matlab executable file readrinex.mexgl. You use it as follows:

>> [Observables,epochs,sv,apcoords]=readrinex(rnx_file);

rnx_file is the name of your rinex file. Readrinex returns:

-        apcoords = vector containing approximate X, Y, Z coordinates (ECEF, m) of GPS site, read from the rinex file header.

-        sv = vector containing the list of all satellites recorded during the observation period, by their PRN number.

-        epochs = n x 6 matrix. n = number of epochs (2880 for a 24 hour rinex files sampled at 30 sec). Columns are: year, month, day, hour, minute, second.

-        Observables = structure containing phase and pseudorange observables. Think of it as a series of five n x m matrices with n = number of epochs (n=length(epochs)), m = total number of satellites visible over the observation period (m=length(sv)). Each of these 5 matrices correspond to: L1, L2, P1, P2, C1. To read a full P1 dataset from Observables, use: P1=Observables.P1; If there is no data for a particular sv and/or at a particular epoch, Observables contains NaN (= not a number, can be tested using Matlab’s function isnan).


2. Read ephemeris and convert to XYZ position in ECEF frame: use your read_rinexn.m and get_satpos.m functions.


3. Write a function to calculate theoretical satellite-receiver range R, given apcoords and the satellite ECEF positions computed in step 2 above.


4. Plot the following quantities as a function of time for PRN31:

-        Plot 1: satellite elevation

-        Plot 2:

o       C1

o       C2

o       P1

-        Plot 3:

o       L1

o       L2

-        Plot 4:

o       C1 – P1

o       P1 – P2

-        Plot 5:

o       C1 – R

o       P1 – R

-        Plot 6:

o       C1 – l1 x L1

o       P1 – l1 x L1

o       l1 x L1 – l2 x L2


5. Comment your results briefly


Use the following values:

f1 = 1.57542 x 109 Hz;

f2 = 1.2276 x 109 Hz;

c = 0.299792458 x 109 m/s;

l1 = c/f1;

l2 = c/f2;