Kalman Filter Explained
What is Kalman Filtering?
Kalman Filtering ( linear quadratic estimation or LQE ) is an algorithm that is used to calculate the variable of Interest optimally when they can’t be measured directly. But their Indirect Measure is available . Another Definition that is not from google is that it is an iterative Mathematical Process that uses a set of equations and consecutive data inputs to quickly estimate the True value, Position, Velocity, acceleration, etc of the object in discussion when the measured value contains random errors, uncertainty ,etc.I would like to mention that all the Information in the article has been collected from the watching the Playlist of Kalman Filter by Michel van Biezen .
Consider a car that is travelling in x-direction at a speed of 10 km/hr . If I ask you how much the car has travelled in 1 hour what would be your answer ?10km would be a good guess.Now if I give you additional information like the odometer measured 10.2 Km and the amount of error in the odometer readings , what would be the your answer now ? Seems a bit Easier 10.2 but that would not be the case as the car tire may have hit a bump on the road which would make our answer wrong .This is the Dilemma we face in situations like this we have 2 answers 10 according to (Distance = Speed x Time ) and 10.2 according to Instrument that does have an amount of uncertainty to it .So what shall we do now ? take average and settle for 10.1 .But that would be a bit unfair as we may have a higher weight of confidence on one over the other .This is where kalman Filtering Come in .Kalman Filter help us to find the right balance between Estimate and Measurement to get as close to optimal answer possible .
Kalman in 1 D
- Calculating Kalman Gain — It is the most important variable in the whole process as it finds the right balance between the Estimate and Measurement Value .
where E is the Error .
2. Calculate New Estimate
where EST is Estimation, KG/K is Kalman Gain, Measurement is the observed value.
3. Update in Error in Estimation
Kalman in MultiDimesion
- Estimate Matrix
X is State Matrix , U is Control Variable Matrix (how 1 state affect the other ) ,W is Predicted State Noise Matrix. Xkp is New state Estimation. A and B is made up of 1,0 and Delta t to make the matrix shape compatible for the operations.
2. Covariance matrix
Initially it is made up of the Covariance of the State Variable and then updated each iteration.Process Covariance Matrix basically contains the Information about the Error in Estimation.Q is the Error in Process of Calculating Process Covariance Matrix .
3. Kalman Gain
H is Identity Matrix Generally just to ensure compatibility in the dimensions.R is the Error in Measurements .
4. Measured Value
X is measured value here and Z is measurement Noise.
5. Calculate Current State
6. Update Process Covariance Matrix
A,B,H,C etc are all used to preserve the matrix dimensions and let be compatible with one another .
This brings us to the end of 1st Iteration and you may continue as many iterations you want .Bringing us closer and closer to the optimal value.