Skip to content

Kalman filter implementation

Wrote the Fortran filter in a three-person class project.

Fortran

Problem

Learn the Kalman filter by working a simple problem end to end: estimating a building’s true height (50 m) from ten noisy altimeter readings with a 5 m error.

What I did

I wrote the filter in Fortran 90. It takes the device error, an initial guess and its uncertainty, then each reading, and at every step computes the Kalman gain, updates the estimate and its uncertainty, and writes the results to a file. Teammates covered the theory and a multivariate version using BLAS/LAPACK.

Result

Starting from a deliberately poor guess of 60 m, the estimate settled near 49.5 m after seven readings and ended at 49.57 ± 1.57 m after ten, while the Kalman gain fell from 0.9 to 0.1 as the filter came to trust its own estimate.

Tools

Fortran