/// <summary>
        /// Creates a new Discrete Time Kalman Filter with the given values for
        /// the initial state and the covariance of that state.
        /// </summary>
        /// <param name="x0">The best estimate of the initial state of the estimate.</param>
        /// <param name="P0">The covariance of the initial state estimate. If unsure
        /// about initial state, set to a large value</param>
        public DiscreteKalmanFilter(Matrix <double> x0, Matrix <double> P0)
        {
            KalmanFilter.CheckInitialParameters(x0, P0);

            x = x0;
            P = P0;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates an Information filter with the given initial state.
        /// </summary>
        /// <param name="x0">Initial estimate of state variables.</param>
        /// <param name="P0">Covariance of state variable estimates.</param>
        public InformationFilter(Matrix <double> x0, Matrix <double> P0)
        {
            KalmanFilter.CheckInitialParameters(x0, P0);

            J = P0.Inverse();
            y = J * x0;
            I = Matrix <double> .Build.DenseIdentity(y.RowCount, y.RowCount);
        }
        /// <summary>
        /// Creates a square root filter with given initial state.
        /// </summary>
        /// <param name="x0">Initial state estimate.</param>
        /// <param name="P0">Covariance of initial state estimate.</param>
        public SquareRootFilter(Matrix <double> x0, Matrix <double> P0)
        {
            KalmanFilter.CheckInitialParameters(x0, P0);

            // Decompose the covariance matrix
            Matrix <double>[] UDU = UDUDecomposition(P0);
            U = UDU[0];
            D = UDU[1];
            x = x0;
        }
Exemplo n.º 4
0
        /// <summary>
        /// Creates an Information filter specifying whether the covariance and state
        /// have been 'inverted'.
        /// </summary>
        /// <param name="state">The initial estimate of the state of the system.</param>
        /// <param name="cov">The covariance of the initial state estimate.</param>
        /// <param name="inverted">Has covariance/state been converted to information
        /// filter form?</param>
        /// <remarks>This behaves the same as other constructors if the given boolean is false.
        /// Otherwise, in relation to the given state/covariance should satisfy:<BR></BR>
        /// <C>cov = J = P0 ^ -1, state = y = J * x0.</C></remarks>
        public InformationFilter(Matrix <double> state, Matrix <double> cov, bool inverted)
        {
            KalmanFilter.CheckInitialParameters(state, cov);

            if (inverted)
            {
                J = cov;
                y = state;
            }
            else
            {
                J = cov.Inverse();
                y = J * state;
            }

            I = Matrix <double> .Build.DenseIdentity(state.RowCount, state.RowCount);
        }