KFilter:

-------------------------------------------------------------------------------
   Mechanizes one step of a Kalman Filter with a forgetting factor

   x[k+1] = phi*x[k] + gamma*u
   y[k]   = x[k] + k[k]*(z - h*x[k])

-------------------------------------------------------------------------------
   Form:
   [x, p, k, y, pY] = KFilter( r, phi, q, h, x, z, p, gamma, u, s )
-------------------------------------------------------------------------------

     ------
     Inputs
     ------
     r         (m,m)  Measurement Covariance
     phi       (n,n)  State transition matrix
     q         (n,n)  Process noise covariance
     h         (m,n)  Measurement matrix
     x         (n)    Previous value of the state
     z         (m)    Measurement vector
     p         (n,n)  Covariance of xold
     gamma     (n,l)  Input matrix
     u         (n)    Deterministic input
     s                Forgetting factor 1 = don't, ƒ = 1 stage filter

     -------
	  Outputs
     -------

     x         (n)    Updated state this is at time k+1
     p         (n,n)  Covariance of x 
     k         (n,m)  Kalman Gain matrix
     y         (m,1)  Output at time k
     pY        (n,n)  Covariance after the measurement update

-------------------------------------------------------------------------------
     Copyright (c) 1993-2000 Princeton Satellite Systems, Inc.
     All rights reserved.
-------------------------------------------------------------------------------

Children: