9. Feedback Control Systems Design

9.1 Pole Assignment with State Feedback

<<ControlSystems`

TransferFunction[s, (1/(s^2))]

ToDiscreteTime[StateSpace[%], Sampled -> Period[T]]

StateFeedbackGains[%, {z1, z2}] // Simplify

% /. {z1 ->  .8 +  .2 I, 
          z2 ->  .8 -  .2 I, T -> 0.1} // 
      Chop

n = 8;

a = DiagonalMatrix[Range[n]] // N

b = Table[{1. }, {n}]

poles = Range[-n, -1]

StateFeedbackGains[a, b, poles, Method -> Ackermann, 
        AdmissibleError ->  .000001];

$MachinePrecision

{a, b, poles} = SetPrecision[{a, b, poles}, 25];

StateFeedbackGains[a, b, poles, Method -> Ackermann, 
        AdmissibleError ->  .000001];

Max[Eigenvalues[a - b . %] - poles]

9.1.1 Ackermann's Formula

aircraft = 
      StateSpace[{{-10, 0, -10, 0}, {0, - .7, 9, 
            0}, {0, -1, - .7, 0}, {1, 0, 0, 0}}, {{20, 
            2.8}, {0, -3.13}, {0, 0}, {0, 0}}]

poles = {-10, -8, -5, -2};

StateFeedbackGains[aircraft, poles, 
      Method -> Ackermann]

StateFeedbackGains[aircraft, poles, Method -> Ackermann, 
      ControlInput -> 1]

Controllable[Subsystem[aircraft, 1]]

9.1.2 Robust Pole Assignment

kA = 
      StateFeedbackGains[aircraft, poles, 
        Method -> Ackermann]

k1 = 
      StateFeedbackGains[aircraft, poles, Method -> KNVD, 
        MaxIterations -> 1]

k10 = 
      StateFeedbackGains[aircraft, poles, Method -> KNVD, 
        MaxIterations -> 10]

distort[expr_, err_] := 
      expr /. x_?NumberQ :> 
          x (1 + Random[Real, {-err, err}])

dks = distort[{kA, k1, k10},  .01];

Eigenvalues[StateFeedbackConnect[
              aircraft, #][[1]]] & /@ 
      dks

Max[Abs[((# - poles)/poles)]] & /@ %

9.2 State Reconstruction

StateSpace[{{0, 1, 0, 0}, {0, 0, -((3 g m)/(4 m + 7 M)), 
          0}, {0, 0, 0, 1}, {0, 
          0, ((6 g (m + M))/(4 L m + 7 L M)), 
          0}}, {{0}, {(7/(4 m + 7 M))}, {0}, {-(6/(4 L m + 
                  7 L M))}}, {{1, 0, 0, 0}}, {{0}}]

EstimatorGains[%, {p1, p2, p3, p4}, ComplexVariables -> None] // 
      Apart

% /. {m ->  .15, M -> 1, L -> 2, 
          g -> 9.81, p1 -> -2, 
          p2 -> -2 + I, 
          p3 -> -2 - I, p4 -> -3} // 
      Chop