ControlDesign

 ControllerObserver
 determine the equations of the subsystem comprised of a state feedback controller and an observer

 Calling Sequence ControllerObserver(sys, Kc, L, opts)

Parameters

 sys - System; system object Kc - Matrix; state feedback gain L - Matrix; observer gain opts - (optional) equation(s) of the form option = value; specify options for the ControllerObserver command

Options

 • Kr = Matrix or 0
 Specify a feedforward gain ${K}_{r}$ (reference input). If Kr = 0, there are no reference inputs $r$ and the returned closed-loop system is autonomous if there are no measured_inputs or non-controlled inputs specified by the user. The default value is 0.
 • closedloop = true or false
 True means calculate the closed-loop equations of the state feedback controller, observer, and plant. False means calculate the equations of the state-feedback controller and observer subsystem. The default is false.
 • stateerror = true or false
 True means return a state vector with the original states $x$ and the state errors ${x}_{\mathrm{err}}=x-\stackrel{ˆ}{x}$  (difference between each state and its estimate) in the closedloop case with outputtype = ss. False means express the closed-loop state-space equations in terms of the original states $x$ and the state estimates $\stackrel{ˆ}{x}$. The default is false.
 • controlled_inputs = all or set(posint)
 Specifies a subset of  sys input indices that are controller outputs. The default is all. A controlled input ${u}_{c}$ cannot be specified as a measured input.
 • measured_inputs = none, all or set(posint)
 Specifies a subset of sys input indices that are not controller outputs and are measured to be input to the observer. The default is none. A measured input ${u}_{m}$ cannot be specified as a controlled input.
 • controlled_outputs = all or set(posint)
 Specifies a subset of sys output indices that are regulated by the controller. The default is all. A controlled output ${y}_{c}$ may be specified as a measured output.
 • measured_outputs = all or set(posint)
 Specifies a subset of sys output indices that are measured to be input to the observer. The default is all. A measured output ${y}_{m}$ may be specified as a controlled output.
 • augment_output = true or false
 True means append the controlled_inputs to the output vector in the closedloop case. The default is false.
 • outputtype = tf, coeff, zpk, ss, or de
 Determines the subtype of the returned system object.  The default return type is based on the type of the system object specified in the sys parameter.
 • parameters = {list, set}(name = complexcons)
 Specifies numeric values for the parameters of sys. These values override any parameters previously specified for sys. The numeric value on the right-hand side of each equation is substituted for the name on the left-hand side in the sys equations. The default is the value of sys given by DynamicSystems:-SystemOptions(parameters).

Description

 • The ControllerObserver command calculates the equations of the subsystem comprised of a state feedback controller and an observer, where sys is the plant, ${K}_{c}$ is the state feedback controller gain, and $L$ is the observer gain. In the diagram below, this subsystem corresponds to the blocks enclosed in the solid-line box.
 • The closed-loop system equations of the state feedback controller, observer and plant can be obtained using the closedloop option. In the diagram below, the closed-loop system corresponds to the blocks enclosed in the dashed-line box.
 • When the option Kr is specified, the state feedback controller is governed by the control law  ${u}_{c}=-{K}_{c}.\stackrel{ˆ}{x}+{K}_{r}.r$, where $\stackrel{ˆ}{x}$ is the estimated state vector, and $r$ is the reference vector. The reference vector $r$ contains a reference signal for each controlled output, ${y}_{\mathrm{c_ref}}$.
 • The system sys is a SISO (single input, single output) or MIMO (multiple input, multiple output) linear system object created using the DynamicSystems package. The system object can be of types: transfer function (TF), zero-pole-gain (ZPK), coefficients (Coeff), state-space (SS), and diff-equation (DE). It is assumed that the state feedback controller gains, $\mathrm{Kc}$ and $\mathrm{Kr}$, are obtained using the sys representation obtained by DynamicSystems[StateSpace].
 • The ControllerObserver command returns a system object whose type is the same as the type of sys, unless the option outputtype is specified.
 • The controller-observer subsystem inputs are
 – the reference inputs $r={y}_{\mathrm{c_ref}}$ (when a non-zero Kr Matrix is specified)
 – the measured_inputs ${u}_{m}$
 – the measured_outputs ${y}_{m}$ (renamed $\mathrm{y_meas}$)
 The controller-observer outputs are
 – the controlled_inputs ${u}_{c}$
 The controller-observer states (in state-space) are
 – the estimated states $\stackrel{ˆ}{x}$ (renamed $\mathrm{x_est}$)
 • The closed-loop system inputs are
 – the reference inputs $r={y}_{\mathrm{c_ref}}$ (when a non-zero Kr Matrix is specified)
 – the measured_inputs ${u}_{m}$
 – the non-controlled inputs ${u}_{\mathrm{nc}}$ (e.g. disturbances)
 The closed-loop system outputs are
 – the controlled_outputs ${y}_{c}$
 – the non-controlled outputs ${y}_{\mathrm{nc}}$
 – the controlled_inputs ${u}_{c}$ (if augment_output = true)
 The closed-loop system states (in state-space) are
 – the sys states $x$ and
 – the estimated states $\stackrel{ˆ}{x}$ (renamed $\mathrm{x_est}$)
 Or when stateerror = true
 – the sys states $x$ and
 – the state errors ${x}_{\mathrm{err}}=x-\stackrel{ˆ}{x}$ (renamed $\mathrm{x_err}$).

Examples

 > $\mathrm{with}\left(\mathrm{ControlDesign}\right):$
 > $\mathrm{with}\left(\mathrm{DynamicSystems}\right):$

Example: State feedback control with observer of linear model for the steering of a vehicle with nonslipping wheels

 • The following second order system represents a linear model for the steering of a vehicle with nonslipping wheels:
 > $\mathrm{sys1}≔\mathrm{StateSpace}\left(\mathrm{Matrix}\left(\left[\left[0,1\right],\left[0,0\right]\right]\right),\mathrm{Matrix}\left(\left[\left[\mathrm{α}\right],\left[1\right]\right]\right),\mathrm{Matrix}\left(\left[\left[1,0\right]\right]\right),\mathrm{Matrix}\left(1,1\right)\right):$
 > $\mathrm{PrintSystem}\left(\mathrm{sys1}\right)$
 $\left[\begin{array}{l}{\mathbf{State Space}}\\ {\mathrm{continuous}}\\ {\mathrm{1 output\left(s\right); 1 input\left(s\right); 2 state\left(s\right)}}\\ {\mathrm{inputvariable}}{=}\left[{\mathrm{u1}}{}\left({t}\right)\right]\\ {\mathrm{outputvariable}}{=}\left[{\mathrm{y1}}{}\left({t}\right)\right]\\ {\mathrm{statevariable}}{=}\left[{\mathrm{x1}}{}\left({t}\right){,}{\mathrm{x2}}{}\left({t}\right)\right]\\ {\mathrm{a}}{=}\left[\begin{array}{cc}{0}& {1}\\ {0}& {0}\end{array}\right]\\ {\mathrm{b}}{=}\left[\begin{array}{c}{\mathrm{\alpha }}\\ {1}\end{array}\right]\\ {\mathrm{c}}{=}\left[\begin{array}{cc}{1}& {0}\end{array}\right]\\ {\mathrm{d}}{=}\left[\begin{array}{c}{0}\end{array}\right]\end{array}\right$ (1)
 • Checking whether the system is observable.
 > $\mathrm{Observable}\left(\mathrm{sys1}\right)$
 ${\mathrm{true}}$ (2)
 • Defining the characteristic polynomial with damping ratio $Z$ and natural frequency $\mathrm{\omega }$.
 > $\mathrm{cp}≔{s}^{2}+2Z\mathrm{ω}s+{\mathrm{ω}}^{2}$
 ${\mathrm{cp}}{:=}{2}{}{Z}{}{\mathrm{ω}}{}{s}{+}{{\mathrm{ω}}}^{{2}}{+}{{s}}^{{2}}$ (3)
 • The corresponding poles are:
 > $\mathrm{poles}≔\left[\mathrm{solve}\left(\mathrm{cp},s\right)\right]$
 ${\mathrm{poles}}{:=}\left[\left({-}{Z}{+}\sqrt{{{Z}}^{{2}}{-}{1}}\right){}{\mathrm{ω}}{,}\left({-}{Z}{-}\sqrt{{{Z}}^{{2}}{-}{1}}\right){}{\mathrm{ω}}\right]$ (4)
 • Designing the state feedback controller gains ($\mathrm{Kc}$ and $\mathrm{Kr}$) by  pole placement:
 > $\mathrm{Kc1},\mathrm{Kr1}≔\mathrm{StateFeedback}:-\mathrm{PolePlacement}\left(\mathrm{sys1},\left[a,b\right],'\mathrm{return_Kr}'\right):$
 > $\mathrm{Kc1}≔\mathrm{simplify}\left(\mathrm{eval}\left(\mathrm{Kc1},\left[a={\mathrm{poles}}_{1},b={\mathrm{poles}}_{2}\right]\right)\right)$
 ${\mathrm{Kc1}}{:=}\left[\begin{array}{cc}{{\mathrm{ω}}}^{{2}}& {-}{\mathrm{α}}{}{{\mathrm{ω}}}^{{2}}{+}{2}{}{Z}{}{\mathrm{ω}}\end{array}\right]$ (5)
 > $\mathrm{Kr1}≔\mathrm{simplify}\left(\mathrm{eval}\left(\mathrm{Kr1},\left[a={\mathrm{poles}}_{1},b={\mathrm{poles}}_{2}\right]\right)\right)$
 ${\mathrm{Kr1}}{:=}\left[\begin{array}{c}{{\mathrm{ω}}}^{{2}}\end{array}\right]$ (6)
 • Designing the state observer with gain $L$ by pole placement as well.
 > $\mathrm{L1}≔\mathrm{StateObserver}:-\mathrm{PolePlacement}\left(\mathrm{sys1},\left[a,b\right]\right):$
 > $\mathrm{L1}≔\mathrm{simplify}\left(\mathrm{eval}\left(\mathrm{L1},\left[a={\mathrm{poles}}_{1},b={\mathrm{poles}}_{2}\right]\right)\right)$
 ${\mathrm{L1}}{:=}\left[\begin{array}{c}{2}{}{Z}{}{\mathrm{ω}}\\ {{\mathrm{ω}}}^{{2}}\end{array}\right]$ (7)
 • The controller-observer subsystem is obtained next. Note that the state, input, and output variables of the returned system object are renamed accordingly.
 > $\mathrm{cosys1}≔\mathrm{ControllerObserver}\left(\mathrm{sys1},\mathrm{Kc1},\mathrm{L1},':-\mathrm{Kr}'=\mathrm{Kr1}\right):$
 > $\mathrm{PrintSystem}\left(\mathrm{cosys1}\right)$
 $\left[\begin{array}{l}{\mathbf{State Space}}\\ {\mathrm{continuous}}\\ {\mathrm{1 output\left(s\right); 2 input\left(s\right); 2 state\left(s\right)}}\\ {\mathrm{inputvariable}}{=}\left[{\mathrm{y1_ref}}{}\left({t}\right){,}{\mathrm{y1_meas}}{}\left({t}\right)\right]\\ {\mathrm{outputvariable}}{=}\left[{\mathrm{u1}}{}\left({t}\right)\right]\\ {\mathrm{statevariable}}{=}\left[{\mathrm{x1_est}}{}\left({t}\right){,}{\mathrm{x2_est}}{}\left({t}\right)\right]\\ {\mathrm{a}}{=}\left[\begin{array}{cc}{-}{{\mathrm{\omega }}}^{{2}}{}{\mathrm{\alpha }}{-}{2}{}{Z}{}{\mathrm{\omega }}& {1}{-}{\mathrm{\alpha }}{}\left({-}{{\mathrm{\omega }}}^{{2}}{}{\mathrm{\alpha }}{+}{2}{}{Z}{}{\mathrm{\omega }}\right)\\ {-}{2}{}{{\mathrm{\omega }}}^{{2}}& {{\mathrm{\omega }}}^{{2}}{}{\mathrm{\alpha }}{-}{2}{}{Z}{}{\mathrm{\omega }}\end{array}\right]\\ {\mathrm{b}}{=}\left[\begin{array}{cc}{{\mathrm{\omega }}}^{{2}}{}{\mathrm{\alpha }}& {2}{}{Z}{}{\mathrm{\omega }}\\ {{\mathrm{\omega }}}^{{2}}& {{\mathrm{\omega }}}^{{2}}\end{array}\right]\\ {\mathrm{c}}{=}\left[\begin{array}{cc}{-}{{\mathrm{\omega }}}^{{2}}& {{\mathrm{\omega }}}^{{2}}{}{\mathrm{\alpha }}{-}{2}{}{Z}{}{\mathrm{\omega }}\end{array}\right]\\ {\mathrm{d}}{=}\left[\begin{array}{cc}{{\mathrm{\omega }}}^{{2}}& {0}\end{array}\right]\end{array}\right$ (8)
 • The closed-loop equations of the state feedback control system with observer are obtained using the closedloop = true option. Using stateerror = true, augment_output = true, and outputtype = de, we obtain the closed-loop equations of sys1 with state feedback controller with Kc and Kr gains and observer with gain L. The returned system object is a set of differential equations, where the differential variables are x1, x2, x1_err and x2_err, and the outputs are y1 and u1 (controller output).
 > $\mathrm{clsys1}≔\mathrm{ControllerObserver}\left(\mathrm{sys1},\mathrm{Kc1},\mathrm{L1},':-\mathrm{Kr}'=\mathrm{Kr1},':-\mathrm{closedloop}'=\mathrm{true},':-\mathrm{stateerror}'=\mathrm{true},':-\mathrm{augment_output}'=\mathrm{true},':-\mathrm{outputtype}'=\mathrm{de}\right):$
 > $\mathrm{PrintSystem}\left(\mathrm{clsys1}\right)$
 $\left[\begin{array}{l}{\mathbf{Diff. Equation}}\\ {\mathrm{continuous}}\\ {\mathrm{2 output\left(s\right); 1 input\left(s\right)}}\\ {\mathrm{inputvariable}}{=}\left[{\mathrm{y1_ref}}{}\left({t}\right)\right]\\ {\mathrm{outputvariable}}{=}\left[{\mathrm{y1}}{}\left({t}\right){,}{\mathrm{u1}}{}\left({t}\right)\right]\\ {\mathrm{de}}{=}{{}\begin{array}{l}{[}\stackrel{{\mathbf{.}}}{{\mathrm{x1}}}{}\left({t}\right){=}{{}\begin{array}{l}{-}{{\mathrm{\omega }}}^{{2}}{}{\mathrm{\alpha }}{}{\mathrm{x1}}{}\left({t}\right){+}\left({1}{-}{\mathrm{\alpha }}{}\left({-}{{\mathrm{\omega }}}^{{2}}{}{\mathrm{\alpha }}{+}{2}{}{Z}{}{\mathrm{\omega }}\right)\right){}{\mathrm{x2}}{}\left({t}\right)\\ {}{+}{{\mathrm{\omega }}}^{{2}}{}{\mathrm{\alpha }}{}{\mathrm{x1_err}}{}\left({t}\right){+}{\mathrm{\alpha }}{}\left({-}{{\mathrm{\omega }}}^{{2}}{}{\mathrm{\alpha }}{+}{2}{}{Z}{}{\mathrm{\omega }}\right){}{\mathrm{x2_err}}{}\left({t}\right)\\ {}{+}{{\mathrm{\omega }}}^{{2}}{}{\mathrm{\alpha }}{}{\mathrm{y1_ref}}{}\left({t}\right){,}\end{array}\\ {}\stackrel{{\mathbf{.}}}{{\mathrm{x2}}}{}\left({t}\right){=}{{}\begin{array}{l}{-}{{\mathrm{\omega }}}^{{2}}{}{\mathrm{x1}}{}\left({t}\right){+}\left({{\mathrm{\omega }}}^{{2}}{}{\mathrm{\alpha }}{-}{2}{}{Z}{}{\mathrm{\omega }}\right){}{\mathrm{x2}}{}\left({t}\right){+}{{\mathrm{\omega }}}^{{2}}{}{\mathrm{x1_err}}{}\left({t}\right)\\ {}\left({-}{{\mathrm{\omega }}}^{{2}}{}{\mathrm{\alpha }}{+}{2}{}{Z}{}{\mathrm{\omega }}\right){}{\mathrm{x2_err}}{}\left({t}\right){+}{{\mathrm{\omega }}}^{{2}}{}{\mathrm{y1_ref}}{}\left({t}\right){,}\end{array}\\ {}\stackrel{{\mathbf{.}}}{{\mathrm{x1_err}}}{}\left({t}\right){=}{-}{2}{}{Z}{}{\mathrm{\omega }}{}{\mathrm{x1_err}}{}\left({t}\right){+}{\mathrm{x2_err}}{}\left({t}\right){,}\\ {}\stackrel{{\mathbf{.}}}{{\mathrm{x2_err}}}{}\left({t}\right){=}{-}{{\mathrm{\omega }}}^{{2}}{}{\mathrm{x1_err}}{}\left({t}\right){,}\\ {}{\mathrm{y1}}{}\left({t}\right){=}{\mathrm{x1}}{}\left({t}\right){,}\\ {}{\mathrm{u1}}{}\left({t}\right){=}{{}\begin{array}{l}{-}{{\mathrm{\omega }}}^{{2}}{}{\mathrm{x1}}{}\left({t}\right){+}\left({{\mathrm{\omega }}}^{{2}}{}{\mathrm{\alpha }}{-}{2}{}{Z}{}{\mathrm{\omega }}\right){}{\mathrm{x2}}{}\left({t}\right){+}{{\mathrm{\omega }}}^{{2}}{}{\mathrm{x1_err}}{}\left({t}\right)\\ {}\left({-}{{\mathrm{\omega }}}^{{2}}{}{\mathrm{\alpha }}{+}{2}{}{Z}{}{\mathrm{\omega }}\right){}{\mathrm{x2_err}}{}\left({t}\right){+}{{\mathrm{\omega }}}^{{2}}{}{\mathrm{y1_ref}}{}\left({t}\right){]}\end{array}\end{array}\end{array}\right$ (9)

Example: DC motor model state feedback control with observer

 • The following DC motor example demonstrates the use of the parameters, controlled_inputs, measured_inputs, controlled_outputs and  measured_outputs options.
 > $\mathrm{a2}≔\mathrm{Matrix}\left(\left[\left[-\frac{R}{L},-\frac{K}{L},0\right],\left[\frac{K}{J},-\frac{B}{J},0\right],\left[0,1,0\right]\right]\right):$
 > $\mathrm{b2}≔\mathrm{Matrix}\left(\left[\left[\frac{1}{L},0,0\right],\left[0,-\frac{1}{J},0\right],\left[0,0,-1\right]\right]\right):$
 > $\mathrm{c2}≔\mathrm{Matrix}\left(\left[\left[1,0,0\right],\left[0,1,0\right],\left[0,0,1\right]\right]\right):$
 > $\mathrm{d2}≔\mathrm{Matrix}\left(3,3\right):$
 • The numeric values for the DC motor stator inductance $L$, stator resistance $R$, electromotive force (emf) constant $K$, rotor moment of inertia $J$, and damping ratio $B$ are given next:
 > $\mathrm{params}≔\left\{J=0.01,K=0.01,L=0.5,R=1,B=0.1\right\}:$
 • The input variables are the source voltage $V\left(t\right)$, the torque load $T\left(t\right)$ and the rotor angular speed reference $\mathrm{wref}\left(t\right)$, and the output variables are the stator current $i\left(t\right)$, the rotor angular speed $w\left(t\right)$ and the integral of the rotor speed error $z\left(t\right)$.
 > $\mathrm{sys2}≔\mathrm{StateSpace}\left(\mathrm{a2},\mathrm{b2},\mathrm{c2},\mathrm{d2},'\mathrm{inputvariable}'=\left[V\left(t\right),T\left(t\right),\mathrm{wref}\left(t\right)\right],'\mathrm{outputvariable}'=\left[i\left(t\right),w\left(t\right),z\left(t\right)\right]\right):$
 > $\mathrm{PrintSystem}\left(\mathrm{sys2}\right)$
 $\left[\begin{array}{l}{\mathbf{State Space}}\\ {\mathrm{continuous}}\\ {\mathrm{3 output\left(s\right); 3 input\left(s\right); 3 state\left(s\right)}}\\ {\mathrm{inputvariable}}{=}\left[{V}{}\left({t}\right){,}{T}{}\left({t}\right){,}{\mathrm{wref}}{}\left({t}\right)\right]\\ {\mathrm{outputvariable}}{=}\left[{i}{}\left({t}\right){,}{w}{}\left({t}\right){,}{z}{}\left({t}\right)\right]\\ {\mathrm{statevariable}}{=}\left[{\mathrm{x1}}{}\left({t}\right){,}{\mathrm{x2}}{}\left({t}\right){,}{\mathrm{x3}}{}\left({t}\right)\right]\\ {\mathrm{a}}{=}\left[\begin{array}{ccc}{-}\frac{{R}}{{L}}& {-}\frac{{K}}{{L}}& {0}\\ \frac{{K}}{{J}}& {-}\frac{{B}}{{J}}& {0}\\ {0}& {1}& {0}\end{array}\right]\\ {\mathrm{b}}{=}\left[\begin{array}{ccc}\frac{{1}}{{L}}& {0}& {0}\\ {0}& {-}\frac{{1}}{{J}}& {0}\\ {0}& {0}& {-1}\end{array}\right]\\ {\mathrm{c}}{=}\left[\begin{array}{ccc}{1}& {0}& {0}\\ {0}& {1}& {0}\\ {0}& {0}& {1}\end{array}\right]\\ {\mathrm{d}}{=}\left[\begin{array}{ccc}{0}& {0}& {0}\\ {0}& {0}& {0}\\ {0}& {0}& {0}\end{array}\right]\end{array}\right$ (10)
 • The state feedback controller and observer gains are given next:
 > $\mathrm{Kc2}≔\mathrm{Matrix}\left(\left[\left[1.89107,7.35829,70.71068\right]\right]\right):$
 > $\mathrm{Kr2}≔\mathrm{Matrix}\left(1,1\right):$
 > $\mathrm{L2}≔\mathrm{Matrix}\left(\left[\left[0.08028,-0.00148\right],\left[990.05009,0.98010\right],\left[0.98010,10.09948\right]\right]\right):$
 • The controlled input is the source voltage $V\left(t\right)$. The measured input is $\mathrm{wref}\left(t\right)$. The controlled output is $z\left(t\right)$. The measured outputs are $w\left(t\right)$ and $z\left(t\right)$.
 • The controller-observer subsystem equations are obtained next:
 > $\mathrm{cosys2}≔\mathrm{ControllerObserver}\left(\mathrm{sys2},\mathrm{Kc2},\mathrm{L2},'\mathrm{Kr}'=\mathrm{Kr2},'\mathrm{parameters}'=\mathrm{params},'\mathrm{controlled_inputs}'=\left\{1\right\},'\mathrm{measured_inputs}'=\left\{3\right\},'\mathrm{controlled_outputs}'=\left\{3\right\},'\mathrm{measured_outputs}'=\left\{2,3\right\}\right):$
 > $\mathrm{PrintSystem}\left(\mathrm{cosys2}\right)$
 $\left[\begin{array}{l}{\mathbf{State Space}}\\ {\mathrm{continuous}}\\ {\mathrm{1 output\left(s\right); 3 input\left(s\right); 3 state\left(s\right)}}\\ {\mathrm{inputvariable}}{=}\left[{\mathrm{wref}}{}\left({t}\right){,}{\mathrm{w_meas}}{}\left({t}\right){,}{\mathrm{z_meas}}{}\left({t}\right)\right]\\ {\mathrm{outputvariable}}{=}\left[{V}{}\left({t}\right)\right]\\ {\mathrm{statevariable}}{=}\left[{\mathrm{x1_est}}{}\left({t}\right){,}{\mathrm{x2_est}}{}\left({t}\right){,}{\mathrm{x3_est}}{}\left({t}\right)\right]\\ {\mathrm{a}}{=}\left[\begin{array}{ccc}{-}{5.78214}& {-}{14.81686}& {-}{141.41988}\\ {1.0}& {-}{1000.05009}& {-}{0.9801}\\ {0.0}& {0.01990000000000003}& {-}{10.09948}\end{array}\right]\\ {\mathrm{b}}{=}\left[\begin{array}{ccc}{0.}& {0.08028}& {-0.00148}\\ {0.}& {990.05009}& {0.98010}\\ {-1.}& {0.98010}& {10.09948}\end{array}\right]\\ {\mathrm{c}}{=}\left[\begin{array}{ccc}{-}{1.89107}& {-}{7.35829}& {-}{70.71068}\end{array}\right]\\ {\mathrm{d}}{=}\left[\begin{array}{ccc}{0}& {0}& {0}\end{array}\right]\end{array}\right$ (11)
 • It is also possible to obtain an LQG controller by computing LQR and Kalman gains. First, compute the weighting matrices:
 > $W≔\mathrm{ComputeQR}\left(\mathrm{sys2},0.4,'\mathrm{parameters}'=\mathrm{params}\right)$
 ${W}{:=}{\mathrm{Record}}{}\left({Q}{=}\left[\begin{array}{ccc}{1.}& {0.}& {0.}\\ {0.}& {1.}& {0.}\\ {0.}& {0.}& {1.}\end{array}\right]{,}{R}{=}\left[\begin{array}{ccc}{0.321321227565641}& {-}{0.332291362282656}& {-}{0.00321457404413542}\\ {-}{0.332291362282655}& {210.045523435307}& {1.20713539723679}\\ {-}{0.00321457404413543}& {1.20713539723679}& {0.160000000000000}\end{array}\right]\right)$ (12)
 > $\mathrm{Kc3},\mathrm{Kr3}≔\mathrm{LQR}\left(\mathrm{sys2},W:-Q,W:-R,'\mathrm{parameters}'=\mathrm{params},'\mathrm{return_Kr}'\right)$
 ${\mathrm{Kc3}}{,}{\mathrm{Kr3}}{:=}\left[\begin{array}{ccc}{1.03313325178664}& {-}{0.00143259581815793}& {0.0122156987864645}\\ {0.0000388509514481089}& {-}{0.0225671357809562}& {-}{0.000745437890855909}\\ {-}{0.0176293731317396}& {-}{0.0279650446417151}& {-}{2.49392402957048}\end{array}\right]{,}\left[\begin{array}{ccc}{2.03313325178664}& {0.00856740418184207}& {0.0122156987864645}\\ {0.0100388509514481}& {-}{0.122567135780956}& {-}{0.000745437890855909}\\ {-}{0.0176293731317396}& {0.972034955358285}& {-}{2.49392402957049}\end{array}\right]$ (13)

Then define the noise matrices and compute the Kalman gain:

 > $\mathrm{G1}≔\mathrm{LinearAlgebra}:-\mathrm{IdentityMatrix}\left(3\right):$
 > $\mathrm{H1}≔\mathrm{LinearAlgebra}:-\mathrm{ZeroMatrix}\left(3\right):$
 > $\mathrm{Q1}≔\mathrm{Matrix}\left(\left[\left[5,0,0\right],\left[0,1,0\right],\left[0,0,1\right]\right]\right):$
 > $\mathrm{R1}≔0.001\mathrm{LinearAlgebra}:-\mathrm{IdentityMatrix}\left(3\right):$
 > $\mathrm{Kgain}≔{\mathrm{Kalman}\left(\mathrm{sys2},\mathrm{G1},\mathrm{H1},\mathrm{Q1},\mathrm{R1},'\mathrm{parameters}'=\mathrm{params}\right)}_{1}$
 ${\mathrm{Kgain}}{:=}\left[\begin{array}{ccc}{68.7357198244512}& {0.656996670591518}& {0.00405274599764882}\\ {0.656996670591518}& {23.1776195213554}& {0.357647329351719}\\ {0.00405274599764882}& {0.357647329351719}& {31.6320623200853}\end{array}\right]$ (14)

Then compute LQG controller by combining the Kalman filter with LQR controller:

 > $\mathrm{LQG}≔\mathrm{ControllerObserver}\left(\mathrm{sys2},\mathrm{Kc3},\mathrm{Kgain},'\mathrm{Kr}'=\mathrm{Kr3},'\mathrm{parameters}'=\mathrm{params}\right):$
 > $\mathrm{PrintSystem}\left(\mathrm{LQG}\right)$
 $\left[\begin{array}{l}{\mathbf{State Space}}\\ {\mathrm{continuous}}\\ {\mathrm{3 output\left(s\right); 6 input\left(s\right); 3 state\left(s\right)}}\\ {\mathrm{inputvariable}}{=}\left[{\mathrm{i_ref}}{}\left({t}\right){,}{\mathrm{w_ref}}{}\left({t}\right){,}{\mathrm{z_ref}}{}\left({t}\right){,}{\mathrm{i_meas}}{}\left({t}\right){,}{\mathrm{w_meas}}{}\left({t}\right){,}{\mathrm{z_meas}}{}\left({t}\right)\right]\\ {\mathrm{outputvariable}}{=}\left[{V}{}\left({t}\right){,}{T}{}\left({t}\right){,}{\mathrm{wref}}{}\left({t}\right)\right]\\ {\mathrm{statevariable}}{=}\left[{\mathrm{x1_est}}{}\left({t}\right){,}{\mathrm{x2_est}}{}\left({t}\right){,}{\mathrm{x3_est}}{}\left({t}\right)\right]\\ {\mathrm{a}}{=}\left[\begin{array}{ccc}{-}{72.80198632802448}& {-}{0.6741314789552019}& {-}{0.028484143570577793}\\ {0.3468884245532932}& {-}{35.43433309945101}& {-}{0.4321911184373094}\\ {-}{0.021682119129388437}& {0.6143876260065664}& {-}{34.12598634965579}\end{array}\right]\\ {\mathrm{b}}{=}\left[\begin{array}{cccccc}{4.066266503573278}& {0.01713480836368414}& {0.024431397572928976}& {68.73571982445121}& {0.6569966705915177}& {0.004052745997648817}\\ {-}{1.0038850951448106}& {12.256713578095619}& {0.07454378908559092}& {0.6569966705915177}& {23.17761952135539}& {0.3576473293517185}\\ {0.017629373131739623}& {-}{0.972034955358285}& {2.4939240295704854}& {0.004052745997648817}& {0.3576473293517185}& {31.632062320085307}\end{array}\right]\\ {\mathrm{c}}{=}\left[\begin{array}{ccc}{-}{1.0331332517866387}& {0.0014325958181579282}& {-}{0.012215698786464488}\\ {-}{0.00003885095144810885}& {0.022567135780956187}& {0.0007454378908559093}\\ {0.01762937313173962}& {0.027965044641715106}& {2.493924029570485}\end{array}\right]\\ {\mathrm{d}}{=}\left[\begin{array}{cccccc}{2.03313325178663895}& {0.00856740418184206987}& {0.0122156987864644878}& {0}& {0}& {0}\\ {0.0100388509514481063}& {-0.122567135780956196}& {-0.000745437890855909276}& {0}& {0}& {0}\\ {-0.0176293731317396229}& {0.972034955358284991}& {-2.49392402957048542}& {0}& {0}& {0}\end{array}\right]\end{array}\right$ (15)