/* n iteration's of kalman */

for(i=2;i<=N;++i) {

  Ke = A*Ke*(A') + Ku;	/* Ke(l|l-1) */

  Kv = Ke(1,1) + Kn;	/* assuming C=[1 0] */

  G = Ke*(C') / Kv;

  Ke = Ke - G * C * Ke;	/* Ke(l|l) */


  xtmp = A * xhat(:,i-1);
  zhat = xtmp(1);	/* assuming C=[1 0] */
  is = z(i) - zhat;	/* innovation */

  xhat(:,i) = xtmp + G * is;
}
;;
