ControlDesign[StateObserver]

 Observer
 construct the static gain (Luenberger) observer for a given system and observer gain

 Calling Sequence Observer(sys, L, opts)

Parameters

 sys - System; system object; L - Matrix or Vector; observer gain opts - (optional) equation(s) of the form option = value; specify options for the Observer command

Options

 • 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 Observer command constructs the static gain (Luenberger) observer for the given system sys and observer gain L.
 • The system sys is a continuous or discrete-time linear system object created using the DynamicSystems package. The system object must be in state-space (SS) form.
 • All sys inputs are assumed known (deterministic), and all sys outputs are assumed to be measured.
 • The Observer command returns the observer object in the state-space form. The observer system object gets the input(s) and output(s) of sys as inputs and generates the estimates of the state(s) and output(s) of sys as its outputs.
 • Suppose the sys state-space realization is given as

$\begin{array}{c}\stackrel{\cdot }{x}=\mathrm{Ax}+\mathrm{Bu}\\ y=\mathrm{Cx}+\mathrm{Du}\end{array}$

The observer equations are given by

$\stackrel{\cdot }{\stackrel{ˆ}{x}}=\left(A-\mathrm{LC}\right)\stackrel{^}{x}+\left[\begin{array}{cc}B-\mathrm{LD}& L\end{array}\right]\left[\begin{array}{c}u\\ y\end{array}\right]$

$\left[\begin{array}{c}\stackrel{^}{x}\\ \stackrel{^}{y}\end{array}\right]=\left[\begin{array}{c}I\\ C\end{array}\right]\stackrel{^}{x}+\left[\begin{array}{cc}0& 0\\ \mathrm{D}& 0\end{array}\right]\left[\begin{array}{c}u\\ y\end{array}\right]$

 • In the discrete-time domain, the Observer command uses the same state-space matrices as in the continuous-time case to generate estimates for state(s) $x\left[\begin{array}{c}n\end{array}\right]$ and output(s) $y\left[\begin{array}{c}n\end{array}\right]$ as $\stackrel{^}{x}\left[\begin{array}{c}n\end{array}|n-1\right]$ and $\stackrel{^}{y}\left[\begin{array}{c}n\end{array}|n-1\right]$, respectively, based on the past measurements up to $y\left[\begin{array}{c}\mathrm{n-1}\end{array}\right]$. The sampling time of the generated observer object is the same as the sampling time of the system sys.

Examples

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

State-space system in continuous time (5 states, 3 inputs and 2 outputs)

 > $\mathrm{Amat}≔\mathrm{Matrix}\left(\left[\left[1,-2,3,-5,12\right],\left[0,4,-1,2,-3\right],\left[2,5,7,-4,3\right],\left[-2,4,3,8,7\right],\left[19,14,1,-4,7\right]\right]\right):$
 > $\mathrm{Bmat}≔\mathrm{Matrix}\left(\left[\left[3,6,3\right],\left[9,7,5\right],\left[5,2,1\right],\left[4,-1,7\right],\left[6,-8,2\right]\right]\right):$
 > $\mathrm{Cmat}≔\mathrm{Matrix}\left(\left[\left[3,9,5,4,6\right],\left[1,0,-4,5,7\right]\right]\right):$
 > $\mathrm{Dmat}≔\mathrm{Matrix}\left(\left[\left[1,-2,0\right],\left[3,0,-1\right]\right]\right):$
 > $\mathrm{sys}≔\mathrm{StateSpace}\left(\mathrm{Amat},\mathrm{Bmat},\mathrm{Cmat},\mathrm{Dmat}\right):$
 > $\mathrm{PrintSystem}\left(\mathrm{sys}\right)$
 $\left[\begin{array}{l}{\mathbf{State Space}}\\ {\mathrm{continuous}}\\ {\mathrm{2 output\left(s\right); 3 input\left(s\right); 5 state\left(s\right)}}\\ {\mathrm{inputvariable}}{=}\left[{\mathrm{u1}}{}\left({t}\right){,}{\mathrm{u2}}{}\left({t}\right){,}{\mathrm{u3}}{}\left({t}\right)\right]\\ {\mathrm{outputvariable}}{=}\left[{\mathrm{y1}}{}\left({t}\right){,}{\mathrm{y2}}{}\left({t}\right)\right]\\ {\mathrm{statevariable}}{=}\left[{\mathrm{x1}}{}\left({t}\right){,}{\mathrm{x2}}{}\left({t}\right){,}{\mathrm{x3}}{}\left({t}\right){,}{\mathrm{x4}}{}\left({t}\right){,}{\mathrm{x5}}{}\left({t}\right)\right]\\ {\mathrm{a}}{=}\left[\begin{array}{ccccc}{1}& {-2}& {3}& {-5}& {12}\\ {0}& {4}& {-1}& {2}& {-3}\\ {2}& {5}& {7}& {-4}& {3}\\ {-2}& {4}& {3}& {8}& {7}\\ {19}& {14}& {1}& {-4}& {7}\end{array}\right]\\ {\mathrm{b}}{=}\left[\begin{array}{ccc}{3}& {6}& {3}\\ {9}& {7}& {5}\\ {5}& {2}& {1}\\ {4}& {-1}& {7}\\ {6}& {-8}& {2}\end{array}\right]\\ {\mathrm{c}}{=}\left[\begin{array}{ccccc}{3}& {9}& {5}& {4}& {6}\\ {1}& {0}& {-4}& {5}& {7}\end{array}\right]\\ {\mathrm{d}}{=}\left[\begin{array}{ccc}{1}& {-2}& {0}\\ {3}& {0}& {-1}\end{array}\right]\end{array}\right$ (1)

Desired observer poles

 > $p≔\left[-3,-4,-5+3I,-5-3I,-7\right]:$

Get the observer gain Matrix L for the desired poles

 > $L≔\mathrm{StateObserver}:-\mathrm{PolePlacement}\left(\mathrm{sys},p\right)$
 ${L}{≔}\left[\begin{array}{cc}{5.61387999503207}& {4.25288865156742}\\ {-}{3.33851876208656}& {-}{2.63895066630918}\\ {2.08444493183947}& {0.857378214523436}\\ {-}{0.743810167611436}& {-}{0.297617195815003}\\ {5.06290232118362}& {3.86362016334714}\end{array}\right]$ (2)

Construct the observer object for sys with gain L

 > $\mathrm{Obsv}≔\mathrm{StateObserver}:-\mathrm{Observer}\left(\mathrm{sys},L\right):$
 > $\mathrm{PrintSystem}\left(\mathrm{Obsv}\right)$
 $\left[\begin{array}{l}{\mathbf{State Space}}\\ {\mathrm{continuous}}\\ {\mathrm{7 output\left(s\right); 5 input\left(s\right); 5 state\left(s\right)}}\\ {\mathrm{inputvariable}}{=}\left[{\mathrm{u1}}{}\left({t}\right){,}{\mathrm{u2}}{}\left({t}\right){,}{\mathrm{u3}}{}\left({t}\right){,}{\mathrm{y1}}{}\left({t}\right){,}{\mathrm{y2}}{}\left({t}\right)\right]\\ {\mathrm{outputvariable}}{=}\left[{\mathrm{x1_obs_out}}{}\left({t}\right){,}{\mathrm{x2_obs_out}}{}\left({t}\right){,}{\mathrm{x3_obs_out}}{}\left({t}\right){,}{\mathrm{x4_obs_out}}{}\left({t}\right){,}{\mathrm{x5_obs_out}}{}\left({t}\right){,}{\mathrm{y1}}{}\left({t}\right){,}{\mathrm{y2}}{}\left({t}\right)\right]\\ {\mathrm{statevariable}}{=}\left[{\mathrm{x1_obs}}{}\left({t}\right){,}{\mathrm{x2_obs}}{}\left({t}\right){,}{\mathrm{x3_obs}}{}\left({t}\right){,}{\mathrm{x4_obs}}{}\left({t}\right){,}{\mathrm{x5_obs}}{}\left({t}\right)\right]\\ {\mathrm{a}}{=}\left[\begin{array}{ccccc}{-}{20.09452863666364}& {-}{52.524919955288645}& {-}{8.057845368890664}& {-}{48.7199632379654}& {-}{51.453500531164394}\\ {12.65450695256885}& {34.04666885877901}& {5.136791145196058}& {28.54882837989213}& {35.5037672366836}\\ {-}{5.110713010041854}& {-}{13.760004386555252}& {0.007288198896379328}& {-}{16.62467079997507}& {-}{15.508317092700885}\\ {0.5290476986493102}& {10.694291508502921}& {5.528582054797168}& {12.463326649520756}& {13.546181376373633}\\ {-}{0.05232712689801389}& {-}{31.566120890652613}& {-}{8.86003095252955}& {-}{43.56971010147021}& {-}{50.422755070531736}\end{array}\right]\\ {\mathrm{b}}{=}\left[\begin{array}{ccccc}{-}{15.372545949734342}& {17.227759990064143}& {7.252888651567424}& {5.613879995032072}& {4.252888651567424}\\ {20.2553707610141}& {0.32296247582688764}& {2.361049333690819}& {-}{3.338518762086556}& {-}{2.638950666309181}\\ {0.34342042459021993}& {6.168889863678945}& {1.8573782145234357}& {2.0844449318394727}& {0.8573782145234358}\\ {5.636661755056444}& {-}{2.4876203352228714}& {6.702382804184998}& {-}{0.7438101676114358}& {-}{0.2976171958150027}\\ {-}{10.65376281122505}& {2.125804642367248}& {5.863620163347143}& {5.062902321183624}& {3.8636201633471425}\end{array}\right]\\ {\mathrm{c}}{=}\left[\begin{array}{ccccc}{1}& {0}& {0}& {0}& {0}\\ {0}& {1}& {0}& {0}& {0}\\ {0}& {0}& {1}& {0}& {0}\\ {0}& {0}& {0}& {1}& {0}\\ {0}& {0}& {0}& {0}& {1}\\ {3}& {9}& {5}& {4}& {6}\\ {1}& {0}& {-4}& {5}& {7}\end{array}\right]\\ {\mathrm{d}}{=}\left[\begin{array}{ccccc}{0}& {0}& {0}& {0}& {0}\\ {0}& {0}& {0}& {0}& {0}\\ {0}& {0}& {0}& {0}& {0}\\ {0}& {0}& {0}& {0}& {0}\\ {0}& {0}& {0}& {0}& {0}\\ {1}& {-2}& {0}& {0}& {0}\\ {3}& {0}& {-1}& {0}& {0}\end{array}\right]\end{array}\right$ (3)