13
13
<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" version="5.0-subset Scilab" xml:lang="en" xml:id="findBDK">
15
<refname>findBDK</refname>
16
<refpurpose> Kalman gain and B D system matrices of a discrete-time system</refpurpose>
19
<title>Calling Sequence</title>
20
<synopsis>[B,D,K] = findBDK(S,N,L,R,A,C,METH,JOB,NSMPL,TOL,PRINTW)
21
[B,D,RCND] = findBDK(S,N,L,R,A,C,METH,JOB)
22
[B,D,K,Q,Ry,S,RCND] = findBDK(S,N,L,R,A,C,METH,JOB,NSMPL,TOL,PRINTW)
26
<title>Arguments</title>
31
<para>integer, the number of block rows in the block-Hankel matrices</para>
49
<para>matrix, relevant part of the R factor of the concatenated block-Hankel matrices computed by a call to findR.</para>
55
<para>square matrix</para>
67
<para>integer, an option for the method to use</para>
72
<para> MOESP method with past inputs and outputs;</para>
78
<para> N4SID method;</para>
90
<para>an option specifying which system matrices should be computed:</para>
95
<para> compute the matrix B;</para>
101
<para> compute the matrices B and D.</para>
113
<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>
119
<para>the tolerance used for estimating the rank of matrices. If TOL > 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>
125
<para>integer, switch for printing the warning messages.</para>
130
<para>= 1: print warning messages;</para>
136
<para>= 0: do not print warning messages.</para>
148
<para>computes a state-space realization SYS = (A,B,C,D) (an syslin object)</para>
154
<para>the Kalman predictor gain K (if NSMPL > 0)</para>
160
<para> state covariance</para>
166
<para>output covariance</para>
172
<para>state-output cross-covariance</para>
178
<para>he vector of length 12 containing the reciprocal condition numbers of the matrices involved in rank decisions, least squares or Riccati equation solutions.</para>
184
<title>Description</title>
186
finds the system matrices B and D and the Kalman gain of a discrete-time
187
system, given the system order, the matrices A and C, and the relevant
188
part of the R factor of the concatenated block-Hankel matrices, using
189
subspace identification techniques (MOESP or N4SID).
193
<para>[B,D,K] = findBDK(S,N,L,R,A,C,METH,JOB,NSMPL,TOL,PRINTW) computes the system matrices B (if JOB = 1), B and D (if JOB = 2), and the Kalman predictor gain K (if NSMPL > 0). The model structure is:</para>
194
<programlisting role=""><![CDATA[
15
<refname>findBDK</refname>
16
<refpurpose> Kalman gain and B D system matrices of a discrete-time system</refpurpose>
19
<title>Calling Sequence</title>
20
<synopsis>[B,D,K] = findBDK(S,N,L,R,A,C,METH,JOB,NSMPL,TOL,PRINTW)
21
[B,D,RCND] = findBDK(S,N,L,R,A,C,METH,JOB)
22
[B,D,K,Q,Ry,S,RCND] = findBDK(S,N,L,R,A,C,METH,JOB,NSMPL,TOL,PRINTW)
26
<title>Arguments</title>
31
<para>integer, the number of block rows in the block-Hankel matrices</para>
49
<para>matrix, relevant part of the R factor of the concatenated block-Hankel matrices computed by a call to findR.</para>
55
<para>square matrix</para>
67
<para>integer, an option for the method to use</para>
72
<para> MOESP method with past inputs and outputs;</para>
78
<para> N4SID method;</para>
90
<para>an option specifying which system matrices should be computed:</para>
95
<para> compute the matrix B;</para>
101
<para> compute the matrices B and D.</para>
113
<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>
119
<para>the tolerance used for estimating the rank of matrices. If TOL > 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>
125
<para>integer, switch for printing the warning messages.</para>
130
<para>= 1: print warning messages;</para>
136
<para>= 0: do not print warning messages.</para>
148
<para>computes a state-space realization SYS = (A,B,C,D) (an syslin object)</para>
154
<para>the Kalman predictor gain K (if NSMPL > 0)</para>
160
<para> state covariance</para>
166
<para>output covariance</para>
172
<para>state-output cross-covariance</para>
178
<para>he vector of length 12 containing the reciprocal condition numbers of the matrices involved in rank decisions, least squares or Riccati equation solutions.</para>
184
<title>Description</title>
186
finds the system matrices B and D and the Kalman gain of a discrete-time
187
system, given the system order, the matrices A and C, and the relevant
188
part of the R factor of the concatenated block-Hankel matrices, using
189
subspace identification techniques (MOESP or N4SID).
193
<para>[B,D,K] = findBDK(S,N,L,R,A,C,METH,JOB,NSMPL,TOL,PRINTW) computes the system matrices B (if JOB = 1), B and D (if JOB = 2), and the Kalman predictor gain K (if NSMPL > 0). The model structure is:</para>
194
<programlisting role=""><![CDATA[
195
195
x(k+1) = Ax(k) + Bu(k) + Ke(k), k >= 1,
196
196
y(k) = Cx(k) + Du(k) + e(k),
197
197
]]></programlisting>
199
where x(k) and y(k) are vectors of length N and L, respectively.
203
<para>[B,D,RCND] = findBDK(S,N,L,R,A,C,METH,JOB) also returns the vector RCND of length 4 containing the reciprocal condition numbers of the matrices involved in rank decisions.</para>
206
<para>[B,D,K,Q,Ry,S,RCND] = findBDK(S,N,L,R,A,C,METH,JOB,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 12 containing the reciprocal condition numbers of the matrices involved in rank decisions, least squares or Riccati equation solutions.</para>
210
Matrix R, computed by findR, should be determined with suitable arguments
211
METH and JOBD. METH = 1 and JOBD = 1 must be used in findR, for METH = 1
212
in findBDK. Using METH = 1 in FINDR and METH = 2 in findBDK is allowed.
215
The number of output arguments may vary, but should correspond to the
216
input arguments, e.g.,
218
<programlisting role=""><![CDATA[
199
where x(k) and y(k) are vectors of length N and L, respectively.
203
<para>[B,D,RCND] = findBDK(S,N,L,R,A,C,METH,JOB) also returns the vector RCND of length 4 containing the reciprocal condition numbers of the matrices involved in rank decisions.</para>
206
<para>[B,D,K,Q,Ry,S,RCND] = findBDK(S,N,L,R,A,C,METH,JOB,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 12 containing the reciprocal condition numbers of the matrices involved in rank decisions, least squares or Riccati equation solutions.</para>
210
Matrix R, computed by findR, should be determined with suitable arguments
211
METH and JOBD. METH = 1 and JOBD = 1 must be used in findR, for METH = 1
212
in findBDK. Using METH = 1 in FINDR and METH = 2 in findBDK is allowed.
215
The number of output arguments may vary, but should correspond to the
216
input arguments, e.g.,
218
<programlisting role=""><![CDATA[
219
219
B = findBDK(S,N,L,R,A,C,METH,1) or
220
220
[B,D] = findBDK(S,N,L,R,A,C,METH,2) or
221
221
[B,D,RCND] = findBDK(S,N,L,R,A,C,METH,2)
222
222
]]></programlisting>
225
<title>Examples</title>
226
<programlisting role="example"><![CDATA[
225
<title>Examples</title>
226
<programlisting role="example"><![CDATA[
227
227
//generate data from a given linear system
228
228
A = [ 0.5, 0.1,-0.1, 0.2;
229
229
0.1, 0, -0.1,-0.1;