File: TC05AD.html

package info (click to toggle)
slicot 5.9.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 23,528 kB
  • sloc: fortran: 148,076; makefile: 964; sh: 57
file content (328 lines) | stat: -rw-r--r-- 11,526 bytes parent folder | download | duplicates (2)
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
<HTML>
<HEAD><TITLE>TC05AD - SLICOT Library Routine Documentation</TITLE>
</HEAD>
<BODY>

<H2><A Name="TC05AD">TC05AD</A></H2>
<H3>
Frequency response of a left/right polynomial matrix representation
</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 evaluate the transfer matrix T(s) of a left polynomial matrix
  representation [T(s) = inv(P(s))*Q(s)] or a right polynomial
  matrix representation [T(s) = Q(s)*inv(P(s))] at any specified
  complex frequency s = SVAL.

  This routine will calculate the standard frequency response
  matrix at frequency omega if SVAL is supplied as (0.0,omega).

</PRE>
<A name="Specification"><B><FONT SIZE="+1">Specification</FONT></B></A>
<PRE>
      SUBROUTINE TC05AD( LERI, M, P, SVAL, INDEX, PCOEFF, LDPCO1,
     $                   LDPCO2, QCOEFF, LDQCO1, LDQCO2, RCOND, CFREQR,
     $                   LDCFRE, IWORK, DWORK, ZWORK, INFO )
C     .. Scalar Arguments ..
      CHARACTER         LERI
      INTEGER           INFO, LDCFRE, LDPCO1, LDPCO2, LDQCO1, LDQCO2, M,
     $                  P
      DOUBLE PRECISION  RCOND
      COMPLEX*16        SVAL
C     .. Array Arguments ..
      INTEGER           INDEX(*), IWORK(*)
      DOUBLE PRECISION  DWORK(*), PCOEFF(LDPCO1,LDPCO2,*),
     $                  QCOEFF(LDQCO1,LDQCO2,*)
      COMPLEX*16        CFREQR(LDCFRE,*), ZWORK(*)

</PRE>
<A name="Arguments"><B><FONT SIZE="+1">Arguments</FONT></B></A>
<P>

<B>Mode Parameters</B>
<PRE>
  LERI    CHARACTER*1
          Indicates whether a left polynomial matrix representation
          or a right polynomial matrix representation is to be used
          to evaluate the transfer matrix as follows:
          = 'L':  A left matrix fraction is input;
          = 'R':  A right matrix fraction is input.

</PRE>
<B>Input/Output Parameters</B>
<PRE>
  M       (input) INTEGER
          The number of system inputs.  M &gt;= 0.

  P       (input) INTEGER
          The number of system outputs.  P &gt;= 0.

  SVAL    (input) COMPLEX*16
          The frequency at which the transfer matrix or the
          frequency respose matrix is to be evaluated.
          For a standard frequency response set the real part
          of SVAL to zero.

  INDEX   (input) INTEGER array, dimension (MAX(M,P))
          If LERI = 'L', INDEX(I), I = 1,2,...,P, must contain the
          maximum degree of the polynomials in the I-th row of the
          denominator matrix P(s) of the given left polynomial
          matrix representation.
          If LERI = 'R', INDEX(I), I = 1,2,...,M, must contain the
          maximum degree of the polynomials in the I-th column of
          the denominator matrix P(s) of the given right polynomial
          matrix representation.

  PCOEFF  (input) DOUBLE PRECISION array, dimension
          (LDPCO1,LDPCO2,kpcoef), where kpcoef = MAX(INDEX(I)) + 1.
          If LERI = 'L' then porm = P, otherwise porm = M.
          The leading porm-by-porm-by-kpcoef part of this array must
          contain the coefficients of the denominator matrix P(s).
          PCOEFF(I,J,K) is the coefficient in s**(INDEX(iorj)-K+1)
          of polynomial (I,J) of P(s), where K = 1,2,...,kpcoef; if
          LERI = 'L' then iorj = I, otherwise iorj = J.
          Thus for LERI = 'L', P(s) =
          diag(s**INDEX(I))*(PCOEFF(.,.,1)+PCOEFF(.,.,2)/s+...).
          If LERI = 'R', PCOEFF is modified by the routine but
          restored on exit.

  LDPCO1  INTEGER
          The leading dimension of array PCOEFF.
          LDPCO1 &gt;= MAX(1,P) if LERI = 'L',
          LDPCO1 &gt;= MAX(1,M) if LERI = 'R'.

  LDPCO2  INTEGER
          The second dimension of array PCOEFF.
          LDPCO2 &gt;= MAX(1,P) if LERI = 'L',
          LDPCO2 &gt;= MAX(1,M) if LERI = 'R'.

  QCOEFF  (input) DOUBLE PRECISION array, dimension
          (LDQCO1,LDQCO2,kpcoef)
          If LERI = 'L' then porp = M, otherwise porp = P.
          The leading porm-by-porp-by-kpcoef part of this array must
          contain the coefficients of the numerator matrix Q(s).
          QCOEFF(I,J,K) is defined as for PCOEFF(I,J,K).
          If LERI = 'R', QCOEFF is modified by the routine but
          restored on exit.

  LDQCO1  INTEGER
          The leading dimension of array QCOEFF.
          LDQCO1 &gt;= MAX(1,P)   if LERI = 'L',
          LDQCO1 &gt;= MAX(1,M,P) if LERI = 'R'.

  LDQCO2  INTEGER
          The second dimension of array QCOEFF.
          LDQCO2 &gt;= MAX(1,M)   if LERI = 'L',
          LDQCO2 &gt;= MAX(1,M,P) if LERI = 'R'.

  RCOND   (output) DOUBLE PRECISION
          The estimated reciprocal of the condition number of the
          denominator matrix P(SVAL).
          If RCOND is nearly zero, SVAL is approximately a system
          pole.

  CFREQR  (output) COMPLEX*16 array, dimension (LDCFRE,MAX(M,P))
          The leading porm-by-porp part of this array contains the
          frequency response matrix T(SVAL).

  LDCFRE  INTEGER
          The leading dimension of array CFREQR.
          LDCFRE &gt;= MAX(1,P)   if LERI = 'L',
          LDCFRE &gt;= MAX(1,M,P) if LERI = 'R'.

</PRE>
<B>Workspace</B>
<PRE>
  IWORK   INTEGER array, dimension (liwork)
          where liwork = P, if LERI = 'L',
                liwork = M, if LERI = 'R'.

  DWORK   DOUBLE PRECISION array, dimension (ldwork)
          where ldwork = 2*P, if LERI = 'L',
                ldwork = 2*M, if LERI = 'R'.

  ZWORK   COMPLEX*16 array, dimension (lzwork),
          where lzwork = P*(P+2), if LERI = 'L',
                lzwork = M*(M+2), if LERI = 'R'.

</PRE>
<B>Error Indicator</B>
<PRE>
  INFO    INTEGER
          = 0:  successful exit;
          &lt; 0:  if INFO = -i, the i-th argument had an illegal
                value;
          = 1:  if P(SVAL) is exactly or nearly singular;
                no frequency response is calculated.

</PRE>
<A name="Method"><B><FONT SIZE="+1">Method</FONT></B></A>
<PRE>
  The method for a left matrix fraction will be described here;
  right matrix fractions are dealt with by obtaining the dual left
  fraction and calculating its frequency response (see SLICOT
  Library routine TC01OD). The first step is to calculate the
  complex value P(SVAL) of the denominator matrix P(s) at the
  desired frequency SVAL. If P(SVAL) is approximately singular,
  SVAL is approximately a pole of this system and so the frequency
  response matrix T(SVAL) is not calculated; in this case, the
  routine returns with the Error Indicator (INFO) set to 1.
  Otherwise, the complex value Q(SVAL) of the numerator matrix Q(s)
  at frequency SVAL is calculated in a similar way to P(SVAL), and
  the desired response matrix T(SVAL) = inv(P(SVAL))*Q(SVAL) is
  found by solving the corresponding system of complex linear
  equations.

</PRE>
<A name="References"><B><FONT SIZE="+1">References</FONT></B></A>
<PRE>
  None

</PRE>
<A name="Numerical Aspects"><B><FONT SIZE="+1">Numerical Aspects</FONT></B></A>
<PRE>                            3
  The algorithm requires 0(N ) operations.

</PRE>

<A name="Comments"><B><FONT SIZE="+1">Further Comments</FONT></B></A>
<PRE>
  None
</PRE>

<A name="Example"><B><FONT SIZE="+1">Example</FONT></B></A>
<P>
<B>Program Text</B>
<PRE>
*     TC05AD EXAMPLE PROGRAM TEXT.
*
*     .. Parameters ..
      INTEGER          NIN, NOUT
      PARAMETER        ( NIN = 5, NOUT = 6 )
      INTEGER          MMAX, PMAX, KPCMAX
      PARAMETER        ( MMAX = 20, PMAX = 20, KPCMAX = 20 )
      INTEGER          MAXMP
      PARAMETER        ( MAXMP = MAX( MMAX, PMAX ) )
      INTEGER          LDCFRE, LDPCO1, LDPCO2, LDQCO1, LDQCO2
      PARAMETER        ( LDCFRE = MAXMP, LDPCO1 = MAXMP,
     $                   LDPCO2 = MAXMP, LDQCO1 = MAXMP,
     $                   LDQCO2 = MAXMP )
      INTEGER          LDWORK
      PARAMETER        ( LDWORK = 2*MAXMP )
      INTEGER          LZWORK
      PARAMETER        ( LZWORK = ( MAXMP )*( MAXMP+2 ) )
*     .. Local Scalars ..
      COMPLEX*16       SVAL
      DOUBLE PRECISION RCOND
      INTEGER          I, INFO, J, K, KPCOEF, M, P, PORM, PORP
      CHARACTER*1      LERI
      LOGICAL          LLERI
*     .. Local Arrays ..
      COMPLEX*16       CFREQR(LDCFRE,MAXMP), ZWORK(LZWORK)
      DOUBLE PRECISION DWORK(LDWORK), PCOEFF(LDPCO1,LDPCO2,KPCMAX),
     $                 QCOEFF(LDQCO1,LDQCO2,KPCMAX)
      INTEGER          INDEX(MAXMP), IWORK(MAXMP)
*     .. External Functions ..
      LOGICAL          LSAME
      EXTERNAL         LSAME
*     .. External Subroutines ..
      EXTERNAL         TC05AD
*     .. Intrinsic Functions ..
      INTRINSIC        MAX
*     .. Executable Statements ..
*
      WRITE ( NOUT, FMT = 99999 )
*     Skip the heading in the data file and read the data.
      READ ( NIN, FMT = '()' )
      READ ( NIN, FMT = * ) M, P, SVAL, LERI
      LLERI = LSAME( LERI, 'L' )
      IF ( M.LE.0 .OR. M.GT.MMAX ) THEN
         WRITE ( NOUT, FMT = 99995 ) M
      ELSE IF ( P.LE.0 .OR. P.GT.PMAX ) THEN
         WRITE ( NOUT, FMT = 99994 ) P
      ELSE
         PORM = P
         IF ( .NOT.LLERI ) PORM = M
         READ ( NIN, FMT = * ) ( INDEX(I), I = 1,PORM )
         PORP = M
         IF ( .NOT.LLERI ) PORP = P
         KPCOEF = 0
         DO 20 I = 1, PORM
            KPCOEF = MAX( KPCOEF, INDEX(I) )
   20    CONTINUE
         KPCOEF = KPCOEF + 1
         IF ( KPCOEF.LE.0 .OR. KPCOEF.GT.KPCMAX ) THEN
            WRITE ( NOUT, FMT = 99993 ) KPCOEF
         ELSE
            READ ( NIN, FMT = * )
     $         ( ( ( PCOEFF(I,J,K), K = 1,KPCOEF ), J = 1,PORM ),
     $                              I = 1,PORM )
            READ ( NIN, FMT = * )
     $         ( ( ( QCOEFF(I,J,K), K = 1,KPCOEF ), J = 1,PORP ),
     $                              I = 1,PORM )
*           Find the standard frequency response matrix of left pmr
*           at 0.5*j.
            CALL TC05AD( LERI, M, P, SVAL, INDEX, PCOEFF, LDPCO1,
     $                   LDPCO2, QCOEFF, LDQCO1, LDQCO2, RCOND, CFREQR,
     $                   LDCFRE, IWORK, DWORK, ZWORK, INFO )
*
            IF ( INFO.NE.0 ) THEN
               WRITE ( NOUT, FMT = 99998 ) INFO
            ELSE
               WRITE ( NOUT, FMT = 99997 ) RCOND
               DO 40 I = 1, PORM
                  WRITE ( NOUT, FMT = 99996 )
     $                  ( CFREQR(I,J), J = 1,PORP )
   40          CONTINUE
            END IF
         END IF
      END IF
      STOP
*
99999 FORMAT (' TC05AD EXAMPLE PROGRAM RESULTS',/1X)
99998 FORMAT (' INFO on exit from TC05AD = ',I2)
99997 FORMAT (' RCOND = ',F4.2,//' The frequency response matrix T(SVA',
     $       'L) is ')
99996 FORMAT (20(' (',F5.2,',',F5.2,') ',:))
99995 FORMAT (/' M is out of range.',/' M = ',I5)
99994 FORMAT (/' P is out of range.',/' P = ',I5)
99993 FORMAT (/' KPCOEF is out of range.',/' KPCOEF = ',I5)
      END
</PRE>
<B>Program Data</B>
<PRE>
 TC05AD EXAMPLE PROGRAM DATA
   2     2     (0.0,0.5)     L
   2     2
   2.0   3.0   1.0
   4.0  -1.0  -1.0
   5.0   7.0  -6.0
   3.0   2.0   2.0
   6.0  -1.0   5.0
   1.0   7.0   5.0
   1.0   1.0   1.0
   4.0   1.0  -1.0
</PRE>
<B>Program Results</B>
<PRE>
 TC05AD EXAMPLE PROGRAM RESULTS

 RCOND = 0.19

 The frequency response matrix T(SVAL) is 
 (-0.25,-0.33)  ( 0.26,-0.45) 
 (-1.48, 0.35)  (-2.25,-1.11) 
</PRE>

<HR>
<p>
<A HREF=..\libindex.html><B>Return to index</B></A></BODY>
</HTML>