- #1
X89codered89X
- 154
- 2
I've become a little confused about why no one cares to actually explicitly solve the Matrix Ricatti Differential Equation (RDE) of the form:
$$ -{\dot{P}} = Q + PA^T + A^TP + PBB^TP $$ where [itex] BB^T, Q, P [/itex] are a positive-definite matrices, and [itex] A, BB^T, Q, P \in \mathbb{R}^{n \times n} [/itex]
This equation pops up all the time in controls. A solution to this ode also appears to be avoided for some reason, even though deriving it (in my opinion) is nontrivial. Neither professors nor textbooks seem to address solving this other than to comment away the need to discuss a solution by saying "Often you need to solve this numerically". I asked about this and still felt curious but rather than asking more questions and just looking stupid, I wanted to fill what seems to be a void with my solution. It was also a good exercise for me.
Note: In the following derivation, [itex] P,R,X,J [/itex] are time-varying matrices, yet I will only explicitly show a time argument when this needs to be emphasized.
Step 1: Introduce change of coordinates.
Define
$$ R(t) = P(t) - R_o $$
where [itex] R_o [/itex] is constant and must be positive-definite (PD). Solving for [itex] P [/itex] and substituting this into the RDE and collecting terms results in
$$ -{\dot{R}} = (Q + R_oA + A^TR_o - R_oBB^TR_o) + R(A-BB^TR_o)+(A-BB^TR_o)^TR - RBB^TR $$
and select [itex] R_o [/itex] to satisfy
$$0=Q + R_oA + A^TR_o - R_oBB^TR_o $$
to get rid of the constant, resulting in a new RDE below
$$ -{\dot{R}} = R(A-BB^TR_o)+(A-BB^TR_o)^TR - RBB^TR $$
Notice that the constraint resulting in the equation above is actually the Algebraic RE (no derivative term) and the solution to this will be discussed later, and remember now that [itex] R_o [/itex] is no longer arbitrary. In fact, for my application (I believe) I may not need to solve for this matrix due to something really really really convenient, but this post should solve the RDE given the solution to this algebraic
Step 2: Decompose [itex] R(t) [/itex]
define matrices $$ X(t), J(t) $$ as both N x N matrices such that they satisfy
$$R(t) = X^T(t)J(t)X(t)$$
and note that while [itex] J(t) [/itex] is positive-definite (PD), [itex] X(t) [/itex] is not. Plugging this into the RDE results in (this will get messy)
$$ -{\dot{R}} = -{\dot{X}}^TJX - X^T{\dot{J}}X - X^TJ{\dot{X}} = X^TJX(A-BB^TR_o)-(A-BB^TR_o)^TX^TJX - X^TJXBB^TX^TJX $$
Step 3: Undetermined Coefficients
At this point you do "pattern matching" or "undetermined coefficients". You get two equations from this (two identifical equations for [itex] X(t) [/itex]). The first equation is:
$${\dot{X}} = X(BB^TR_o-A)$$
and the second is
$${\dot{J}} = JXBB^TX^TJ$$
Step 4: A Solution.
The first equation in step 3 represents the matrix ODE for linear time-invariant systems.
$${\dot{X}} = X(BB^TR_o-A)$$
Inverting the system and integrating yields
$${\dot{X}}(t)X^{-1}(t) = (BB^TR_o-A)$$
$$\int_{t}^{T}{\dot{X}}(s)X^{-1}(s)ds = \int_{t}^{T}(BB^TR_o-A)ds$$
$$log(X(T-t)) = (BB^TR_o-A)(T-t)$$
and exponentiating...
$$X(T-t) = e^{(BB^TR_o-A)(T-t)}$$
The second equation in step 3 is a bit more complex and requires some more manipulation and thought, and the previously solved solution [itex] X(t) [/itex]. Inverse [itex] J [/itex] on both sides to get
$$J^{-1}{\dot{J}}J^{-1} = XBB^TX^T$$
Integrating (the odd looking limits again come from my particular application, optimal control).
$$\int_{t}^{T}J(s)^{-1}{\dot{J(s)}}J(s)^{-1}ds = \int_{t}^{T}X(s)BB^TX^T(s)ds$$
This integral looks nasty, but on the left hand side is actually setup for chain rule of PD matrices, on the right hand side is a controllability grammian for an LTI system with the system matrix [itex] BB^TR_o-A [/itex]. But keep in mind controllability grammians have to be full rank (i.e., invertible) for all time in order for the related system to be controllable. To be sure that it plays the role of the controllability grammian as it does in linear systems, trying to solve for [itex] J(t) [/itex]
$$J^{-1}(T-t) = \int_{t}^{T}X(s)BB^TX^T(s)ds$$
Inversing gives
$$J(T-t) = \left( \int_{t}^{T}X(s)BB^TX^T(s)ds \right) ^{-1}$$
and THAT is why the controllability grammian needs to be invertible for all time. If the controllability grammian is not full rank, we cannot control the system, and thus we cannot invert this matrix to create our solution to the system.
Combining [itex] X(T-t), J(T-t) [/itex] we have
$$R(t) = X^T(T-t)J(T-t)X(T-t) = e^{(BB^TR_o-A)^Tt}\left( \int_{t}^{T}X(s)BB^TX^T(s)ds \right) ^{-1}e^{(BB^TR_o-A)t}$$
And yet we still need to add the constant term to find the solution in the original coordinate system
$$P(t) = R(t) + R_o = X^T(T-t)J(T-t)X(T-t) + R_o = e^{(BB^TR_o-A)^T(T-t)}\left( \int_{t}^{-1}X(s)BB^TX^T(s)ds \right) ^{-1}e^{(BB^TR_o-A)(T-t)} + R_o$$
(Conclusion)
I've reduced the problem of finding [itex] P(t) [/itex] for
$$ -{\dot{P}} = Q + PA + A^TP - PBB^TP$$
to finding [itex] R_o [/itex] that solves
$$0=Q + R_oA + A^TR_o - R_oBB^TR_o $$
I left out some details I think, partly because I'm still learning them for myself, and some things may only make sense here if you're using this for optimal control like me. Regardless, I think I've left the meat and potatoes here. Let me know what you think!
$$ -{\dot{P}} = Q + PA^T + A^TP + PBB^TP $$ where [itex] BB^T, Q, P [/itex] are a positive-definite matrices, and [itex] A, BB^T, Q, P \in \mathbb{R}^{n \times n} [/itex]
This equation pops up all the time in controls. A solution to this ode also appears to be avoided for some reason, even though deriving it (in my opinion) is nontrivial. Neither professors nor textbooks seem to address solving this other than to comment away the need to discuss a solution by saying "Often you need to solve this numerically". I asked about this and still felt curious but rather than asking more questions and just looking stupid, I wanted to fill what seems to be a void with my solution. It was also a good exercise for me.
Note: In the following derivation, [itex] P,R,X,J [/itex] are time-varying matrices, yet I will only explicitly show a time argument when this needs to be emphasized.
Step 1: Introduce change of coordinates.
Define
$$ R(t) = P(t) - R_o $$
where [itex] R_o [/itex] is constant and must be positive-definite (PD). Solving for [itex] P [/itex] and substituting this into the RDE and collecting terms results in
$$ -{\dot{R}} = (Q + R_oA + A^TR_o - R_oBB^TR_o) + R(A-BB^TR_o)+(A-BB^TR_o)^TR - RBB^TR $$
and select [itex] R_o [/itex] to satisfy
$$0=Q + R_oA + A^TR_o - R_oBB^TR_o $$
to get rid of the constant, resulting in a new RDE below
$$ -{\dot{R}} = R(A-BB^TR_o)+(A-BB^TR_o)^TR - RBB^TR $$
Notice that the constraint resulting in the equation above is actually the Algebraic RE (no derivative term) and the solution to this will be discussed later, and remember now that [itex] R_o [/itex] is no longer arbitrary. In fact, for my application (I believe) I may not need to solve for this matrix due to something really really really convenient, but this post should solve the RDE given the solution to this algebraic
Step 2: Decompose [itex] R(t) [/itex]
define matrices $$ X(t), J(t) $$ as both N x N matrices such that they satisfy
$$R(t) = X^T(t)J(t)X(t)$$
and note that while [itex] J(t) [/itex] is positive-definite (PD), [itex] X(t) [/itex] is not. Plugging this into the RDE results in (this will get messy)
$$ -{\dot{R}} = -{\dot{X}}^TJX - X^T{\dot{J}}X - X^TJ{\dot{X}} = X^TJX(A-BB^TR_o)-(A-BB^TR_o)^TX^TJX - X^TJXBB^TX^TJX $$
Step 3: Undetermined Coefficients
At this point you do "pattern matching" or "undetermined coefficients". You get two equations from this (two identifical equations for [itex] X(t) [/itex]). The first equation is:
$${\dot{X}} = X(BB^TR_o-A)$$
and the second is
$${\dot{J}} = JXBB^TX^TJ$$
Step 4: A Solution.
The first equation in step 3 represents the matrix ODE for linear time-invariant systems.
$${\dot{X}} = X(BB^TR_o-A)$$
Inverting the system and integrating yields
$${\dot{X}}(t)X^{-1}(t) = (BB^TR_o-A)$$
$$\int_{t}^{T}{\dot{X}}(s)X^{-1}(s)ds = \int_{t}^{T}(BB^TR_o-A)ds$$
$$log(X(T-t)) = (BB^TR_o-A)(T-t)$$
and exponentiating...
$$X(T-t) = e^{(BB^TR_o-A)(T-t)}$$
The second equation in step 3 is a bit more complex and requires some more manipulation and thought, and the previously solved solution [itex] X(t) [/itex]. Inverse [itex] J [/itex] on both sides to get
$$J^{-1}{\dot{J}}J^{-1} = XBB^TX^T$$
Integrating (the odd looking limits again come from my particular application, optimal control).
$$\int_{t}^{T}J(s)^{-1}{\dot{J(s)}}J(s)^{-1}ds = \int_{t}^{T}X(s)BB^TX^T(s)ds$$
This integral looks nasty, but on the left hand side is actually setup for chain rule of PD matrices, on the right hand side is a controllability grammian for an LTI system with the system matrix [itex] BB^TR_o-A [/itex]. But keep in mind controllability grammians have to be full rank (i.e., invertible) for all time in order for the related system to be controllable. To be sure that it plays the role of the controllability grammian as it does in linear systems, trying to solve for [itex] J(t) [/itex]
$$J^{-1}(T-t) = \int_{t}^{T}X(s)BB^TX^T(s)ds$$
Inversing gives
$$J(T-t) = \left( \int_{t}^{T}X(s)BB^TX^T(s)ds \right) ^{-1}$$
and THAT is why the controllability grammian needs to be invertible for all time. If the controllability grammian is not full rank, we cannot control the system, and thus we cannot invert this matrix to create our solution to the system.
Combining [itex] X(T-t), J(T-t) [/itex] we have
$$R(t) = X^T(T-t)J(T-t)X(T-t) = e^{(BB^TR_o-A)^Tt}\left( \int_{t}^{T}X(s)BB^TX^T(s)ds \right) ^{-1}e^{(BB^TR_o-A)t}$$
And yet we still need to add the constant term to find the solution in the original coordinate system
$$P(t) = R(t) + R_o = X^T(T-t)J(T-t)X(T-t) + R_o = e^{(BB^TR_o-A)^T(T-t)}\left( \int_{t}^{-1}X(s)BB^TX^T(s)ds \right) ^{-1}e^{(BB^TR_o-A)(T-t)} + R_o$$
(Conclusion)
I've reduced the problem of finding [itex] P(t) [/itex] for
$$ -{\dot{P}} = Q + PA + A^TP - PBB^TP$$
to finding [itex] R_o [/itex] that solves
$$0=Q + R_oA + A^TR_o - R_oBB^TR_o $$
I left out some details I think, partly because I'm still learning them for myself, and some things may only make sense here if you're using this for optimal control like me. Regardless, I think I've left the meat and potatoes here. Let me know what you think!
Last edited: