forked from SLICOT/SLICOT-Reference
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathIB01PD.html
More file actions
406 lines (360 loc) · 16.5 KB
/
Copy pathIB01PD.html
File metadata and controls
406 lines (360 loc) · 16.5 KB
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
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
<HTML>
<HEAD><TITLE>IB01PD - SLICOT Library Routine Documentation</TITLE>
</HEAD>
<BODY>
<H2><A Name="IB01PD">IB01PD</A></H2>
<H3>
Estimating system matrices and covariances
</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 matrices A, C, B, and D of a linear time-invariant
(LTI) state space model, using the singular value decomposition
information provided by other routines. Optionally, the system and
noise covariance matrices, needed for the Kalman gain, are also
determined.
</PRE>
<A name="Specification"><B><FONT SIZE="+1">Specification</FONT></B></A>
<PRE>
SUBROUTINE IB01PD( METH, JOB, JOBCV, NOBR, N, M, L, NSMPL, R,
$ LDR, A, LDA, C, LDC, B, LDB, D, LDD, Q, LDQ,
$ RY, LDRY, S, LDS, O, LDO, TOL, IWORK, DWORK,
$ LDWORK, IWARN, INFO )
C .. Scalar Arguments ..
DOUBLE PRECISION TOL
INTEGER INFO, IWARN, L, LDA, LDB, LDC, LDD, LDO, LDQ,
$ LDR, LDRY, LDS, LDWORK, M, N, NOBR, NSMPL
CHARACTER JOB, JOBCV, METH
C .. Array Arguments ..
DOUBLE PRECISION A(LDA, *), B(LDB, *), C(LDC, *), D(LDD, *),
$ DWORK(*), O(LDO, *), Q(LDQ, *), R(LDR, *),
$ RY(LDRY, *), S(LDS, *)
INTEGER IWORK( * )
</PRE>
<A name="Arguments"><B><FONT SIZE="+1">Arguments</FONT></B></A>
<P>
<B>Mode Parameters</B>
<PRE>
METH CHARACTER*1
Specifies the subspace identification method to be used,
as follows:
= 'M': MOESP algorithm with past inputs and outputs;
= 'N': N4SID algorithm.
JOB CHARACTER*1
Specifies which matrices should be computed, as follows:
= 'A': compute all system matrices, A, B, C, and D;
= 'C': compute the matrices A and C only;
= 'B': compute the matrix B only;
= 'D': compute the matrices B and D only.
JOBCV CHARACTER*1
Specifies whether or not the covariance matrices are to
be computed, as follows:
= 'C': the covariance matrices should be computed;
= 'N': the covariance matrices should not be computed.
</PRE>
<B>Input/Output Parameters</B>
<PRE>
NOBR (input) INTEGER
The number of block rows, s, in the input and output
Hankel matrices processed by other routines. NOBR > 1.
N (input) INTEGER
The order of the system. NOBR > N > 0.
M (input) INTEGER
The number of system inputs. M >= 0.
L (input) INTEGER
The number of system outputs. L > 0.
NSMPL (input) INTEGER
If JOBCV = 'C', the total number of samples used for
calculating the covariance matrices.
NSMPL >= 2*(M+L)*NOBR.
This parameter is not meaningful if JOBCV = 'N'.
R (input/workspace) DOUBLE PRECISION array, dimension
( LDR,2*(M+L)*NOBR )
On entry, the leading 2*(M+L)*NOBR-by-2*(M+L)*NOBR part
of this array must contain the relevant data for the MOESP
or N4SID algorithms, as constructed by SLICOT Library
routines IB01AD or IB01ND. Let R_ij, i,j = 1:4, be the
ij submatrix of R (denoted S in IB01AD and IB01ND),
partitioned by M*NOBR, L*NOBR, M*NOBR, and L*NOBR
rows and columns. The submatrix R_22 contains the matrix
of left singular vectors used. Also needed, for
METH = 'N' or JOBCV = 'C', are the submatrices R_11,
R_14 : R_44, and, for METH = 'M' and JOB <> 'C', the
submatrices R_31 and R_12, containing the processed
matrices R_1c and R_2c, respectively, as returned by
SLICOT Library routines IB01AD or IB01ND.
Moreover, if METH = 'N' and JOB = 'A' or 'C', the
block-row R_41 : R_43 must contain the transpose of the
block-column R_14 : R_34 as returned by SLICOT Library
routines IB01AD or IB01ND.
The remaining part of R is used as workspace.
On exit, part of this array is overwritten. Specifically,
if METH = 'M', R_22 and R_31 are overwritten if
JOB = 'B' or 'D', and R_12, R_22, R_14 : R_34,
and possibly R_11 are overwritten if JOBCV = 'C';
if METH = 'N', all needed submatrices are overwritten.
LDR INTEGER
The leading dimension of the array R.
LDR >= 2*(M+L)*NOBR.
A (input or output) DOUBLE PRECISION array, dimension
(LDA,N)
On entry, if METH = 'N' and JOB = 'B' or 'D', the
leading N-by-N part of this array must contain the system
state matrix.
If METH = 'M' or (METH = 'N' and JOB = 'A' or 'C'),
this array need not be set on input.
On exit, if JOB = 'A' or 'C' and INFO = 0, the
leading N-by-N part of this array contains the system
state matrix.
LDA INTEGER
The leading dimension of the array A.
LDA >= N, if JOB = 'A' or 'C', or METH = 'N' and
JOB = 'B' or 'D';
LDA >= 1, otherwise.
C (input or output) DOUBLE PRECISION array, dimension
(LDC,N)
On entry, if METH = 'N' and JOB = 'B' or 'D', the
leading L-by-N part of this array must contain the system
output matrix.
If METH = 'M' or (METH = 'N' and JOB = 'A' or 'C'),
this array need not be set on input.
On exit, if JOB = 'A' or 'C' and INFO = 0, or
INFO = 3 (or INFO >= 0, for METH = 'M'), the leading
L-by-N part of this array contains the system output
matrix.
LDC INTEGER
The leading dimension of the array C.
LDC >= L, if JOB = 'A' or 'C', or METH = 'N' and
JOB = 'B' or 'D';
LDC >= 1, otherwise.
B (output) DOUBLE PRECISION array, dimension (LDB,M)
If M > 0, JOB = 'A', 'B', or 'D' and INFO = 0, the
leading N-by-M part of this array contains the system
input matrix. If M = 0 or JOB = 'C', this array is
not referenced.
LDB INTEGER
The leading dimension of the array B.
LDB >= N, if M > 0 and JOB = 'A', 'B', or 'D';
LDB >= 1, if M = 0 or JOB = 'C'.
D (output) DOUBLE PRECISION array, dimension (LDD,M)
If M > 0, JOB = 'A' or 'D' and INFO = 0, the leading
L-by-M part of this array contains the system input-output
matrix. If M = 0 or JOB = 'C' or 'B', this array is
not referenced.
LDD INTEGER
The leading dimension of the array D.
LDD >= L, if M > 0 and JOB = 'A' or 'D';
LDD >= 1, if M = 0 or JOB = 'C' or 'B'.
Q (output) DOUBLE PRECISION array, dimension (LDQ,N)
If JOBCV = 'C', the leading N-by-N part of this array
contains the positive semidefinite state covariance matrix
to be used as state weighting matrix when computing the
Kalman gain.
This parameter is not referenced if JOBCV = 'N'.
LDQ INTEGER
The leading dimension of the array Q.
LDQ >= N, if JOBCV = 'C';
LDQ >= 1, if JOBCV = 'N'.
RY (output) DOUBLE PRECISION array, dimension (LDRY,L)
If JOBCV = 'C', the leading L-by-L part of this array
contains the positive (semi)definite output covariance
matrix to be used as output weighting matrix when
computing the Kalman gain.
This parameter is not referenced if JOBCV = 'N'.
LDRY INTEGER
The leading dimension of the array RY.
LDRY >= L, if JOBCV = 'C';
LDRY >= 1, if JOBCV = 'N'.
S (output) DOUBLE PRECISION array, dimension (LDS,L)
If JOBCV = 'C', the leading N-by-L part of this array
contains the state-output cross-covariance matrix to be
used as cross-weighting matrix when computing the Kalman
gain.
This parameter is not referenced if JOBCV = 'N'.
LDS INTEGER
The leading dimension of the array S.
LDS >= N, if JOBCV = 'C';
LDS >= 1, if JOBCV = 'N'.
O (output) DOUBLE PRECISION array, dimension ( LDO,N )
If METH = 'M' and JOBCV = 'C', or METH = 'N',
the leading L*NOBR-by-N part of this array contains
the estimated extended observability matrix, i.e., the
first N columns of the relevant singular vectors.
If METH = 'M' and JOBCV = 'N', this array is not
referenced.
LDO INTEGER
The leading dimension of the array O.
LDO >= L*NOBR, if JOBCV = 'C' or METH = 'N';
LDO >= 1, otherwise.
</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; an m-by-n matrix whose estimated
condition number is less than 1/TOL is considered to
be of full rank. If the user sets TOL <= 0, then an
implicitly computed, default tolerance, defined by
TOLDEF = m*n*EPS, is used instead, where EPS is the
relative machine precision (see LAPACK Library routine
DLAMCH).
</PRE>
<B>Workspace</B>
<PRE>
IWORK INTEGER array, dimension (LIWORK)
LIWORK = N, if METH = 'M' and M = 0
or JOB = 'C' and JOBCV = 'N';
LIWORK = M*NOBR+N, if METH = 'M', JOB = 'C',
and JOBCV = 'C';
LIWORK = max(L*NOBR,M*NOBR), if METH = 'M', JOB <> 'C',
and JOBCV = 'N';
LIWORK = max(L*NOBR,M*NOBR+N), if METH = 'M', JOB <> 'C',
and JOBCV = 'C';
LIWORK = max(M*NOBR+N,M*(N+L)), if METH = 'N'.
DWORK DOUBLE PRECISION array, dimension (LDWORK)
On exit, if INFO = 0, DWORK(1) returns the optimal value
of LDWORK, and DWORK(2), DWORK(3), DWORK(4), and
DWORK(5) contain the reciprocal condition numbers of the
triangular factors of the matrices, defined in the code,
GaL (GaL = Un(1:(s-1)*L,1:n)), R_1c (if METH = 'M'),
M (if JOBCV = 'C' or METH = 'N'), and Q or T (see
SLICOT Library routines IB01PY or IB01PX), respectively.
If METH = 'N', DWORK(3) is set to one without any
calculations. Similarly, if METH = 'M' and JOBCV = 'N',
DWORK(4) is set to one. If M = 0 or JOB = 'C',
DWORK(3) and DWORK(5) are set to one.
On exit, if INFO = -30, DWORK(1) returns the minimum
value of LDWORK.
LDWORK INTEGER
The length of the array DWORK.
LDWORK >= max( LDW1,LDW2 ), where, if METH = 'M',
LDW1 >= max( 2*(L*NOBR-L)*N+2*N, (L*NOBR-L)*N+N*N+7*N ),
if JOB = 'C' or JOB = 'A' and M = 0;
LDW1 >= max( 2*(L*NOBR-L)*N+N*N+7*N,
(L*NOBR-L)*N+N+6*M*NOBR, (L*NOBR-L)*N+N+
max( L+M*NOBR, L*NOBR +
max( 3*L*NOBR+1, M ) ) )
if M > 0 and JOB = 'A', 'B', or 'D';
LDW2 >= 0, if JOBCV = 'N';
LDW2 >= max( (L*NOBR-L)*N+Aw+2*N+max(5*N,(2*M+L)*NOBR+L),
4*(M*NOBR+N)+1, M*NOBR+2*N+L ),
if JOBCV = 'C',
where Aw = N+N*N, if M = 0 or JOB = 'C';
Aw = 0, otherwise;
and, if METH = 'N',
LDW1 >= max( (L*NOBR-L)*N+2*N+(2*M+L)*NOBR+L,
2*(L*NOBR-L)*N+N*N+8*N, N+4*(M*NOBR+N)+1,
M*NOBR+3*N+L );
LDW2 >= 0, if M = 0 or JOB = 'C';
LDW2 >= M*NOBR*(N+L)*(M*(N+L)+1)+
max( (N+L)**2, 4*M*(N+L)+1 ),
if M > 0 and JOB = 'A', 'B', or 'D'.
For good performance, LDWORK should be larger.
</PRE>
<B>Warning Indicator</B>
<PRE>
IWARN INTEGER
= 0: no warning;
= 4: a least squares problem to be solved has a
rank-deficient coefficient matrix;
= 5: the computed covariance matrices are too small.
The problem seems to be a deterministic one.
</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;
= 3: a singular upper triangular matrix was found.
</PRE>
<A name="Method"><B><FONT SIZE="+1">Method</FONT></B></A>
<PRE>
In the MOESP approach, the matrices A and C are first
computed from an estimated extended observability matrix [1],
and then, the matrices B and D are obtained by solving an
extended linear system in a least squares sense.
In the N4SID approach, besides the estimated extended
observability matrix, the solutions of two least squares problems
are used to build another least squares problem, whose solution
is needed to compute the system matrices A, C, B, and D. The
solutions of the two least squares problems are also optionally
used by both approaches to find the covariance matrices.
</PRE>
<A name="References"><B><FONT SIZE="+1">References</FONT></B></A>
<PRE>
[1] Verhaegen M., and Dewilde, P.
Subspace Model Identification. Part 1: The output-error state-
space model identification class of algorithms.
Int. J. Control, 56, pp. 1187-1210, 1992.
[2] Van Overschee, P., and De Moor, B.
N4SID: Two Subspace Algorithms for the Identification
of Combined Deterministic-Stochastic Systems.
Automatica, Vol.30, No.1, pp. 75-93, 1994.
[3] Van Overschee, P.
Subspace Identification : Theory - Implementation -
Applications.
Ph. D. Thesis, Department of Electrical Engineering,
Katholieke Universiteit Leuven, Belgium, Feb. 1995.
[4] Sima, V.
Subspace-based Algorithms for Multivariable System
Identification.
Studies in Informatics and Control, 5, pp. 335-344, 1996.
</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>
In some applications, it is useful to compute the system matrices
using two calls to this routine, the first one with JOB = 'C',
and the second one with JOB = 'B' or 'D'. This is slightly less
efficient than using a single call with JOB = 'A', because some
calculations are repeated. If METH = 'N', all the calculations
at the first call are performed again at the second call;
moreover, it is required to save the needed submatrices of R
before the first call and restore them before the second call.
If the covariance matrices are desired, JOBCV should be set
to 'C' at the second call. If B and D are both needed, they
should be computed at once.
It is possible to compute the matrices A and C using the MOESP
algorithm (METH = 'M'), and the matrices B and D using the N4SID
algorithm (METH = 'N'). This combination could be slightly more
efficient than N4SID algorithm alone and it could be more accurate
than MOESP algorithm. No saving/restoring is needed in such a
combination, provided JOBCV is set to 'N' at the first call.
Recommended usage: either one call with JOB = 'A', or
first call with METH = 'M', JOB = 'C', JOBCV = 'N',
second call with METH = 'M', JOB = 'D', JOBCV = 'C', or
first call with METH = 'M', JOB = 'C', JOBCV = 'N',
second call with METH = 'N', JOB = 'D', JOBCV = 'C'.
</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>