1.19 Solve the discrete-time algebraic Riccati equation

Problem: Given a continuous-time system represented by a transfer function \[ \frac {1}{s(s+0.5)}\] convert this representation to state space and sample the system at sampling period of \(1\) second, and then solve the discrete-time Riccati equation.

The Riccati equation is given by \[ A^{\prime }X+XA-XBR^{-1}B^{\prime }X+C^{\prime }C=0 \]

Let \(R=[3]\).

Mathematica

Clear["Global`*"]; 
sys=TransferFunctionModel[1/(s(s+.5)),s]; 
dsys=ToDiscreteTimeModel[sys, 
        1,z,Method->"ZeroOrderHold"]
 

pict

ss = StateSpaceModel[dsys]
 

pict

a = ss[[1,1]]; 
b = ss[[1,2]]; 
c = ss[[1,3]]; 
d = ss[[1,4]]; 
r = {{3}}; 
DiscreteRiccatiSolve[{a,b}, 
               {Transpose[c].c,r}]; 
MatrixForm[%]
 

\[ \left ( {\begin {array}{cc} 0.671414 & -0.977632 \\ -0.977632 & 2.88699 \\ \end {array}} \right ) \]

 

Matlab

clear all; close all; 
s    = tf('s'); 
sys  = 1/(s*(s+0.5)); 
dsys = c2d(sys,1)
 

dsys = 
    0.4261 z + 0.3608 
  ---------------------- 
  z^2 - 1.607 z + 0.6065 
 
Sample time: 1 seconds 
Discrete-time transfer function.
 

[A,B,C,D]=dssdata(dsys)
 

A = 
    1.6065   -0.6065 
    1.0000         0 
B = 
     1 
     0 
C = 
    0.4261    0.3608 
D = 
     0 
 
    2.8870   -0.9776 
   -0.9776    0.6714
 

dare(A,B,C'*C,3)
 

ans = 
 
    2.8870   -0.9776 
   -0.9776    0.6714
 

 

Maple

restart; 
alias(DS=DynamicSystems): 
sys := DS:-TransferFunction(1/(s*(s+1/2))); 
sys := DS:-ToDiscrete(sys, 1, 'method'='zoh'); 
sys := DS:-StateSpace(sys); 
Q:=sys:-c^%T.sys:-c; 
R:=Matrix([[3]]); 
LinearAlgebra:-DARE(sys:-a,sys:-b,Q,R)
 

\[ \left [\begin {array}{cc} 0.6714144604 & - 0.9776322436 \\ - 0.9776322436 & 2.8869912178 \end {array}\right ] \]