MVUE 1.0
MVUE / BLUE (Minimum Variance Unbiased Estimator / Best Linear Unbiassed Estimator)
Loading...
Searching...
No Matches
MVUE Library

Minimum Variance Unbiased Estimator library for sensor fusion.

Introduction

The MVUE library provides lightweight, template-based C++ implementations of Minimum Variance Unbiased Estimators (MVUE) for combining multiple independent measurements of the same quantity.

When multiple sensors provide measurements of the same physical quantity with known measurement variances, the measurements can be combined into a single estimate with lower variance than the individual measurements.

The library provides estimators for a fixed number of measurements as well as a generic estimator supporting an arbitrary number of measurements.

Mathematical Model

Consider a quantity $x$ measured by $N$ independent sensors:

\‍[x_i = x + v_i
\‍]

where $x_i$ is the measurement from sensor $i$ and $v_i$ is zero-mean measurement noise with variance $\sigma_i^2$.

The minimum variance unbiased estimate is obtained using inverse-variance weighting:

\‍[\hat{x} =
\frac{
\displaystyle\sum_{i=1}^{N}\frac{x_i}{\sigma_i^2}
}{
\displaystyle\sum_{i=1}^{N}\frac{1}{\sigma_i^2}
}
\‍]

The variance of the resulting estimate is:

\‍[\mathrm{Var}(\hat{x}) =
\frac{1}{
\displaystyle\sum_{i=1}^{N}\frac{1}{\sigma_i^2}
}
\‍]

Therefore, measurements with lower variance receive greater weight in the resulting estimate.

The inverse-variance weighted estimator is also the Best Linear Unbiased Estimator (BLUE) when the required assumptions are satisfied.

In particular, for independent measurements with known variances, the estimator can be written as a linear combination:

\‍[\hat{x} = \sum_{i=1}^{N} w_i x_i
\‍]

where

\‍[w_i =
\frac{1/\sigma_i^2}
{\displaystyle\sum_{j=1}^{N}1/\sigma_j^2}.
\‍]

The weights satisfy the unbiasedness condition:

\‍[\sum_{i=1}^{N} w_i = 1.
\‍]

Features of Library

The library provides:

  • Two-measurement MVUE estimator.
  • Three-measurement MVUE estimator.
  • Four-measurement MVUE estimator.
  • N-measurement MVUE estimator.
  • C++ template support for different numeric types.
  • A lightweight interface suitable for embedded and real-time applications.

Assumptions

The estimator assumes that:

  • The measurements estimate the same underlying quantity.
  • The measurement errors are unbiased.
  • The measurement variances are known.
  • The measurement variances are positive.
  • Measurements are independent when using the inverse-variance weighting formulation implemented by this library.

If measurement errors are correlated, the covariance between measurements must be considered and the simple inverse-variance formulation is no longer sufficient.

Project Structure

The library is organized as follows:

MVUE
+-- include
| +-- mvue.h
| +-- mvue_2.h
| +-- mvue_3.h
| +-- mvue_4.h
| `-- mvue_N.h
|
`-- src
+-- mvue_2.tpp
+-- mvue_3.tpp
+-- mvue_4.tpp
`-- mvue_N.tpp

Quick Start

Two-Measurement Example

The following example combines two measurements with known variances:

#include "mvue_2.h"
estimator.init(0.25, 1.0);
double estimate = estimator.update(10.2, 9.8);
Minimum Variance Unbiased Estimator for two measurements.
Definition mvue_2.h:70
void init(T var_1_, T var_2_)
Initializes the estimator.
Definition mvue_2.h:15
T update(T x1_i, T x2_i)
Computes the minimum variance unbiased estimate.
Definition mvue_2.h:28
Two-measurement Minimum Variance Unbiased Estimator.

Here, the first measurement has variance $0.25$ and the second measurement has variance $1.0$. Therefore, the first measurement receives a larger weight.

Multiple Measurements

Estimators for three and four measurements are also available:

#include "mvue_3.h"
#include "mvue_4.h"
estimator_3.init(0.25, 1.0, 0.5);
estimator_4.init(0.25, 1.0, 0.5, 2.0);
double estimate_3 = estimator_3.update(10.2, 9.8, 10.0);
double estimate_4 = estimator_4.update(10.2, 9.8, 10.0, 10.5);
Minimum Variance Unbiased Estimator for three measurements.
Definition mvue_3.h:70
T update(T x1_i, T x2_i, T x3_i)
Computes the minimum variance unbiased estimate.
Definition mvue_3.h:29
void init(T var_1_, T var_2_, T var_3_)
Initializes the estimator.
Definition mvue_3.h:15
Minimum Variance Unbiased Estimator for four measurements.
Definition mvue_4.h:70
T update(T x1_i, T x2_i, T x3_i, T x4_i)
Computes the minimum variance unbiased estimate.
Definition mvue_4.h:30
void init(T var_1_, T var_2_, T var_3_, T var_4_)
Initializes the estimator.
Definition mvue_4.h:15
Three-measurement Minimum Variance Unbiased Estimator.
Four-measurement Minimum Variance Unbiased Estimator.

N_Measurement Estimator

For an arbitrary number of measurements, use the generic MVUE_N class:

#include "mvue_n.h"
constexpr std::size_t N = 5;
double variances[N] = {
0.25,
1.0,
0.5,
2.0,
0.75
};
double measurements[N] = {
10.2,
9.8,
10.0,
10.5,
10.1
};
estimator.init(variances);
double estimate = estimator.update(measurements);
Minimum Variance Unbiased Estimator for N measurements.
Definition mvue_n.h:89
T update(const T *x_i)
Computes the minimum variance unbiased estimate.
Definition mvue_n.h:27
void init(T *var_)
Initializes the estimator.
Definition mvue_n.h:15
N-measurement Minimum Variance Unbiased Estimator.

API Reference

For complete documentation of the library API, see Files/File List in the content.