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 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367
|
<HTML>
<HEAD><TITLE>IB01QD - SLICOT Library Routine Documentation</TITLE>
</HEAD>
<BODY>
<H2><A Name="IB01QD">IB01QD</A></H2>
<H3>
Estimating initial state and system matrices B and D, given A, C, and input-output trajectories
</H3>
<A HREF ="#Specification"><B>[Specification]</B></A>
<A HREF ="#Arguments"><B>[Arguments]</B></A>
<A HREF ="#Method"><B>[Method]</B></A>
<A HREF ="#References"><B>[References]</B></A>
<A HREF ="#Comments"><B>[Comments]</B></A>
<A HREF ="#Example"><B>[Example]</B></A>
<P>
<B><FONT SIZE="+1">Purpose</FONT></B>
<PRE>
To estimate the initial state and the system matrices B and D
of a linear time-invariant (LTI) discrete-time system, given the
matrix pair (A,C) and the input and output trajectories of the
system. The model structure is :
x(k+1) = Ax(k) + Bu(k), k >= 0,
y(k) = Cx(k) + Du(k),
where x(k) is the n-dimensional state vector (at time k),
u(k) is the m-dimensional input vector,
y(k) is the l-dimensional output vector,
and A, B, C, and D are real matrices of appropriate dimensions.
Matrix A is assumed to be in a real Schur form.
</PRE>
<A name="Specification"><B><FONT SIZE="+1">Specification</FONT></B></A>
<PRE>
SUBROUTINE IB01QD( JOBX0, JOB, N, M, L, NSMP, A, LDA, C, LDC, U,
$ LDU, Y, LDY, X0, B, LDB, D, LDD, TOL, IWORK,
$ DWORK, LDWORK, IWARN, INFO )
C .. Scalar Arguments ..
DOUBLE PRECISION TOL
INTEGER INFO, IWARN, L, LDA, LDB, LDC, LDD, LDU,
$ LDWORK, LDY, M, N, NSMP
CHARACTER JOB, JOBX0
C .. Array Arguments ..
DOUBLE PRECISION A(LDA, *), B(LDB, *), C(LDC, *), D(LDD, *),
$ DWORK(*), U(LDU, *), X0(*), Y(LDY, *)
INTEGER IWORK(*)
</PRE>
<A name="Arguments"><B><FONT SIZE="+1">Arguments</FONT></B></A>
<P>
<B>Mode Parameters</B>
<PRE>
JOBX0 CHARACTER*1
Specifies whether or not the initial state should be
computed, as follows:
= 'X': compute the initial state x(0);
= 'N': do not compute the initial state (x(0) is known
to be zero).
JOB CHARACTER*1
Specifies which matrices should be computed, as follows:
= 'B': compute the matrix B only (D is known to be zero);
= 'D': compute the matrices B and D.
</PRE>
<B>Input/Output Parameters</B>
<PRE>
N (input) INTEGER
The order of the system. N >= 0.
M (input) INTEGER
The number of system inputs. M >= 0.
L (input) INTEGER
The number of system outputs. L > 0.
NSMP (input) INTEGER
The number of rows of matrices U and Y (number of
samples, t).
NSMP >= N*M + a + e, where
a = 0, if JOBX0 = 'N';
a = N, if JOBX0 = 'X';
e = 0, if JOBX0 = 'X' and JOB = 'B';
e = 1, if JOBX0 = 'N' and JOB = 'B';
e = M, if JOB = 'D'.
A (input) DOUBLE PRECISION array, dimension (LDA,N)
The leading N-by-N part of this array must contain the
system state matrix A in a real Schur form.
LDA INTEGER
The leading dimension of the array A. LDA >= MAX(1,N).
C (input) DOUBLE PRECISION array, dimension (LDC,N)
The leading L-by-N part of this array must contain the
system output matrix C (corresponding to the real Schur
form of A).
LDC INTEGER
The leading dimension of the array C. LDC >= L.
U (input/output) DOUBLE PRECISION array, dimension (LDU,M)
On entry, the leading NSMP-by-M part of this array must
contain the t-by-m input-data sequence matrix U,
U = [u_1 u_2 ... u_m]. Column j of U contains the
NSMP values of the j-th input component for consecutive
time increments.
On exit, if JOB = 'D', the leading NSMP-by-M part of
this array contains details of the QR factorization of
the t-by-m matrix U, possibly computed sequentially
(see METHOD).
If JOB = 'B', this array is unchanged on exit.
If M = 0, this array is not referenced.
LDU INTEGER
The leading dimension of the array U.
LDU >= MAX(1,NSMP), if M > 0;
LDU >= 1, if M = 0.
Y (input) DOUBLE PRECISION array, dimension (LDY,L)
The leading NSMP-by-L part of this array must contain the
t-by-l output-data sequence matrix Y,
Y = [y_1 y_2 ... y_l]. Column j of Y contains the
NSMP values of the j-th output component for consecutive
time increments.
LDY INTEGER
The leading dimension of the array Y. LDY >= MAX(1,NSMP).
X0 (output) DOUBLE PRECISION array, dimension (N)
If JOBX0 = 'X', the estimated initial state of the
system, x(0).
If JOBX0 = 'N', x(0) is set to zero without any
calculations.
B (output) DOUBLE PRECISION array, dimension (LDB,M)
If N > 0, M > 0, and INFO = 0, the leading N-by-M
part of this array contains the system input matrix B
in the coordinates corresponding to the real Schur form
of A.
If N = 0 or M = 0, this array is not referenced.
LDB INTEGER
The leading dimension of the array B.
LDB >= N, if N > 0 and M > 0;
LDB >= 1, if N = 0 or M = 0.
D (output) DOUBLE PRECISION array, dimension (LDD,M)
If M > 0, JOB = 'D', and INFO = 0, the leading
L-by-M part of this array contains the system input-output
matrix D.
If M = 0 or JOB = 'B', this array is not referenced.
LDD INTEGER
The leading dimension of the array D.
LDD >= L, if M > 0 and JOB = 'D';
LDD >= 1, if M = 0 or JOB = 'B'.
</PRE>
<B>Tolerances</B>
<PRE>
TOL DOUBLE PRECISION
The tolerance to be used for estimating the rank of
matrices. If the user sets TOL > 0, then the given value
of TOL is used as a lower bound for the reciprocal
condition number; a matrix whose estimated condition
number is less than 1/TOL is considered to be of full
rank. If the user sets TOL <= 0, then EPS is used
instead, where EPS is the relative machine precision
(see LAPACK Library routine DLAMCH). TOL <= 1.
</PRE>
<B>Workspace</B>
<PRE>
IWORK INTEGER array, dimension (LIWORK), where
LIWORK >= N*M + a, if JOB = 'B',
LIWORK >= max( N*M + a, M ), if JOB = 'D',
with a = 0, if JOBX0 = 'N';
a = N, if JOBX0 = 'X'.
DWORK DOUBLE PRECISION array, dimension (LDWORK)
On exit, if INFO = 0, DWORK(1) returns the optimal value
of LDWORK; DWORK(2) contains the reciprocal condition
number of the triangular factor of the QR factorization of
the matrix W2 (see METHOD); if M > 0 and JOB = 'D',
DWORK(3) contains the reciprocal condition number of the
triangular factor of the QR factorization of U.
On exit, if INFO = -23, DWORK(1) returns the minimum
value of LDWORK.
LDWORK INTEGER
The length of the array DWORK.
LDWORK >= max( LDW1, min( LDW2, LDW3 ) ), where
LDW1 = 2, if M = 0 or JOB = 'B',
LDW1 = 3, if M > 0 and JOB = 'D',
LDWa = t*L*(r + 1) + max( N + max( d, f ), 6*r ),
LDW2 = LDWa, if M = 0 or JOB = 'B',
LDW2 = max( LDWa, t*L*(r + 1) + 2*M*M + 6*M ),
if M > 0 and JOB = 'D',
LDWb = (b + r)*(r + 1) +
max( q*(r + 1) + N*N*M + c + max( d, f ), 6*r ),
LDW3 = LDWb, if M = 0 or JOB = 'B',
LDW3 = max( LDWb, (b + r)*(r + 1) + 2*M*M + 6*M ),
if M > 0 and JOB = 'D',
r = N*M + a,
a = 0, if JOBX0 = 'N',
a = N, if JOBX0 = 'X';
b = 0, if JOB = 'B',
b = L*M, if JOB = 'D';
c = 0, if JOBX0 = 'N',
c = L*N, if JOBX0 = 'X';
d = 0, if JOBX0 = 'N',
d = 2*N*N + N, if JOBX0 = 'X';
f = 2*r, if JOB = 'B' or M = 0,
f = M + max( 2*r, M ), if JOB = 'D' and M > 0;
q = b + r*L.
For good performance, LDWORK should be larger.
If LDWORK >= LDW2 or
LDWORK >= t*L*(r + 1) + (b + r)*(r + 1) + N*N*M + c +
max( d, f ),
then standard QR factorizations of the matrices U and/or
W2 (see METHOD) are used.
Otherwise, the QR factorizations are computed sequentially
by performing NCYCLE cycles, each cycle (except possibly
the last one) processing s < t samples, where s is
chosen from the equation
LDWORK = s*L*(r + 1) + (b + r)*(r + 1) + N*N*M + c +
max( d, f ).
(s is at least N*M+a+e, the minimum value of NSMP.)
The computational effort may increase and the accuracy may
decrease with the decrease of s. Recommended value is
LDWORK = LDW2, assuming a large enough cache size, to
also accommodate A, C, U, and Y.
</PRE>
<B>Warning Indicator</B>
<PRE>
IWARN INTEGER
= 0: no warning;
= 4: the least squares problem to be solved has a
rank-deficient coefficient matrix.
</PRE>
<B>Error Indicator</B>
<PRE>
INFO INTEGER
= 0: successful exit;
< 0: if INFO = -i, the i-th argument had an illegal
value;
= 2: the singular value decomposition (SVD) algorithm did
not converge.
</PRE>
<A name="Method"><B><FONT SIZE="+1">Method</FONT></B></A>
<PRE>
An extension and refinement of the method in [1,2] is used.
Specifically, denoting
X = [ vec(D')' vec(B)' x0' ]',
where vec(M) is the vector obtained by stacking the columns of
the matrix M, then X is the least squares solution of the
system S*X = vec(Y), with the matrix S = [ diag(U) W ],
defined by
( U | | ... | | | ... | | )
( U | 11 | ... | n1 | 12 | ... | nm | )
S = ( : | y | ... | y | y | ... | y | P*Gamma ),
( : | | ... | | | ... | | )
( U | | ... | | | ... | | )
ij
diag(U) having L block rows and columns. In this formula, y
are the outputs of the system for zero initial state computed
using the following model, for j = 1:m, and for i = 1:n,
ij ij ij
x (k+1) = Ax (k) + e_i u_j(k), x (0) = 0,
ij ij
y (k) = Cx (k),
where e_i is the i-th n-dimensional unit vector, Gamma is
given by
( C )
( C*A )
Gamma = ( C*A^2 ),
( : )
( C*A^(t-1) )
and P is a permutation matrix that groups together the rows of
Gamma depending on the same row of C, namely
[ c_j; c_j*A; c_j*A^2; ... c_j*A^(t-1) ], for j = 1:L.
The first block column, diag(U), is not explicitly constructed,
but its structure is exploited. The last block column is evaluated
using powers of A with exponents 2^k. No interchanges are applied.
A special QR decomposition of the matrix S is computed. Let
U = q*[ r' 0 ]' be the QR decomposition of U, if M > 0, where
r is M-by-M. Then, diag(q') is applied to W and vec(Y).
The block-rows of S and vec(Y) are implicitly permuted so that
matrix S becomes
( diag(r) W1 )
( 0 W2 ),
where W1 has L*M rows. Then, the QR decomposition of W2 is
computed (sequentially, if M > 0) and used to obtain B and x0.
The intermediate results and the QR decomposition of U are
needed to find D. If a triangular factor is too ill conditioned,
then singular value decomposition (SVD) is employed. SVD is not
generally needed if the input sequence is sufficiently
persistently exciting and NSMP is large enough.
If the matrix W cannot be stored in the workspace (i.e.,
LDWORK < LDW2), the QR decompositions of W2 and U are
computed sequentially.
</PRE>
<A name="References"><B><FONT SIZE="+1">References</FONT></B></A>
<PRE>
[1] Verhaegen M., and Varga, A.
Some Experience with the MOESP Class of Subspace Model
Identification Methods in Identifying the BO105 Helicopter.
Report TR R165-94, DLR Oberpfaffenhofen, 1994.
[2] Sima, V., and Varga, A.
RASP-IDENT : Subspace Model Identification Programs.
Deutsche Forschungsanstalt fur Luft- und Raumfahrt e. V.,
Report TR R888-94, DLR Oberpfaffenhofen, Oct. 1994.
</PRE>
<A name="Numerical Aspects"><B><FONT SIZE="+1">Numerical Aspects</FONT></B></A>
<PRE>
The implemented method is numerically stable.
</PRE>
<A name="Comments"><B><FONT SIZE="+1">Further Comments</FONT></B></A>
<PRE>
The algorithm for computing the system matrices B and D is
less efficient than the MOESP or N4SID algorithms implemented in
SLICOT Library routine IB01PD, because a large least squares
problem has to be solved, but the accuracy is better, as the
computed matrices B and D are fitted to the input and output
trajectories. However, if matrix A is unstable, the computed
matrices B and D could be inaccurate.
</PRE>
<A name="Example"><B><FONT SIZE="+1">Example</FONT></B></A>
<P>
<B>Program Text</B>
<PRE>
None
</PRE>
<B>Program Data</B>
<PRE>
None
</PRE>
<B>Program Results</B>
<PRE>
None
</PRE>
<HR>
<A HREF=support.html><B>Return to Supporting Routines index</B></A></BODY>
</HTML>
|