Ramindu De Silva
Ramindu De Silva

Reputation: 3

Kalman Filter Matrix Dimensions Mismatch at Estimating New Value

Im referring to the Kalman Filter Explanation. When applying the mentioned operation and when estimating the new value, I cannot do the operations mentioned since the matrix dimensions are not matching.

I have the variables as below

A transition matrix - 2x2 - {{1d, timestampDiff}, {0d, 1d}}; 
X from the previous state - 2x1 - {{measuredValue}, {measuredChangingRate}}
P variance matrix - 2x2 - {{1000, 0}, {0, 1000}}
H Measurement matrix - 1x2 - {1,1}
Z measured values - 1x2 - {34.5,4}

My calculations are as below

t - denotes the transpose ' - denotes the inverse

1. Xk = A.X ( 2x2 . 2x1 = 2x1 )
2. Pk = A.P.At ( 2x2 . 2x2 . 2x2 = 2x2 )

3. K = Pk.Hkt / (Hk.Pk.Hkt + Rk ) 
   (2x2 . 2x1 ) / ( 1x2 . 2x2 . 2x1 + 1x1 ) = 2x1
4. Xk(estimate) = Xk + K.(Z - Hk.Xk)
   2x1 + (2x1 . (1x2 - 1x2 . 2x1)) = 2x1 + 2x2

In the 4th step, i cannot add the two matrices since its dimensions are different.

Please point me out where I did my mistake.

Thanks a lot.

Upvotes: 0

Views: 162

Answers (2)

Ramindu De Silva
Ramindu De Silva

Reputation: 3

I referred to the 2 links [1] and [2] and managed to configure my matrix. My measurement matrix H was defined with the wrong dimensions. And the correct dimension is 2x2.

H Measurement matrix - 2x2 - {{1,0},{0,1}}
  1. https://courseware.ee.calpoly.edu/~fdepiero/fdepiero_dsp_notes/notes%20&%20materials/kalman%20filter%20notes.pdf
  2. http://www.swarthmore.edu/NatSci/echeeve1/Ref/Kalman/MatrixKalman.html

Upvotes: 0

Ben Jackson
Ben Jackson

Reputation: 93710

You have too many measurements. z should be a vector with as many rows as H.

Upvotes: 1

Related Questions