How to do solve Riccati differential(matrix) equation backward
Afficher commentaires plus anciens
the matrix Riccati differential equation:
dX/dt = A'X + XA - XBB'X + Q
I have seen the exactly same topic in my search but the only reason I am posting it again is so that I did not fully understand the implementation used in the question and answer given my MathWorks support team back in July 2009. The answer given was:
_ _ _ *The matrix Riccati differential equation:
dX/dt = A'X + XA - XBB'X + Q
can be solved using the functions in the ODE suite.
Assume your dependent matrix "X" is "n"-by-"n", and you have known "n"-by-"n" matrices "A", "B", and "Q". The following method will solve the matrix Riccati differential equation. Save the following as a MATLAB file somewhere on the MATLAB Path.
function dXdt = mRiccati(t, X, A, B, Q) X = reshape(X, size(A)); %Convert from "n^2"-by-1 to "n"-by-"n" dXdt = A.'*X + X*A - X*B*B.'*X + Q; %Determine derivative dXdt = dXdt(:); %Convert from "n"-by-"n" to "n^2"-by-1 Then, you can use the ODE45 function to solve this problem:
[T X] = ode45(@mRiccati, [0 10], X0, [], A, B, Q) For example, using the sample data:
A = [1 1; 2 1]; B = [1; 1]; Q = [2 1; 1 1]; X0 = [1; 1; 1; 1]; You can use the following command to solve the system of differential equations:
[T X] = ode45(@mRiccati, [0 10], X0, [], A, B, Q); ODE45 returns "X" as a vector at each time step. You may use the following code to reshape each row of "X" to get the matrix and store it in a cell array:
[m n] = size(X); XX = mat2cell(X, ones(m,1), n); fh_reshape = @(x)reshape(x,size(A)); XX = cellfun(fh_reshape,XX,'UniformOutput',false); The results of this can be verified by the LQR function:
[K,S,E] = lqr(A, B, Q, 1) where "S" should have results very similar to the last elements in "X" or "XX". The LQR function computes the steady-state value of the system. In this example, we generated the solution for up to "t = 10", which is an adequate approximation of infinity for this problem.
For more information on ODE45 and other such solvers, refer to the function reference page for ODE45 in the MATLAB documentation.* _ _ _
MY QUESTION IS:What is X0 and why do we have '[]' in the argument when we call the ode45 function
Réponses (1)
Mischa Kim
le 16 Mar 2014
Modifié(e) : Mischa Kim
le 16 Mar 2014
0 votes
X0 are the initial conditions of the differential equations. The [] are a placeholder for the integrator options.
4 commentaires
upinderjeet
le 16 Mar 2014
Modifié(e) : upinderjeet
le 16 Mar 2014
Mischa Kim
le 16 Mar 2014
As the name implies, the matrix Riccati differential equation is described by a state matrix (rather than a state vector as typically seen with DE), which in the case above is indeed a 2-by-2. Note the reshape commands that are used to transform between 4-by-1 and 2-by-2 matrices.
upinderjeet
le 16 Mar 2014
Mischa Kim
le 17 Mar 2014
Integrator options include, e.g., integration tolerances, step size, event handling (such as zero-crossing detection). For more detailed information please refer to the documentation.
Catégories
En savoir plus sur Matrix Computations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!