Brian Lai and Dennis S. Bernstein Brian Lai and Dennis S. Bernstein are with the Department of Aerospace Engineering, University of Michigan, Ann Arbor, MI, USA. {brianlai, dsbaero}@umich.edu. This work was supported by the NSF Graduate Research Fellowship under Grant No. DGE 1841052.
Abstract
Recursive least squares (RLS) is derived as the recursive minimizer of the least-squares cost function.Moreover, it is well known that RLS is a special case of the Kalman filter.This work presents the Kalman filter least squares (KFLS) cost function, whose recursive minimizer gives the Kalman filter.KFLS is an extension of generalized forgetting recursive least squares (GF-RLS), a general framework which contains various extensions of RLS from the literature as special cases.This then implies that extensions of RLS are also special cases of the Kalman filter.Motivated by this connection, we propose an algorithm that combines extensions of RLS with the Kalman filter, resulting in a new class of adaptive Kalman filters.A numerical example shows that one such adaptive Kalman filter provides improved state estimation for a mass-spring-damper with intermittent, unmodeled collisions.This example suggests that such adaptive Kalman filtering may provide potential benefits for systems with non-classical disturbances.
I Introduction
Despite their respective deterministic and stochastic foundations, least-squares and the Kalman filter share an interconnected history [1].It is well known that the update equations for recursive least squares (RLS) (e.g. [2]) are the same as those of the Kalman filter with, for all , identity state matrix , zero input matrix , process noise covariance , and measurement noise covariance (see p.51 of [3], section 3.3.5 of [4], or p.129 of [5]).As RLS became a foundational algorithm of systems and control theory for online identification of fixed parameters [6, 3], numerous extensions of RLS were developed (e.g. [7, 8, 9, 10, 11, 12, 13, 14, 15, 16]) to improve identification of time-varying parameters.However, little work has been done to connect these extensions to the Kalman filter.
The RLS update equations are often derived as the recursive minimizer of a least squares cost function (e.g. [2]).A natural question is whether the RLS cost function can be generalized to derive the Kalman filter.While other deterministic derivations of the Kalman filter have been presented (e.g. [17, 18]), these do not follow as an extension of the RLS cost.
This work presents the Kalman filter least squares (KFLS) cost function whose recursive minimizer gives the Kalman filter update equations.KFLS is an extension of generalized forgetting recursive least squares (GF-RLS) [19], which contains various extensions of RLS from the literature as special cases.As a result, these extensions of RLS are also special cases of the Kalman filter with particular choices of the process noise covariance matrix.
This result motivates a new class of adaptive Kalman filtering, with modified prior covariance update equations to incorporate forgetting from extensions of RLS.A brief survey is given to show how several forgetting methods from the RLS literature can be applied to adaptive Kalman filtering.A numerical example shows how adaptive Kalman filtering with robust variable forgetting factor [14] improves state estimation of a mass-spring-damper system with intermittent, unmodeled collisions.This example suggests that such an adaptive Kalman filtering may be beneficial when disturbances are non-classical.
I-1 Notation and Terminology
For symmetric , (respectively, ) denotes that is positive definite (respectively, positive semidefinite).For all , let .For and positive-semidefinite , .
II Background Material
II-A The one-step Kalman Filter
Consider the discrete-time, linear, time-varying system
(1) | ||||
(2) |
where, for all , is the state, is the measurement, is the input, is the process noise, and is the measurement noise, for positive-semidefinite and positive-semidefinite .Moreover, for all , , , and .The two-step Kalman filter [20] for the system given by (1) and (2) is can be expressed as
(3) | ||||
(4) | ||||
(5) | ||||
(6) | ||||
(7) |
where, for all , positive-definite and are, respectively, the prior and posterior covariances, and are, respectively, the prior and posterior state estimates, and is the Kalman gain.
Next, if, for all , and are nonsingular, then the matrix inversion lemma (Lemma 1) can be used to rewrite (3) through (7) as the one-step Kalman filter [18], where, for all ,
(8) | ||||
(9) |
II-B Discrete-Time LTV State Transition Function
To facilitate expressing a least squares cost function for the Kalman filter, we first introduce the state transition function for discrete-time LTV system, a concise notation to transition between states at different time steps.For all , let , , , and . Consider the discrete-time, linear time-varying state update equation
(10) |
Assume, for all , is nonsingular. For all , define the state transition matrix (from step to step ), denoted , by
(11) |
It follows that, for all , .Then, for all , can be expressed as
(12) |
For all , we further define the matrices
(14) | ||||
(16) |
It follows that .Hence, for all , .On the other hand, for all , .Therefore, for all and , we define the state transition function (from step to step ), denoted , by
(17) |
III A Least Squares Cost Function which Derives the Kalman Filter
This section develops the Kalman filter least squares (KFLS) cost function whose recursive minimizer gives the one-step Kalman filter update equations.To begin, for all , let be the forgetting matrix.Theorem 1 develops the KFLS cost function (19) in terms of and shows how the update equations (23) and (24) minimize that cost.Corollary 2 will later show how, for a particular choice of , the update equations of Theorem 1 are equivalent to the one-step Kalman filter.
Theorem 1.
For all , let be nonsingular, , , be positive definite, , and . Furthermore, let be positive definite and . For all , Let be positive semidefinite and such that
(18) |
For all , define as
(19) |
where
(20) | ||||
(21) | ||||
(22) |
Then, there exists a unique global minimizer of , denoted ,which, for all , is given recursively by
(23) | ||||
(24) |
where, for all , is positive definite.
Proof.
See the Appendix.â
Corollary 1.
Consider the notation and assumptions of Theorem 1.For all ,
(25) |
and hence (18) hold if and only if .
Proof.
Let . Note that (25) follows from repeated substitution of (23).Next, note that the right-hand side of (25) is equivalent to the right-hand side of (18).Hence, (18) is equivalent to â
Corollary 2.
Consider the notation and assumptions of Theorem 1.If, for all , there exists positive-semidefinite such that
(26) |
then, for all , (18) is satisfied. Moreover, (23) and (24) are equivalent to the one-step Kalman filter update equations (8) and (9).
Proof.
Let . Note that (26) can be rewritten as
(27) |
Substituting (27) into (23), it follows that (23) and (24) are equivalent to (8) and (9).Moreover, (26) can also be expressed as .Since and are both positive definite, it follows that is positive definite, and hence is positive definite.Therefore, by Corollary 1, condition (18) is satisfied.â
Next, Proposition 1 shows that, for all , has the same definiteness as .
Proposition 1.
For all , is positive semidefinite (resp. positive definite) if and only on is positive semidefinite (resp. positive definite).
Proof.
Let .If is positive semidefinite (respectively, positive definite), then (respectively, ).Since is nonsingular by Corollary 1, it follows that and hence (respectively, ).Finally, since is nonsingular by assumption, it follows from (31) that is positive semidefinite (respectively, positive definite).
Next, if is positive semidefinite (respectively, positive definite), then (respectively, ) and hence (respectively, ).Therefore, (respectively, ).â
IV RLS Extensions as Special Cases of the Kalman Filter
Revisiting the state update equation (10), note that if, for all , and , then, for all , .This also implies that the state transition function, given by (17), is identity.In particular, for all , , and , .Substituting the identity state transition function into the cost function given by (19), it follows that, for all ,
(28) | ||||
(29) | ||||
(30) |
Note that, in this special case, the cost function is equivalent to the generalized forgetting recursive least squares (GF-RLS) cost developed in [19], where GF-RLS uses the notation and instead of and , respectively.In [19], it was shown that various extensions of RLS from the literature are special cases of GF-RLS if, for all , a particular forgetting matrix is chosen.
Therefore, we conclude that an extension of RLS, which is a special case of GF-RLS with forgetting matrix , , is also a special case of the Kalman filter if, for all , , , and there exists positive-semidefinite such that (26) holds.Explicitly solving for , it follows that
(31) |
where is nonsingular by (18) and Corollary 1.Moreover, by Proposition 1, is positive semidefinite if and only if is positive semidefinite.
While [19] gives a thorough literature review on extensions of RLS as special cases of GF-RLS, for brevitiy, we summarize eight extensions in Table I.Given are the algorithm name and reference, assumptions of the algorithm, tuning parameters, and derived from (31).
Algorithm | Tuning Parameters | Process Noise Covariance | ||
---|---|---|---|---|
1. Recursive Least Squares [2] | â | |||
2. Exponential Forgetting [2, 21] | ||||
3. Variable-Rate Forgetting [7] | , | |||
4. Data-Dependent Forgetting [16] | and | |||
5. Exponential Resetting [12] | positive-definite | |||
6. Covariance Resetting [22] | positive-definite and resetting criteria | |||
| ||||
8. Variable-Direction Forgetting [21] | Positive-definite , |
V Adaptive Kalman Filtering Developed from RLS Forgetting Algorithms
Thus far, we have shown that various extensions of RLS from the literature are special cases of the Kalman filter, in part, by a special choice of the process noise covariance given by (31).Motivated by this relationship, we propose a class of adaptive Kalman filters by replacing the prior covariance update equation (4) with the adaptive prior covariance update equations
(32) | ||||
(33) |
where, for all , positive-semidefinite is designed from an extension of RLS (e.g. right column of Table I), and positive-semidefinite is designed using traditional methods of the Kalman filter.
While there are as many variants of this algorithm as extensions of RLS, we select a particular extension of RLS to show the potential benefits in state estimation.
V-A Kalman Filter with Robust Variable Forgetting Factor
Consider the mass-spring-damper system in Figure 1, with mass , spring constant , and damping coefficient .The vertical displacement of the mass at time is , where when the mass is at rest.Assume that and Furthermore, a downward force is applied on the mass at time .This nominal mass-spring-damper system can be modeled as
(42) |
However, we additionally assume there is a wall at . If the mass collides with this wall, the mass reverses direction with the same speed.Note that such intermittent collisions can be interpreted as impulsive disturbances on the system.Finally, we consider, for all , the measurements , given by
(43) |
where is the sampling time and, for all , is the measurement noise with .The goal is to estimate the vertical displacement and velocity without knowledge of the wall at .We will assume that the nominal model (42) and the measurement noise covariance are known.
We begin by discretizing (42) and (43) using zero-order hold and sampling time to obtain the nominal system
(44) |
where, for all , , ,
(49) | ||||
(51) |
We first consider state estimation using the Kalman filter with the nominal discrete system (44), and , , and, for all , , .
Second, we will consider an adaptive Kalman filter with adaptive prior covariance update equations (32) and (33) developed from variable-rate forgetting [7].This adaptive Kalman filter also uses the nominal discrete system (44), and , , and, for all , .Then, for all , let
(52) |
where, the forgetting factor is chosen using the robust variable forgetting factor algorithm developed in [14].Weâve chosen this algorithm for its ability to improve tracking of impulsive changes of parameters [14].For all , let
(53) | ||||
(54) | ||||
(55) |
where , , and , where , , and since the system is second-order.
Then, for all , if , , otherwise
(56) |
where , , and .For details on robust variable forgetting and tuning of parameters, see [14].
Figure 2 shows state estimation of the Kalman filter (KF) and the adaptive Kalman filter (KF*), as well as the forgetting factor , all with zero-order hold.Note that after each of the four collisions the mass makes with the wall at , the forgetting factor briefly but drastically decreases.This results in improved displacement and velocity estimation immediately after each collision.This can be more clearly seen in the error between the true state and the estimated state in Figure 3.Figure 4 shows and , the diagonal elements of the covariance matrix , which can also be interpreted as the marginal variance of the displacement and velocity state estimate, respectively.Note that in the adaptive Kalman filter (KF*), there is a sudden increase in both and after each collision, allowing for quicker adaptation.
VI Conclusion
This work presents the Kalman filter least squares cost function whose recursive minimizer gives the Kalman filter update equations.An important consequence of this cost function is that various extensions of RLS from the literature are special cases of the Kalman filter.Motivated by this result, we propose a new adaptive Kalman filters, whose prior covariance update is modified to include RLS forgetting.While the numerical example we presented shows the potential benefits of adaptive Kalman filtering with robust variable forgetting factor [14] in the presence of impulsive disturbances, there are numerous other forgetting algorithms in the RLS literature to be considered (several summarized in Table I).Future work includes further exploration into how, and in what situations, such extensions may be beneficial.
References
- [1]H.W. Sorenson, âLeast-squares estimation: from gauss to kalman,â IEEE Spectrum, vol.7, no.7, pp. 63â68, 1970.
- [2]S.Islam and D.Bernstein, âRecursive least squares for real-time implementation,â IEEE Ctrl. Sys. Mag., vol.39, no.3, p.82, 2019.
- [3]K.J. à ström and B.Wittenmark, Adaptive control.Courier Co., 2013.
- [4]J.L. Crassidis and J.L. Junkins, Optimal estimation of dynamic systems.Chapman and Hall/CRC, 2004.
- [5]D.Simon, Optimal state estimation: Kalman, H infinity, and nonlinear approaches.John Wiley & Sons, 2006.
- [6]L.Ljung and T.Söderström, Theory and practice of recursive identification.MIT press, 1983.
- [7]A.L. Bruce, A.Goel, and D.S. Bernstein, âConvergence and consistency of recursive least squares with variable-rate forgetting,â Automatica, vol. 119, p. 109052, 2020.
- [8]L.Cao and H.Schwartz, âA directional forgetting algorithm based on the decomposition of the information matrix,â Automatica, vol.36, no.11, pp. 1725â1731, 2000.
- [9]R.Kulhavỳ and M.KĂĄrnỳ, âTracking of slowly varying parameters by directional forgetting,â IFAC Proceedings Volumes, vol.17, no.2, pp. 687â692, 1984.
- [10]S.Bittanti, P.Bolzern, and M.Campi, âConvergence and exponential convergence of identification algorithms with directional forgetting factor,â Automatica, vol.26, no.5, pp. 929â932, 1990.
- [11]M.E. Salgado, G.C. Goodwin, and R.H. Middleton, âModified least squares algorithm incorporating exponential resetting and forgetting,â International Journal of Control, vol.47, no.2, pp. 477â491, 1988.
- [12]B.Lai and D.S. Bernstein, âExponential resetting and cyclic resetting recursive least squares,â IEEE Ctrl. Sys. Lets., vol.7, pp. 985â990, 2023.
- [13]A.Vahidi etal., âRecursive least squares with forgetting for online estimation of vehicle mass and road grade: theory and experiments,â Vehicle Sys. Dynms., vol.43, no.1, pp. 31â55, 2005.
- [14]C.Paleologu, J.Benesty, and S.Ciochina, âA robust variable forgetting factor recursive least-squares algorithm for system identification,â IEEE Signal Processing Letters, vol.15, pp. 597â600, 2008.
- [15]R.M. Johnstone, C.R. JohnsonJr, R.R. Bitmead, and B.D. Anderson, âExponential convergence of recursive least squares with exponential forgetting factor,â Sys. & Ctrl. Letters, vol.2, no.2, pp. 77â82, 1982.
- [16]S.Dasgupta and Y.-F. Huang, âAsymptotically convergent modified recursive least-squares with data-dependent updating and forgetting factor for systems with bounded noise,â IEEE Transactions on Information Theory, vol.33, no.3, pp. 383â392, 1987.
- [17]J.Humpherys and J.West, âKalman filtering with newtonâs method,â IEEE Control Systems Magazine, vol.30, no.6, pp. 101â106, 2010.
- [18]J.Humpherys, P.Redd, and J.West, âA fresh look at the kalman filter,â SIAM review, vol.54, no.4, pp. 801â823, 2012.
- [19]B.Lai and D.S. Bernstein, âGeneralized forgetting recursive least squares: Stability and robustness guarantees,â 2023.
- [20]R.E. Kalman, âA new approach to linear filtering and prediction problems,â Transactions of the ASMEâJournal of Basic Engineering, vol.82, no. Series D, pp. 35â45, 1960.
- [21]A.Goel, A.L. Bruce, and D.S. Bernstein, âRecursive least squares with variable-direction forgetting: Compensating for the loss of persistency,â IEEE Ctrl. Sys. Mag., vol.40, no.4, pp. 80â102, 2020.
- [22]G.Goodwin, E.Teoh, and H.Elliott, âDeterministic convergence of a self-tuning regulator with covariance resetting,â in IEE Proceedings D-Control Theory and Applications, vol.1, no. 130, 1983, pp. 6â8.
Appendix
Lemma 1.
Let , , , . Assume , , and are nonsingular. Then, .
Lemma 2.
Let be positive definite, let and , and define by .Then, has a unique stationary point, which is the global minimizer given by .
Proof of Theorem 1.
We write , given by (19), as
Next, we expand , where
(57) | ||||
Defining , it follows from the expression of that (23) is satisfied for .Furthermore, if , (18) simplifies to and hence .Furthermore, since is positive definite, it follows from definition (57) that is positive definite.Therefore, from Lemma 2, it follows that the unique minimizer of is given by , which can be expanded as
Hence, (24) holds for . Moreover, since is positive definite, it follows that is also positive definite.
Now, let .Note that for all ,
Hence, , given by (19), can be written as
Next, we expand , where
(58) | |||
(59) | |||
Note that can be written recursively as
(60) |
Defining ,it follows that (23) is satisfied.
Next, to write a recursive update for , we first write as , where
Note that is the sum of first terms of summation in (59), is the last term of summation in (59), and is the remaining term outside the summation. Next, note, for all , the identities
(61) | |||
(62) |
Using (61) and (62), we can write , where
Similarly, (61) implies that , where
It then follows from (59) and (58), respectively, that
Hence, we obtain the recursive update
Finally, note that (58) can be used to rewrite (18) as , and hence .Furthermore, since is positive definite, it follows from (60) that is positive definite.Therefore, by Lemma 2, the unique minimizer of is given by , which simplifies to
Hence, (24) is satisfied. Finally, since is positive definite, it follows that is also positive definite.â