In particular, the inverse Laplace transform may be found by numerical ... transformation integral is then based on discrete samples of f(t) taken within the by guest on ... limit, as l:1t -+ 0, the formula passes to the original integral form. However, in the .... F(p) =lip. Application of the inversion formula (equation (4)) to calculate.
Int. J. Elect. Enging Educ.• Vol. 15, pp. 247-265. Manchester V.P., 1978. Printed in Great Britain
NUMERICAL LAPLACE TRANSFORMAnON AND INVERSION D. J. WILCOX Department of Electrical Engineering, Monash University, Victoria, Australia
1 INTRODUCTION The Laplace transform is well known as a powerful tool in the transient analysis of linear systems in general, and linear electrical systems in particular. However, its use has been largely confined to problems amenable to solution through tables of Laplace transform pairs. Such an approach excludes many problems of practical interest. A classic example involves the study of transient wave propagation in lossy transmission systems; for a simple go-return system, there is no difficulty in obtaining an expression F(P) describing the desired response, but the corresponding f(t) cannot generally be found by direct appeal to Laplace transform tables. In other cases, the complexity of the problem may rule out any prospect of even obtaining an 'analytic' expression F(P) to describe the response. The difficulties outlined above may be overcome, at least in many cases, by numerical manipulation. In particular, the inverse Laplace transform may be found by numerical integration based on the inversion integral. Once numerical methods are envisaged, the character of the analysis changes. It then becomes a matter of investigating the behaviour of the system at suitably selected complex frequencies and relating these sample results to the time domain. This method of attack is, therefore, similar to Fourier analysis. The advantage of the Laplace method is, of course, that it works in cases where the Fourier method fails. The essential problem is, therefore, to establish a discrete 'rapport' between the time domain and the complex frequency domain consistent with the principle of the Laplace transform. In short, it is a matter of establishing a discrete Laplace transform pair. Naturally, the discrete approach will lead to some degree of approximation. However, if the discrete processes involved are such that they correspond, in the limit, to the ordinary Laplace transform, innaccuracies may, in principle, be made as small as one pleases. A comprehensive account of the development of a discrete Laplace transform pair is presented in the paper. This discrete transform pair has been used by the author over a number of years in the transient analysis of electrical transmission systems where it has always produced eminently satisfactory results. There seems little reason to suppose that it will not be equally effective when applied to other types of problem. The manner of presentation of the topic is quite new, although the essential ingredients of the underlying material are by no means new. In particular, it is appropriate to mention important contributions already made in this Journal 1 - 5 . 247 Downloaded from ije.sagepub.com by guest on January 24, 2016
248
The objection usually levelled at the use of discrete frequency-domain techniques, compared with discrete time-domain methods, concerns the computation time required to transform data from the time domain to the frequency domain (or viceversa). The introduction of the fast Fourier transform (F.F.T.) algorithm vastly reduces computation times, thereby placing frequency-domain analysis on a very competitive footing. For example, using the proposed discrete transform pair, the computation time required to transform 128 time-domain samples to 2 X 64 samples in the c.f. domain (or vice-versa) may be expected to be less than 1 second on a large machine. In this connexion, it may be noted that the organization of the F.F.T. algorithm presented in this treatment is fundamentally more efficient, by a factor of 2, than that suggested by Ametani 5 . 2 DEVELOPMENT OF A DISCRETE TRANSFORM PAIR The Laplace transform is defined by the following pair of reciprocal integral relationships: ~
F(P)
f(t)
= fo
f(t)e- p t dt
= ~J,F(p)ePt dt 21t]
j
where, in the inverse transformation, the path of integration is taken to enclose all poles of F(p) If the Laplace transform method is being applied to the analysis of a passive system or a stable feedback system, as will be implicitly assumed, the poles of F(P) will be located on, or to the left of, the imaginary axis in the p-plane as indicated in Fig. 1. Thus any path of integration which encloses the entire left-half p-plane will be assured of enclosing all the poles of F(P) as required. In the present treatment we shall specialize on the particular contour shown in Fig. 1. For physically realizable systems, the semi-circular contour C2 will contribute nothing to the inversion integral and consequently it is only necessary to consider that part of the contour, labelled C 1 , which runs parallel to the imaginary axis. This part of the contour is displaced from the imaginary axis by an amount Q - the socalled convergence factor. The choice of convergence factor assumes great importance in numerical calculations. It is now a matter of establishing satisfactory numerical approximations to the integral transform pair. 2.1 Numerical approximation of the forward transformation Fig. 2 serves to represent some general time function f(t) which is zero for time t < O. In practice, interest in the behaviour of f(t) will be restricted to some finite time duration T as suggested in the figure. Numerical evaluation of the forward transformation integral is then based on discrete samples of f(t) taken within the
Downloaded from ije.sagepub.com by guest on January 24, 2016
249 IMAGINARY AXIS
x
FIG.]
The p-plane showing integration contour.
f(t)
''-..,
---------~~~
I
(: I
I
/:
I
:
I
I
I
, I
7t.t
9M
l1t.t
13llt
FIG. 2
Downloaded from ije.sagepub.com by guest on January 24, 2016
T
250
time range of interest. If these samples are taken at the instants t = l:1t, t = 3l:1t, = Sl:1t, etc. then the midpoint rule of numerical integration may be applied to give the following approximation to the value of F(P) at any selected complex frequency p«: t
(1) where t m = (2m - I)M and l:1t = T/4n. The accuracy of the above formula increases as l:1t decreases and, of course, in the limit, as l:1t -+ 0, the formula passes to the original integral form. However, in the interests of computational efficiency, it is desired to choose l:1t as large as can be reasonably justified. A sound basis for selecting l:1t will emerge in subsequent developments.
2.2 Numerical approximation ofthe inverse transformation Numerical inversion of the Laplace transform is based on discrete samples of F(P) taken at points lying along the path of integration. Let these samples be taken at P = a ± jl:1w, P = a ± j3l:1w, P = a ± jSl:1w, etc. as indicated in Fig. 3. Application of IMAGINARY AXIS
,in
p-PLANE
x
j9/1t.> j7llt.>
X j5/1W
1j2l>w
j3/1W
X X
j4 w
X
-j/lW
REAL AXIS
-j 3l>w
X
-j5/1W
X
-J 7l>w
-j 9/lW
X 0
O.9T. Thus T should be chosen slightly larger than actually required so as to make allowance for this phenomenon. Although this in no way affects the choice of T, it is useful at this stage to recall that the choice of T automatically fixes the value of ~w according to equation (3) i.e. ~w = 1TIT. 3.2 Choice of 0: If, as assumed, F(p) has no singularities in the right-half p-plane, 0: may be chosen arbitrarily small so far as the Laplace transform proper is concerned. However, such arbitrariness will generally lead to unsatisfactory results in the discrete manipulation of the. Laplace transform. The reason is not difficult to find. Consider, for example, the case where 0: is chosen very small. The path of integration will then be almost coincident with the imaginary axis and, consequently, poles lying on, or near, the imaginary axis will have a very disturbing influence on the profile of the integrand. This profile will appear extremely 'peaky' in the vicinity of such singularities and, in principle, very fine steps would need to be taken in the numerical integration process in order to adequately discern the nature of the singularity involved. However, the step length, j2~w, has already been fixed by the choice of T! The effect of increasing 0: is to displace the integration contour away from the immediate vicinity of possible singularities of F(p). This 'softens' the profile of the integrand, thereby justifying larger steps in the numerical integration process. The above argument seems to suggest that it would be advantageous to choose a large value of 0:. But this is not so. The reason may be visualized by referring to Fig. 3 and imagining the path of integration displaced far to the right. It then becomes apparent that, whilst the integration profile may then be very smooth, it would be unreasonable to accept the truncated contour as effectively enclosing the left-half plane. It has now been established that 0: may neither be chosen 'too' large nor 'too' small. The problem of fixing an 'appropriate' value between these vague limits remains. Mathematicians have so far failed to provide a sound basis, of general applicability, for choosing a suitable value for 0:. Notwithstanding this, the following rule is given for the choice of 0::
Downloaded from ije.sagepub.com by guest on January 24, 2016
253
(6)
a=2Liw
This rule is simple and intuitively reasonable. More importantly, in the author's experience, this rule has never failed to produce anything but eminently satisfactory results. Note, finally, that since Liw is fixed by the choice of T, the above rule may be expressed as
a = 211IT
(7)
3.3 Choice of n The choice of n is determined in relation to the bandwidth of f(t). Assuming that f(t) represents the response of a physical system, it will generally be possible to assign a value of angular frequency, n rads/sec, beyond which the frequency spectrum associated with f(t) may be reasonably neglected. Experience of the physical system involved will naturally guide the choice of n. Once a value has been assigned to n, n is taken as some convenient integer such that n ""-~ - 2Liw or,
•
SInce
A '-'w --
IT,
11
(8)
It is of interest to note that the above choice of n leads to the following sampling rate in the time domain: (sampling rate)
=
2L = ~ = 2X (2~ )Hz
= 2 X (bandwidth in Hz) This shows that the given development is consistent with the celebrated sampling theorem (Shannon's theorem) associated with communication theory and implies adequate representation of f(t) and F(P) in the given discrete processes. 3.4 The sigma factor The sigma factor is a mathematical device which is often used in conjunction with the numerical inversion of the Laplace (or Fourier) transform. Its purpose is to suppress unwanted high-frequency oscillations - known as Gibb's oscillationswhich sometimes appear in the computed time function f(t). To illustrate the problem involved, consider the numerical inversion of the function F(p) = lip. Application of the inversion formula (equation (4)) to calculate sample values of f(t) at finely-spaced time instants (i.e, spaced more finely than given in equation (5)) results in the curve (a) shown in Fig. 4. This curve clearly indicates the nature of Gibb's oscillations. These oscillations are the consequence of assuming a finite bandwidth, n rads/sec, in the inversion process. Increasing n, in this particular case, has very little effect on the amplitude of the oscillations. The reason for this is that IF(p)i tends to zero extremely slowly with progress along the integration contour. In short, the function F(p) = l/p cannot meaningfully be said to be 'band-limited'. Thus, under the circumstances, the result obtained is a reasonably satisfactory approximation to the known result.
Downloaded from ije.sagepub.com by guest on January 24, 2016
254 1·2
1·0
0·8
(a) WI THOUT SIGMA FACTOR
0·6
(b) WIT H SIGMA FACTOR
OL-_........_ _........_ _.,....-_........._ _
o
6n/.n.
8nf.n.
~
f1ME _ _.,....----:..::..:.:,_ _
10n/11.
12fT/11.
14n/11.
FIG. 4 Numerical inversion of the unit step function. Gibb's oscillations always occur, to a greater or lesser extent, when attempting numerical inversion using an 'inadequate' range of integration. The oscillations may, however, be suppressed by employing the so-called sigma-factor. The idea is to take the value of the time function at any given instant as being the average value associated with a period of rr/o, seconds centred on the time instant of current interest. The derivation of the sigma factor is given elsewhere 1 and leads to an elegant mathematical result. It turns out that the required objective is simply achieved by multiplying F(p) by the (sigma) factor sin(wrrjo,) wrrjo,
0=
(9)
prior to applying the inversion process. Thus, in the discrete process, F(Pk) is modified by the factor _ sin(wkrr/o,) _ sin {(2k ~ l)rr/2n} Wkrrjo, (2k - I )rr/2n
Ok -
The result of applying the sigma factor to the inversion of the step function is shown by curve (b) in Fig. 4. Clearly, the device is very effective in suppressing the Gibb's oscillations - albeit at the expense of a reduced 'rise time', i.e. from about rr/2o, seconds to about rr/o, seconds. It is appropriate at this stage to recall that, according to the given development, in conjunction with the given interpretation in terms of fundamental sampling principles, it should only be necessary to calculate f(t) at instants 2!1t (= rr/o,) seconds apart in order to adequately represent the time function in a manner consistent with the actual, or imposed, angular bandwidth 0,. Thus the calculation of sample values of f(t) at instants more finely spaced than the defined 2!1t cannot,
Downloaded from ije.sagepub.com by guest on January 24, 2016
255
as a matter of fundamental principle, provide any more information than would be obtained by fitting a 'smooth' curve through the sample values obtained at the sampling instants specified in the text. In the case of the unit step function, the sample values obtained at these recommended time instants are shown by heavy dots in Fig. 4. These sample values were obtained without the use of the sigma factor and hence lie on curve (a). Clearly, the discrete results offer a very good description of the unit step function, Note in particular that, in this case, there is no evidence of the Gibbs phenomenon. Unfortunately the specified sampling instants cannot be expected to mask the Gibbs phenomenon in the general case. Indeed it would be possible, for example in the case of a delayed step function, that the specified sampling instants could coincide with successive 'peaks' and 'troughs' of the oscillation, thereby presenting a worst case. The problem is overcome by employing the sigma factor. The application of the sigma factor corresponds to passing f(t) through a bandpass filter. The characteristic of this filter is defined by equation 8 and shown in Fig. 5. As already demonstrated, the shape of this characteristic is such as to suppress the Gibbs oscillations which might otherwise occur. The time function obtained by applying the sigma factor is therefore a filtered version of the 'desired' time function. Indiscriminate use of the device could thus lead to the eradication of important features of the time response. As previously noted, the response of a physical system is invariably band-limited and thus, if n is chosen large enough, then Gibb's oscillations will simply not occur. Indeed, if they are found to be present, then this is a clear indication that n had not in fact been chosen large enough. In practical studies, however, it may be satisfactory to sacrifice some bandwidth in the interests of reduced computation. The sigma factor should thus be seen as a device for achieving this without provoking undesirable high-frequency oscillations. 3.5 Global responses The transient response of a stable physical system to a suddenly-imposed disturbance is generally characterized, in the initial stages, by a more or less violent reaction to the change in conditions. This initial phase is followed by systematic activity, whereby the change in conditions is communicated throughout the system. This activity becomes progressively less violent until steady-state conditions are finally established.
.n,
FIG. 5
Graphical representation of the sigma factor.
Downloaded from ije.sagepub.com by guest on January 24, 2016
256
Thus it is apparent that closely spaced sampling instants will be required during the initial phase of the global response, but that the sampling rate could, in principle at least, be progressively reduced with the passage of time. It would appear that no-one has yet succeeded in developing an efficient and satisfactory technique for systematically increasing the time interval between successive samples in a useful way. The present treatment is, therefore, based on equally-spaced sampling instants. However, it would not generally be efficient to attempt to obtain the global response in a single effort. The reason is that if n is chosen large enough to account for the rapid changes in the response during the initial period, then the time interval (rr/n) between successive samples would tend to be excessively small for the purposes of representing the 'follow-through' transient. This implies excessive and unnecessary computation. A more satisfactory procedure, resulting in considerably less computation, effectively consists of fixing n at some appropriate value (it is the value of n which governs the computational requirements). Experience suggests a value of n "'" 100 (in practice usually 64 or 128). If the bandwidth required to adequately define the initial part of the transient is taken to be nh rads/sec, then this value will define ~w, i.e. ~w =nh/2n, which in turn fixes the duration Th for which the transient response will be obtained i.e. Th = n] ~w. The transient response is then calculated up to time t = Th. Time t> Th may be said to correspond to the 'follow-through' transient. The bandwidth required to adequately describe the nature of the 'follow-through' transient will generally be much lower than nh - quite possibly by a factor of 5 or 10. Taking the value of 5 as an example, it is then a matter of setting T = 5n and computing the response. Evidently it is a matter of experience to choose a suitable factor for this second-stage calculation (and for a third-stage calculation if required). Provided that the factor has not been chosen too large, then results obtained on the basis of the longer observation period should be starting to match those of the shorter period as t --+ Th. As a concrete example, consider the study of transient phenomena on an overhead power transmission line. If the highest frequency of importance is judged to be 50 kHz and n is taken to be 128 then Th = 128/(50 X 103 ) "'" 2 msec. Retaining the same value of n, a second study based on T"'" 20 msec will generally be adequate to define the 'follow-through' transient. 4 COMPUTAnON The computation involves 2n sample values in the time domain and 2n sample values in the complex frequency domain. The sample values associated with the time domain are of course f(t d,f(t2), ... ,f(t2n); those associated with the c.f. domain are F(P_n)"" ,F(P-d,F(pd,··· ,F(Pn)' The amount of computation required for either the forward or the inverse transformation may be immediately halved by noting that (10) This relationship follows directly from equation (4a) in conjunction with the fact that p -k = p* k (equation (5)). Thus, in the forward transformation, it is only
Downloaded from ije.sagepub.com by guest on January 24, 2016
257
necessary to calculate the n sample values of F(Pk) corresponding to k > 0 in order to define F(p) at the 2n sampling points involved. In the case of the inversion process (equation (4b)), this may be expressed as n k
L=
1
and hence (11) where the operator Re. extracts the real part of the expression. Clearly equation (11) enables the 2n sample values of f(t) to be calculated from n, rather than 2n, samples of F(p).
4.1 Direct method The discrete transform pair given in equation (4) is re-arranged for computational purposes as 2n L
{e- atmf(tm)}e- j (2k - 1)(2m - 1)7T/4n (a) )
m = 1
(12)
n
L
F(Pk)e j(2k
- 1)(2m -lh/4n
(b)
k = 1
where use has been made of equations (5) and (II). For subsequent comparative purposes, let one unit of computation be defined to consist essentially of the generation of a complex number Z = ej(J from a given value of 8 and its multiplication by some other complex number. The discrete forward transformation is then seen to require the equivalent of approximately n 2 of the defined units (note that the formation of a * Z, where a is purely real, requires 2 approximately half a unit of computation). Some n units of computation are similarly required for the inversion process. The amount of computation required by the direct method is not insignificant - especially if n is large. For n "" I00, the processing time may be expected to be of the order of 20 seconds in a large machine. Substantial reductions in computation time may be achieved by employing the celebrated fast Fourier transform (F.F.T.) algorithm. The application of this algorithm to the present problem is described in the following subsection.
Downloaded from ije.sagepub.com by guest on January 24, 2016
258
Application of the F.F. T. algorithm The following notation is introduced:
4.2
Fk
=J1.(2k -
1)
F(Pk)
f:n = e- ottm J1. -2(m -
)
1)
f(tm);
(13)
f(tm) = Re. [J1.2(m - l)fm]
where
J1. =e h r/ 4 n
(14)
The discrete transform pair is then expressible as
2n
F =L k 2n
"" 4..
+'
Jm J1.
-4(k -
1)(m -
1)
(a) )
m = 1
(15) n
L
2
fm =T
Fk J1.4(k - 1)(m -
1)
(b)
k =1 Note that Fk,fm andf:n are complex quantities as, of course, is J1.. The organization of the application of the F.F.T. algorithm will, for convenience, be explained with reference to the particular case n = 8. Generalization of the process to larger values of n will be self-evident. It is important to note that n must be chosen as being some power of 2, i.e. n must be expressible in the form n = 2N .
(i) Inverse transformation Let tlie complex number Z be defined here as
Z = J1.4 = e i1T /n
(16)
Note that Zn = -1 and Z2n = 1. In the particular case n = 8
Z =ei1T / 8 and consequently Z8 = -1 and Z16' = + 1. 'It also follows, for example, that Z13 = _Z5 . The inverse transformation may then be written in matrix form, equation (17), where the order of the elements in the left-hand column was chosen precisely to produce an 'orderliness' in the structure of the connexion matrix. This order will be further changed in subsequent steps. A simple algorithm for 'un-jumbling' the final 'jumbled' order will be given at a later stage. Thus, using the symbol fa to denote a jumbled version of the vector containing odd-subscripted values and fb to denote a jumbled version of the vector containing even-subscripted values, we have equation (18).
Downloaded from ije.sagepub.com by guest on January 24, 2016
Downloaded from ije.sagepub.com by guest on January 24, 2016
260
x'1) = [' z' - .
A(l) =
[1
=1:
~1
=t1
Re-arrangement of the rows of A (l) simply corresponds to a further re-arrangement of the elements of the vector f. On the understanding that the final jumbled form will be known, A ( 1 ) may be re-written as I I -I I Z4 -1 _Z4 -I
which permits the following further stage of decomposition: A(l)
~(~ __ :
=[
A(2)
x