# NLMaP

## What is NLMaP?

Non-Linear Modelling and Positioning (NLMaP).

NLMaP is a small C++ library that implements the Levenberg-Marquardt method for non-linearly modelling data i.e. fitting a function that depends non-linearly on some parameters to some given data and evaluating the fit.

NLMaP was written primarily to provide a free non-linear modelling engine that could be used for positioning from lateration or angulation data and to that end classes are provided which extend and refine the model engine.

NLMaP is small, written from scratch and uses object orientation for flexibility and extensibility. It is free software (GPL). Anyone wishing to use it for commercial purposes should contact the author in the first place.

## Features

NLMaP offers the following features:

• A small, object-oriented C++ implementation of the Marquardt method
• Easily adapted to use any arbitrary function with any number of parameters
• Implements multilateration calculation using iterative non-linear modelling
• Implements multiangulation calculation using iterative non-linear modelling
• Multilateration engine minimises effect of multipath
• Well documented
• Free! (GPL)

A nightly snapshot of NLMaP is available from the subversion repository: Download snapshot .

## Documentation

The  Doxygen documentation for NLMaP is available online:  View Documentation

## Understanding Non-Linear Modelling

If you're uncertain as to what non-linear modelling is then this section provides a brief overview. If you are interested in more depth, you should read the documentation (which describes the process in detail and covers the underlying mathematics).

Imagine you have a set of data points (x,y) and you wish to know the best straight line that suits the distribution, y=mx+c for two parameters m and c. The function y=mx+c depends linearly on m and c (there is no m squared for example) and thus a linear model is used (you may be more familiar with the term 'regression'). A linear model varies m and c in (hopefully) clever ways until it finds the best fit it can.

You won't be particularly surprised to learn that a non-linear model is exactly the same, except the fitting function depends non-linearly on the parameters. The basic notion is even the same: vary the parameters to find the lowest error. But the maths isn't so nice and an efficient algorithm even nastier.

So what NLMaP provides is the ability to specify your own function and fit it to any data (provided there's enough of it!).

## NLMaP Software Structure

The basic NLMaP structure is illustrated in the UML diagram below. The non-linear modelling engine (accessed via class NonLinearModel) provides an abstract FitFunction class that can be extended to allow specification of an arbitrary fitting function. Similarly a FitData class for the input data. In each case NLMaP provides derivations that allow for positioning by lateration or angulation (LaterationFunction, AngulationData, etc). See the attached image.

The IterativeModeler class is designed to wrap around the non-linear modelling engine and provide the ability to iteratively form models, discarding the most inconsistent data with each attempt, thereby increasing the accuracy.

The IterativeModeler sorts residuals (to determine the outlier) using a custom ResidualSorter implementation. This allows for a variety of methods to determine residuals.

NLMaP also provides MultiAngulation and MultiLateration classes, which simply wrap around the IterativeModeler to provide a simple interface to achieve lateration or angulation.