# The GPS EASY Suite II: A Matlab Companion

Many practitioners in the GNSS field are familiar with Matlab, a high-level technical computing language and interactive environment for algorithm development, data visualization, data analysis, and numeric computation. In this new series, a prominent Danish GNSS researcher uses Matlab to illustrate and explain a variety of common GPS issues.

In 2003 I published a paper called “The GPS EASY Suite — Matlab Code for the GPS Newcomer.” The paper consisted of 10 parts, which are cited in the accompanying sidebar, “EASY Suite I Topics.” Each installment included a printed text and a file of related Matlab code or scripts (an M-file) that could be downloaded from a designated web site.

Each part contained an answer to often-asked questions in my classes. I did not, however, only offer an answer to the questions, but also a Matlab code that solves the problem. The article became a tremendous success and remained the most downloaded paper from the GPS Solutions site for more than a year.

Now, students love this sort of support. But I also received positive reactions from professionals who used the code in research papers, which saved them a lot of coding efforts.

The original Matlab code also turned out to be the most downloaded file from the Aalborg website. It resulted in numerous e-mails from interested readers asking for more files. These requests now answered by the creation of eight additional M-files. Some involve more complex problems and coding.

Since 2003, I have received a steady flow of additional questions from readers of Gilbert Strang’s and my book, Linear Algebra, Geodesy, and GPS.

Last summer I decided to create another set of common GPS problems/solutions and accompanying Matlab code — EASY Suite II. These will be presented in serial fashion, as one or more exercises in this and forthcoming issues of Inside GNSS.

Introducing the New Suite
Easy Suite II augments the set of basic computational tasks with the following topics:

EASY11, stereographic sky plot of satellite orbits and plot of time when satellites are above a given local horizon
EASY12, details of the LAMBDA method, explained through a small numerical example
EASY13, receiver autonomous integrity monitoring (RAIM), horizontal protection level (HPL), and vertical protection level (VPL)
EASY14, sample of space-based augmentation system (SBAS) corrected positions and their presentation in Stanford plots
EASY15, accuracy comparison between pseudorange based stand-alone positions, baselines computed using pseudoranges alone, and pseudoranges and carrier phase observations
EASY16, error analysis of a selected one-way observation
EASY17, satellite orbits in inertial and Earth-centered, Earth-fixed (ECEF) systems, and curve defined by sub-satellite points
EASY18, computation of differential corrections at a base station.

The original suite was thought of as comprising the base for an elementary course in GPS while, as reflected in the subjects, the new suite is of a more optional, topical character.

In 2003 and later, many users encountered difficulty in finding the necessary files for running individual EASY-files. Therefore, I chose to copy all files needed into single directories accessible online, so that each directory becomes self-contained. The price we pay is multiple copies of basic M-files.

The complete set of Easy Suite II Matlab codes can be found in compressed (“zipped”) files at http://gps.aau.dk/~borre/easy2. Readers can find much of the theoretical background for the EASY scripts in Chapters 14 and 15 of Linear Algebra, Geodesy, and GPS (see Additional Resources for details). However, we have added some text that emphasizes certain issues that are central in the codes, but may be difficult to find in a textbook.

EASY11: GPS Sky Plots
The EASY-Suite starts with a polar plot of satellite orbits as viewed from a given location, a graph showing the number of visible satellites, and the period of time when they are visible during 24 consecutive hours.

EASY11 itself is based on an almanac downloaded most easily from the National Geodetic Survey (NGS) website <http://www.ngs.noaa.gov/CORS/Data.html>. The actual file name is brdc1550.08n.

The RINEX file has been reformatted into Matlab’s binary format for satellite ephemerides using the M-file rinexe. The user enters (φ,λ) for the position on the ground where the plot is to be used, and a value for the elevation mask to be set. Then the azimuth and elevation angles for all visible positions of the included satellites are computed and plotted as polar coordinates.

Next follows bookkeeping on how many and which satellites are visible during the day and the time periods when they can be seen.

The Matlab code is simple, the result is impressive, and useful. In early GPS days when the constellation was incomplete, such plots were especially valuable for planning purposes to be sure that enough satellites would be available for positioning.

Except in the most severe terrain and urban canyons, receivers can find plenty of GPS (and GLONASS) satellites around the clock, and this situation will become even more pronounced when Galileo satellites are launched.

EASY12: LAMDA Method
Most students find the theory behind the Least-squares AMBiguity Decorrelation Adjustment (LAMBDA) for ambiguity resolution difficult to understand. We shall try to smooth the path.

First we describe in a subsection the linear algebra involved. Next we add an M-script that elucidates how the method works on a simple case with three ambiguities.

Linear Algebra for LAMBDA

. . .

Minimizing a Quadratic Expression over Integer

. . .

A Numerical Example

. . .

In the next issue of this periodical, we will illustrate the concept of receiver autonomous integrity monitoring (RAIM), and horizontal and vertical protection levels as applied especially in aviation.

[1] de Jonge, P. J., and C. C. J. M. Tiberius, “The LAMBDA Method for Integer Ambiguity Estimation: Implementation Aspects,” Delft Geodetic Computing Centre LGR series, No. 12, Delft, Netherlands, 1996
[2] Lenstra, A. K., and H. W. Lenstra, Jr., and L. Lovász, “Factoring polynomials with rational coefficients,” Mathematische Annalen 261 (4): 515–534, (1982)
[3] Strang, G., and K. Borre, Linear Algebra, Geodesy, and GPS, Wellesley-Cambridge Press, Wellesley, Massachusetts, USA, 1997
[4] Teunissen, P. J. G., “The least-squares ambiguity decorrelation adjustment: a method for fast GPS integer ambiguity estimation,” Journal of Geodesy, 70: 65–82, 1995

For the complete story, including figures, graphs, and images, please download the PDF of the article, above.

#### Manufacturers

Matlab is a product of The MathWorks, Inc., Natick, Massachusetts, USA.