title: Kalman filter matrix dimensions mismatch
body: <p>I have created following dimensional matrices for a Kalman Filter:</p>
  
  <ul>
  <li><p><strong>Matrix <code>X</code></strong>, the state matrix: <code>4x1</code>, which has: <code>[X; dX; Y; dY]</code></p>
  
  <ul>
  <li><code>X</code>: x-coordinate</li>
  <li><code>dX</code>: rate of changing x-coordinate</li>
  <li><code>Y</code>: x-coordinate</li>
  <li><code>dY</code>: rate of changing y-coordinate.</li>
  </ul></li>
  <li><strong>Matrix <code>H</code></strong>, the observation matrix: <code>2x4</code></li>
  <li><strong>Matrix <code>R</code></strong>, the measurement noise covariance matrix: <code>2x4</code>.</li>
  <li><strong>Matrix <code>Z</code></strong>, the measurement matrix: <code>4x1</code> since there are <code>4</code> measurements for states.</li>
  </ul>
  
  <p>But apparently there is a mismatch of matrix dimensions as apache Kalman filter throws matrix dimension mismatch exception. </p>
  
  <p>I'm slightly confused with creating matrices suitable to a measurement matrix (<code>Z</code>) of <code>4x1</code> and state matrix of <code>4x1</code>.</p>