A Kalman filter can do interesting things (like filtering poll results)

I recently learned about the Kalman filter and finally got to play around with it a little bit. Since I had a hard time figuring out how to get it to work, here’s a practical (but yet general) introduction with examples:

A Kalman filter works by matching a simulation model and measured data. For each data point, an estimation of the simulation model’s internal state is computed based on the estimate of the previous state. This works with noisy data and limited measurement signals (e.g. a model with 10 state variables but only 2 measurement signals, although there are obvious limitations here (the more and the better the sensor data, the better the results should be – there’s also some limit on observability).

So we have this interesting tool which does all these different things:

  • filtering noisy data, while taking knowledge (or assumptions) on the underlying dynamics into account
  • merge data from several different sensors into one signal (typical application: combine GPS and acceleration sensor data into one accurate position signal)
  • offer a prediction of a system’s future state
  • estimate internal parameters of a system (say a spring stiffness based on measured oscillations)

Another interesting use is that we might try two different simulation models on the same measurement and check which one does a better job at synchronizing to the measurement (I’ll do this in a very simple example below).

Continue reading

Advertisements

Getting started

This is an experiment that has been bugging me for quite a while.

Every now and then I run into some applied mechanics problem and try to figure out how to solve it. Usually after a few minutes of trying, I also decide to google it and often I find no solution to my question (but usually a lot of helpful hints and good advice).

These are usually quite basic questions I’m considering, like:

  • how can I implement coulomb friction in a 1d mechanics model with consideration of stick and slip states?
  • my multibody model is getting quite complex with lots of reused code. The code would probably look a lot cleaner and simpler if masses and couplings are implemented as objects. How can this be done?

Both example questions are actually quite simple problems which are probably solved many times. Searching for a good solution is fun for me and I usually learn a lot along the way. So this is the idea of this blog: to write about simple problems with multibody dynamics and suggest possible solutions to them – and then see what happens.

Continue reading