summaryrefslogtreecommitdiff
path: root/modules/cacsd/help/en_US/findABCD.xml
blob: 949d9a335b5d1c72813864c3e9d19ae32fae0764 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
<?xml version="1.0" encoding="UTF-8"?>
<!--
 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
 * Copyright (C) INRIA - 
 * 
 * This file must be used under the terms of the CeCILL.
 * This source file is licensed as described in the file COPYING, which
 * you should have received as part of this distribution.  The terms
 * are also available at    
 * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
 *
 -->
<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="findABCD">
    <refnamediv>
        <refname>findABCD</refname>
        <refpurpose>discrete-time system subspace identification</refpurpose>
    </refnamediv>
    <refsynopsisdiv>
        <title>Calling Sequence</title>
        <synopsis>[SYS,K] = findABCD(S,N,L,R,METH,NSMPL,TOL,PRINTW)
            SYS = findABCD(S,N,L,R,METH)
            
            [SYS,K,Q,Ry,S,RCND] = findABCD(S,N,L,R,METH,NSMPL,TOL,PRINTW)
            [SYS,RCND] = findABCD(S,N,L,R,METH)
        </synopsis>
    </refsynopsisdiv>
    <refsection>
        <title>Arguments</title>
        <variablelist>
            <varlistentry>
                <term>S</term>
                <listitem>
                    <para>integer, the number of block rows in the block-Hankel matrices</para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>N</term>
                <listitem>
                    <para>integer, the system order</para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>L</term>
                <listitem>
                    <para>integer, the number of output</para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>R</term>
                <listitem>
                    <para>matrix, relevant part of the  R factor of the concatenated block-Hankel matrices computed by a call to findr.</para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>METH</term>
                <listitem>
                    <para>integer, an option for the method to use</para>
                    <variablelist>
                        <varlistentry>
                            <term>= 1</term>
                            <listitem>
                                <para> MOESP method with past inputs and outputs;</para>
                            </listitem>
                        </varlistentry>
                        <varlistentry>
                            <term>= 2</term>
                            <listitem>
                                <para> N4SID method;</para>
                            </listitem>
                        </varlistentry>
                        <varlistentry>
                            <term>= 3</term>
                            <listitem>
                                <para> combined method: A and C via MOESP, B and D via N4SID.</para>
                            </listitem>
                        </varlistentry>
                    </variablelist>
                    <para>
                        Default:    METH = 3.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>NSMPL</term>
                <listitem>
                    <para>integer, the total number of samples used for calculating the covariance matrices and the Kalman predictor gain. This parameter is not needed if the covariance matrices and/or the Kalman predictor gain matrix are not desired. If NSMPL = 0, then K, Q, Ry, and S are not computed. Default:    NSMPL = 0.</para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>TOL</term>
                <listitem>
                    <para>the tolerance used for estimating the rank of matrices.  If  TOL &gt; 0,  then the given value of  TOL  is used as a lower bound for the reciprocal condition number. Default: prod(size(matrix))*epsilon_machine where epsilon_machine is the relative machine precision.</para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>PRINTW</term>
                <listitem>
                    <para>integer, switch for printing the warning messages.</para>
                    <variablelist>
                        <varlistentry>
                            <term>PRINTW</term>
                            <listitem>
                                <para>= 1: print warning messages;</para>
                            </listitem>
                        </varlistentry>
                        <varlistentry>
                            <term>PRINTW</term>
                            <listitem>
                                <para>= 0: do not print warning messages.</para>
                            </listitem>
                        </varlistentry>
                    </variablelist>
                    <para>
                        Default:    PRINTW = 0.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>SYS</term>
                <listitem>
                    <para>computes a state-space realization SYS = (A,B,C,D) (an syslin object)</para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>K</term>
                <listitem>
                    <para>the Kalman predictor gain K (if NSMPL &gt; 0)</para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>Q</term>
                <listitem>
                    <para> state covariance</para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>Ry</term>
                <listitem>
                    <para>output covariance</para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>S</term>
                <listitem>
                    <para>state-output cross-covariance</para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>RCND</term>
                <listitem>
                    <para>vector, reciprocal condition numbers of the matrices involved in rank decisions, least squares or Riccati equation solutions</para>
                </listitem>
            </varlistentry>
        </variablelist>
    </refsection>
    <refsection>
        <title>Description</title>
        <para>
            Finds the system matrices and the Kalman gain of a discrete-time 
            system, given the system order and the relevant part of the 
            R factor of the concatenated block-Hankel matrices, using subspace 
            identification techniques (MOESP and/or N4SID).
        </para>
        <itemizedlist>
            <listitem>
                <para>[SYS,K] = findABCD(S,N,L,R,METH,NSMPL,TOL,PRINTW)  computes a state- space realization SYS = (A,B,C,D) (an ss object), and the Kalman predictor gain K (if NSMPL &gt; 0). The model structure is:</para>
                <programlisting role=""><![CDATA[ 
x(k+1) = Ax(k) + Bu(k) + Ke(k),   k >= 1,
y(k)   = Cx(k) + Du(k) + e(k),
 ]]></programlisting>
                <para>
                    where x(k) and y(k) are vectors of length N and L, respectively.
                </para>
            </listitem>
            <listitem>
                <para>[SYS,K,Q,Ry,S,RCND] = findABCD(S,N,L,R,METH,NSMPL,TOL,PRINTW)  also returns the state, output, and state-output (cross-)covariance matrices Q, Ry, and S (used for computing the Kalman gain), as well as the vector RCND of length lr containing the reciprocal condition numbers of the matrices involved in rank decisions, least squares or Riccati equation solutions, where</para>
            </listitem>
        </itemizedlist>
        <programlisting role=""><![CDATA[ 
lr = 4,  if Kalman gain matrix K is not required, and
lr = 12, if Kalman gain matrix K is required.
 ]]></programlisting>
        <para>
            Matrix R, computed by findR, should be determined with suitable arguments
            METH and JOBD.  METH = 1 and JOBD = 1 must be used in findR, for METH = 1 
            in findABCD;  METH = 1 must be used in findR, for METH = 3 in findABCD.
        </para>
    </refsection>
    <refsection>
        <title>Examples</title>
        <programlisting role="example"><![CDATA[ 
//generate data from a given linear system
A = [ 0.5, 0.1,-0.1, 0.2;
      0.1, 0,  -0.1,-0.1;      
     -0.4,-0.6,-0.7,-0.1;  
      0.8, 0,  -0.6,-0.6];      
B = [0.8;0.1;1;-1];
C = [1 2 -1 0];
SYS=syslin(0.1,A,B,C);
nsmp=100;
U=prbs_a(nsmp,nsmp/5);
Y=(flts(U,SYS)+0.3*rand(1,nsmp,'normal'));

// Compute R
S=15;
[R,N1,SVAL] = findR(S,Y',U');
N=3;
SYS1 = findABCD(S,N,1,R) ;SYS1.dt=0.1;

SYS1.X0 = inistate(SYS1,Y',U');

Y1=flts(U,SYS1);
clf();plot2d((1:nsmp)',[Y',Y1'])
]]></programlisting>
    </refsection>
    <refsection role="see also">
        <title>See Also</title>
        <simplelist type="inline">
            <member>
                <link linkend="findAC">findAC</link>
            </member>
            <member>
                <link linkend="findBD">findBD</link>
            </member>
            <member>
                <link linkend="findBDK">findBDK</link>
            </member>
            <member>
                <link linkend="findR">findR</link>
            </member>
            <member>
                <link linkend="sorder">sorder</link>
            </member>
            <member>
                <link linkend="sident">sident</link>
            </member>
        </simplelist>
    </refsection>
</refentry>