### 1.18 Solve the continuous-time algebraic Riccati equation

Problem: Solve for $$X$$ in the Riccati equation $A^{\prime }X+XA-XBR^{-1}B^{\prime }X+C^{\prime }C=0$ given \begin {align*} A & =\begin {pmatrix} -3 & 2\\ 1 & 1 \end {pmatrix} \\ B & =\begin {pmatrix} 0\\ 1 \end {pmatrix} \\ C & =\begin {pmatrix} 1 & -1 \end {pmatrix} \\ R & =3 \end {align*}

Mathematica

 Clear ["Global*"]; a={{-3,2},{1,1}}; b={{0},{1}}; c={{1,-1}}; r={{3}}; sol=RiccatiSolve[{a,b},{Transpose[c].c,r}]; MatrixForm[N[sol]]  $\left ( {\begin {array}{cc} 0.589517 & 1.82157 \\ 1.82157 & 8.81884 \\ \end {array}} \right )$

Matlab

 %needs control system clear all; close all; a = [-3 2;1 1]; b = [0 ; 1]; c = [1 -1]; r = 3; x = care(a,b,c'*c,r)  x = 0.5895 1.8216 1.8216 8.8188 

Maple

 restart; A:=Matrix([[-3,2],[1,1]]); B:=Vector([0,1]); C:=Vector[row]([1,-1]); Q:=C^%T.C; R:=Matrix([[3]]); LinearAlgebra:-CARE(A,B,Q,R) ` $\left [\begin {array}{cc} 0.5895174373 & 1.8215747249 \\ 1.8215747249 & 8.8188398069 \end {array}\right ]$