License Header change: Removed the LICENSE_END before beta
[scilab.git] / scilab / modules / cacsd / help / en_US / findBD.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 - 
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="findBD">
17     <refnamediv>
18         <refname>findBD</refname>
19         <refpurpose>initial state and system matrices B and D of a discrete-time system</refpurpose>
20     </refnamediv>
21     <refsynopsisdiv>
22         <title>Calling Sequence</title>
23         <synopsis>[[x0] [,B [,D]] [,V] [,rcnd]] = findBD(jobx0,comuse [,job],A [,B],C [,D],Y [,U,tol,printw,ldwork])</synopsis>
24     </refsynopsisdiv>
25     <refsection>
26         <title>Arguments</title>
27         <variablelist>
28             <varlistentry>
29                 <term>jobx0</term>
30                 <listitem>
31                     <para>integer option to specify whether or not the initial state  should be computed:</para>
32                     <variablelist>
33                         <varlistentry>
34                             <term>=  </term>
35                             <listitem>
36                                 <para>1 : compute the initial state x0;</para>
37                             </listitem>
38                         </varlistentry>
39                         <varlistentry>
40                             <term>=  </term>
41                             <listitem>
42                                 <para>2 : do not compute the initial state (possibly, because x0 is known to be zero).</para>
43                             </listitem>
44                         </varlistentry>
45                     </variablelist>
46                 </listitem>
47             </varlistentry>
48             <varlistentry>
49                 <term>comuse</term>
50                 <listitem>
51                     <para>integer option to specify whether the system matrices B and D should be computed or used:</para>
52                     <variablelist>
53                         <varlistentry>
54                             <term>=  </term>
55                             <listitem>
56                                 <para>1 : compute the matrices B and D, as specified by job;</para>
57                             </listitem>
58                         </varlistentry>
59                         <varlistentry>
60                             <term>=  </term>
61                             <listitem>
62                                 <para>2 : use the matrices B and D, as specified by job;</para>
63                             </listitem>
64                         </varlistentry>
65                         <varlistentry>
66                             <term>=  </term>
67                             <listitem>
68                                 <para>3 : do not compute/use the matrices B and D.</para>
69                             </listitem>
70                         </varlistentry>
71                     </variablelist>
72                 </listitem>
73             </varlistentry>
74             <varlistentry>
75                 <term>job</term>
76                 <listitem>
77                     <para>integer option to determine which of the system matrices B and D should be computed or used:</para>
78                     <variablelist>
79                         <varlistentry>
80                             <term>=  </term>
81                             <listitem>
82                                 <para>1 : compute/use the matrix B only (D is known to be zero);</para>
83                             </listitem>
84                         </varlistentry>
85                         <varlistentry>
86                             <term>=  </term>
87                             <listitem>
88                                 <para>2 : compute/use the matrices B and D.</para>
89                             </listitem>
90                         </varlistentry>
91                     </variablelist>
92                     <para>
93                         job must not be specified if jobx0 = 2 and comuse = 2, or if comuse = 3.
94                     </para>
95                 </listitem>
96             </varlistentry>
97             <varlistentry>
98                 <term>A</term>
99                 <listitem>
100                     <para>state matrix of the given system</para>
101                 </listitem>
102             </varlistentry>
103             <varlistentry>
104                 <term>B</term>
105                 <listitem>
106                     <para>optional, input matrix of the given system</para>
107                 </listitem>
108             </varlistentry>
109             <varlistentry>
110                 <term>C</term>
111                 <listitem>
112                     <para>output matrix of the given system</para>
113                 </listitem>
114             </varlistentry>
115             <varlistentry>
116                 <term>D</term>
117                 <listitem>
118                     <para>optional, direct feedthrough of the given system</para>
119                 </listitem>
120             </varlistentry>
121             <varlistentry>
122                 <term>Y</term>
123                 <listitem>
124                     <para>the t-by-l output-data sequence matrix.  Column  j  of  Y  contains the  t  values of the j-th output component for consecutive time increments.</para>
125                 </listitem>
126             </varlistentry>
127             <varlistentry>
128                 <term>U</term>
129                 <listitem>
130                     <para>the t-by-m input-data sequence matrix (input when jobx0 = 1  and comuse = 2, or comuse = 1).  Column  j  of  U  contains the  t  values of the j-th input component for consecutive time increments.</para>
131                 </listitem>
132             </varlistentry>
133             <varlistentry>
134                 <term>tol</term>
135                 <listitem>
136                     <para>optional, tolerance used for estimating the rank of
137                         matrices. If  tol &gt; 0,  then the given value of  tol  is used as
138                         a lower bound for the reciprocal condition number; an m-by-n matrix
139                         whose estimated condition number is less than  1/tol  is considered
140                         to be of full rank. Default:    m*n*epsilon_machine where
141                         epsilon_machine is the relative machine precision.
142                     </para>
143                 </listitem>
144             </varlistentry>
145             <varlistentry>
146                 <term>printw</term>
147                 <listitem>
148                     <para>optional, switch for printing the warning messages.</para>
149                     <variablelist>
150                         <varlistentry>
151                             <term>=  </term>
152                             <listitem>
153                                 <para>1:  print warning messages;</para>
154                             </listitem>
155                         </varlistentry>
156                         <varlistentry>
157                             <term>=  </term>
158                             <listitem>
159                                 <para>0:  do not print warning messages.</para>
160                             </listitem>
161                         </varlistentry>
162                     </variablelist>
163                     <para>
164                         Default:    printw = 0.
165                     </para>
166                 </listitem>
167             </varlistentry>
168             <varlistentry>
169                 <term>ldwork</term>
170                 <listitem>
171                     <para>(optional) the workspace size. Default :   computed by the formula LDWORK = MAX( minimum workspace size needed, 2*CSIZE/3, CSIZE - ( m + l )*t - 2*n*( n + m + l ) - l*m ) where CSIZE is the cache size in double precision words.</para>
172                 </listitem>
173             </varlistentry>
174             <varlistentry>
175                 <term>x0</term>
176                 <listitem>
177                     <para>initial state vector</para>
178                 </listitem>
179             </varlistentry>
180             <varlistentry>
181                 <term>Br</term>
182                 <listitem>
183                     <para>system input matrix</para>
184                 </listitem>
185             </varlistentry>
186             <varlistentry>
187                 <term>Dr</term>
188                 <listitem>
189                     <para>system direct feedthrough matrix</para>
190                 </listitem>
191             </varlistentry>
192             <varlistentry>
193                 <term>V</term>
194                 <listitem>
195                     <para>the n-by-n orthogonal matrix which reduces A to a real Schur form (output when jobx0 = 1 or comuse = 1).</para>
196                 </listitem>
197             </varlistentry>
198             <varlistentry>
199                 <term>rcnd</term>
200                 <listitem>
201                     <para>(optional) the reciprocal condition numbers of the matrices involved in rank decisions.</para>
202                 </listitem>
203             </varlistentry>
204         </variablelist>
205     </refsection>
206     <refsection>
207         <title>Description</title>
208         <para>
209             findBD  function for estimating the initial state and the system
210             matrices B and D of a discrete-time system, using SLICOT routine 
211             IB01CD.
212         </para>
213         <programlisting role=""><![CDATA[ 
214    [x0,Br,V,rcnd] = findBD(1,1,1,A,C,Y,U)
215 [x0,Br,Dr,V,rcnd] = findBD(1,1,2,A,C,Y,U)
216       [Br,V,rcnd] = findBD(2,1,1,A,C,Y,U)
217     [B,Dr,V,rcnd] = findBD(2,1,2,A,C,Y,U)
218       [x0,V,rcnd] = findBD(1,2,1,A,B,C,Y,U)
219       [x0,V,rcnd] = findBD(1,2,2,A,B,C,D,Y,U)
220         [x0,rcnd] = findBD(2,2)      // (Set x0 = 0, rcnd = 1)
221       [x0,V,rcnd] = findBD(1,3,A,C,Y)
222  ]]></programlisting>
223         <para>
224             Note: the example lines above may contain at the end the parameters
225             tol, printw, ldwork.
226         </para>
227         <para>
228             FINDBD estimates the initial state and/or the system matrices Br and Dr
229             of a discrete-time system, given the system matrices A, C, and possibly
230             B, D, and the input and output trajectories of the system.
231         </para>
232         <para>
233             The model structure is :
234         </para>
235         <programlisting role=""><![CDATA[ 
236 x(k+1) = Ax(k) + Bu(k),   k >= 1,
237 y(k)   = Cx(k) + Du(k),
238  ]]></programlisting>
239         <para>
240             where 
241             
242             x(k)  is the  n-dimensional state vector (at time k),
243         </para>
244         <para>
245             u(k)  is the  m-dimensional input vector,
246         </para>
247         <para>
248             y(k)  is the  l-dimensional output vector,
249         </para>
250         <para>
251             and  A, B, C, and D  are real matrices of appropriate dimensions.
252         </para>
253     </refsection>
254     <refsection>
255         <title>Comments</title>
256         <variablelist>
257             <varlistentry>
258                 <term>1.</term>
259                 <listitem>
260                     <para>The n-by-m system input matrix B is an input parameter when jobx0 = 1  and comuse = 2, and it is an output parameter when comuse = 1.</para>
261                 </listitem>
262             </varlistentry>
263             <varlistentry>
264                 <term>2.</term>
265                 <listitem>
266                     <para>The l-by-m system matrix D is an input parameter when jobx0 = 1,  comuse = 2 and job = 2, and it is an output parameter when comuse = 1  and job = 2.</para>
267                 </listitem>
268             </varlistentry>
269             <varlistentry>
270                 <term>3.</term>
271                 <listitem>
272                     <para>The n-vector of estimated initial state x(0) is an output parameter when jobx0 = 1, but also when jobx0 = 2 and comuse &lt;= 2, in which case it is set to 0.</para>
273                 </listitem>
274             </varlistentry>
275             <varlistentry>
276                 <term>4.</term>
277                 <listitem>
278                     <para>If ldwork is specified, but it is less than the minimum workspace size  needed, that minimum value is used instead.</para>
279                 </listitem>
280             </varlistentry>
281         </variablelist>
282     </refsection>
283     <refsection>
284         <title>Examples</title>
285         <programlisting role="example"><![CDATA[ 
286 //generate data from a given linear system
287 A = [ 0.5, 0.1,-0.1, 0.2;
288       0.1, 0,  -0.1,-0.1;
289      -0.4,-0.6,-0.7,-0.1;
290       0.8, 0,  -0.6,-0.6];
291 B = [0.8;0.1;1;-1];
292 C = [1 2 -1 0];
293 SYS=syslin(0.1,A,B,C);
294 nsmp=100;
295 U=prbs_a(nsmp,nsmp/5);
296 Y=(flts(U,SYS)+0.3*rand(1,nsmp,'normal'));
297
298 // Compute R
299 S=15;L=1;
300 [R,N,SVAL] = findR(S,Y',U');
301
302 N=3;
303 METH=3;TOL=-1;
304 [A,C] = findAC(S,N,L,R,METH,TOL);
305 [X0,B,D] = findBD(1,1,2,A,C,Y',U')
306 SYS1=syslin(1,A,B,C,D,X0);
307
308 Y1=flts(U,SYS1);
309 clf();plot2d((1:nsmp)',[Y',Y1'])
310 ]]></programlisting>
311     </refsection>
312     <refsection role="see also">
313         <title>See Also</title>
314         <simplelist type="inline">
315             <member>
316                 <link linkend="inistate">inistate</link>
317             </member>
318             <member>
319                 <link linkend="findx0BD">findx0BD</link>
320             </member>
321             <member>
322                 <link linkend="findABCD">findABCD</link>
323             </member>
324             <member>
325                 <link linkend="findAC">findAC</link>
326             </member>
327             <member>
328                 <link linkend="findBD">findBD</link>
329             </member>
330         </simplelist>
331     </refsection>
332 </refentry>