Reputation: 176
I have created following dimensional matrices for a Kalman Filter:
Matrix X
, the state matrix: 4x1
, which has: [X; dX; Y; dY]
X
: x-coordinatedX
: rate of changing x-coordinateY
: x-coordinatedY
: rate of changing y-coordinate.H
, the observation matrix: 2x4
R
, the measurement noise covariance matrix: 2x4
.Z
, the measurement matrix: 4x1
since there are 4
measurements for states.But apparently there is a mismatch of matrix dimensions as apache Kalman filter throws matrix dimension mismatch exception.
I'm slightly confused with creating matrices suitable to a measurement matrix (Z
) of 4x1
and state matrix of 4x1
.
Upvotes: 1
Views: 2290
Reputation: 120
From the documentation it's either your control vector or your measurement vector, which has an incorrect size.
There are 2 cases where that exception can be thrown.
Case predict: DimensionMismatchException - if the dimension of the control vector does not match
Case correct: DimensionMismatchException - if the dimension of the measurement vector does not fit
There are few cases, but here it is due to number of rows of matrix R being not equal to number of rows of z.
Upvotes: 0