solve riccati equation in matlab

The Riccati equation is a nonlinear ordinary differential equation that arises in control theory and other areas of mathematics. To solve the Riccati equation in MATLAB, you can use the built-in function riccati.

Assuming you have a system with state-space representation of the form

main.m
dx/dt = Ax + Bu
y = Cx + Du
28 chars
3 lines

where A, B, C, and D are matrices, and you wish to solve the associated Riccati equation

main.m
A'X + XA - XBR^{-1}B'X + Q = 0
31 chars
2 lines

where R and Q are matrices of appropriate dimensions and X is the solution matrix, you can use the riccati function as follows:

main.m
% Define the matrices A, B, C, D, R, and Q

% Solve the Riccati equation
X = riccati(A, B, C, D, Q, R);

% Verify the solution
residual = A'*X + X*A - X*B*inv(R)*B'*X + Q;

% Check that the residual is small
norm(residual)
223 chars
11 lines

The riccati function returns the solution matrix X, which can be used to compute a stabilizing feedback gain, among other things.

Note that the riccati function uses a numerical algorithm to solve the Riccati equation, so the accuracy of the solution may depend on the algorithm's parameters and the chosen tolerances. It is recommended to consult the MATLAB documentation for additional information and examples.

gistlibby LogSnag