Bug Fix #14415 - Corrected some spellings error in help pages
[scilab.git] / scilab / modules / cacsd / help / en_US / observer.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4  * Copyright (C) INRIA - F. Delebecque
5  *
6  * Copyright (C) 2012 - 2016 - Scilab Enterprises
7  *
8  * This file is hereby licensed under the terms of the GNU GPL v2.0,
9  * pursuant to article 5.3.4 of the CeCILL v.2.1.
10  * This file was originally licensed under the terms of the CeCILL v2.1,
11  * and continues to be available under such terms.
12  * For more information, see the COPYING file which you should have received
13  * along with this program.
14  *
15  -->
16 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="en" xml:id="observer">
17     <refnamediv>
18         <refname>observer</refname>
19         <refpurpose>observer design</refpurpose>
20     </refnamediv>
21     <refsynopsisdiv>
22         <title>Syntax</title>
23         <synopsis>Obs=observer(Sys,J)
24             [Obs,U,m]=observer(Sys [,flag,alfa])
25         </synopsis>
26     </refsynopsisdiv>
27     <refsection>
28         <title>Arguments</title>
29         <variablelist>
30             <varlistentry>
31                 <term>Sys</term>
32                 <listitem>
33                     <para>
34                         <literal>syslin</literal> list (linear system)
35                     </para>
36                 </listitem>
37             </varlistentry>
38             <varlistentry>
39                 <term>J</term>
40                 <listitem>
41                     <para>nx x ny constant matrix (output injection matrix)</para>
42                 </listitem>
43             </varlistentry>
44             <varlistentry>
45                 <term>flag</term>
46                 <listitem>
47                     <para>
48                         character strings (<literal>'pp'</literal> or <literal>'st'</literal> (default))
49                     </para>
50                 </listitem>
51             </varlistentry>
52             <varlistentry>
53                 <term>alfa</term>
54                 <listitem>
55                     <para>location of closed-loop poles (optional parameter, default=-1)</para>
56                 </listitem>
57             </varlistentry>
58             <varlistentry>
59                 <term>Obs</term>
60                 <listitem>
61                     <para>
62                         linear system (<literal>syslin</literal> list), the observer
63                     </para>
64                 </listitem>
65             </varlistentry>
66             <varlistentry>
67                 <term>U</term>
68                 <listitem>
69                     <para>
70                         orthogonal matrix (see <literal>dt_ility</literal>)
71                     </para>
72                 </listitem>
73             </varlistentry>
74             <varlistentry>
75                 <term>m</term>
76                 <listitem>
77                     <para>
78                         integer (dimension of unstable unobservable (<literal>st</literal>)  or unobservable  (<literal>pp</literal>) subspace)
79                     </para>
80                 </listitem>
81             </varlistentry>
82         </variablelist>
83     </refsection>
84     <refsection>
85         <title>Description</title>
86         <para>
87             <literal>Obs=observer(Sys,J)</literal> returns the observer
88             <literal>Obs=syslin(td,A+J*C,[B+J*D,-J],eye(A))</literal> obtained from <literal>Sys</literal>
89             by a <literal>J</literal> output injection. (td is the time domain of <literal>Sys</literal>).
90             More generally, <literal>observer</literal> returns in <literal>Obs</literal> an observer for
91             the observable part of linear system
92             <literal>Sys</literal>: <literal>dotx=A x + Bu, y=Cx + Du</literal>  represented by a <literal>syslin</literal> list.
93             <literal>Sys</literal> has <literal>nx</literal> state variables, <literal>nu</literal> inputs and <literal>ny</literal> outputs.
94             <literal>Obs</literal> is a linear system with matrices <literal>[Ao,Bo,Identity]</literal>,
95             where <literal>Ao</literal> is <literal>no x no</literal>, <literal>Bo</literal> is <literal>no x (nu+ny)</literal>, <literal> Co</literal> is
96             <literal>no x no</literal> and <literal>no=nx-m</literal>.
97         </para>
98         <para>
99             Input to <literal>Obs</literal> is <literal>[u,y]</literal> and output of <literal>Obs</literal> is:
100         </para>
101         <para>
102             xhat=estimate of x modulo unobservable subsp. (case <literal>flag='pp'</literal>)
103             or
104         </para>
105         <para>
106             xhat=estimate of x modulo unstable unobservable subsp. (case <literal>flag='st'</literal>)
107         </para>
108         <para>
109             case <literal>flag='st'</literal>:
110             z=H*x can be estimated with stable observer iff <literal>H*U(:,1:m)=0</literal>
111             and assignable poles of the observer are set to <literal>alfa(1),alfa(2),...</literal>
112         </para>
113         <para>
114             case <literal>flag='pp'</literal>:
115             z=H*x can be estimated with given error spectrum iff <literal>H*U(:,1:m)=0</literal>
116             all poles of the observer are assigned and set to <literal>alfa(1),alfa(2),...</literal>
117         </para>
118         <para>
119             If H satisfies the constraint: <literal>H*U(:,1:m)=0</literal>  (ker(H) contains unobs-subsp.
120             of Sys) one has H*U=[0,H2] and the observer for
121             z=H*x is H2*Obs with H2=H*U(:,m+1:nx) i.e. Co, the C-matrix of the
122             observer for H*x, is Co=H2.
123         </para>
124         <para>
125             In the particular case where the pair <literal>(A,C)</literal> of <literal>Sys</literal> is
126             observable, one has <literal>m=0</literal> and the linear system <literal>U*Obs</literal> (resp.
127             <literal>H*U*Obs</literal>) is an observer for <literal>x</literal> (resp. <literal>Hx</literal>).
128             The error spectrum is <literal>alpha(1),alpha(2),...,alpha(nx)</literal>.
129         </para>
130     </refsection>
131     <refsection>
132         <title>Examples</title>
133         <programlisting role="example"><![CDATA[
134 nx=5;nu=1;ny=1;un=3;us=2;Sys=ssrand(ny,nu,nx,list('dt',us,us,un));
135 //nx=5 states, nu=1 input, ny=1 output,
136 //un=3 unobservable states, us=2 of them unstable.
137 [Obs,U,m]=observer(Sys);  //Stable observer (default)
138 W=U';H=W(m+1:nx,:);[A,B,C,D]=abcd(Sys);  //H*U=[0,eye(no,no)];
139 Sys2=ss2tf(syslin('c',A,B,H))  //Transfer u-->z
140 Idu=eye(nu,nu);Sys3=ss2tf(H*U(:,m+1:$)*Obs*[Idu;Sys])
141 //Transfer u-->[u;y=Sys*u]-->Obs-->xhat-->HUxhat=zhat  i.e. u-->output of Obs
142 //this transfer must equal Sys2, the u-->z transfer  (H2=eye).
143
144 //Assume a Kalman model
145 //dotx = A x + B u + G w
146 // y   = C x + D u + H w + v
147 //with Eww' = QN, Evv' = RN, Ewv' = NN
148 //To build a Kalman observer:
149 //1-Form BigR = [G*QN*G'         G*QN*H'+G*NN;
150 //               H*QN*G'+NN*G'   H*QN*H'+RN];
151 //the covariance matrix of the noise vector [Gw;Hw+v]
152 //2-Build the plant P21 : dotx = A x + B1 e ; y = C2 x + D21 e
153 //with e a unit white noise.
154 // [W,Wt]=fullrf(BigR);
155 //B1=W(1:size(G,1),:);D21=W(($+1-size(C,1)):$,:);
156 //C2=C;
157 //P21=syslin('c',A,B1,C2,D21);
158 //3-Compute the Kalman gain
159 //L = lqe(P21);
160 //4- Build an observer for the plant [A,B,C,D];
161 //Plant = syslin('c',A,B,C,D);
162 //Obs = observer(Plant,L);
163 //Test example:
164 A=-diag(1:4);
165 B=ones(4,1);
166 C=B'; D= 0; G=2*B; H=-3; QN=2;
167 RN=5; NN=0;
168 BigR = [G*QN*G'         G*QN*H'+G*NN;
169         H*QN*G'+NN*G'   H*QN*H'+RN];
170 [W,Wt]=fullrf(BigR);
171 B1=W(1:size(G,1),:);D21=W(($+1-size(C,1)):$,:);
172 C2=C;
173 P21=syslin('c',A,B1,C2,D21);
174 L = lqe(P21);
175 Plant = syslin('c',A,B,C,D);
176 Obs = observer(Plant,L);
177 spec(Obs.A)
178  ]]></programlisting>
179     </refsection>
180     <refsection role="see also">
181         <title>See Also</title>
182         <simplelist type="inline">
183             <member>
184                 <link linkend="dt_ility">dt_ility</link>
185             </member>
186             <member>
187                 <link linkend="unobs">unobs</link>
188             </member>
189             <member>
190                 <link linkend="stabil">stabil</link>
191             </member>
192         </simplelist>
193     </refsection>
194 </refentry>