You are on page 1of 14

INTERNATIONAL JOURNAL FOR NUMERICAL METHODS IN ENGINEERING, VOL.

14, 1679-1692 (1979)

INTERPOLATION BY FAST FOURIER AND


CHEBYSHEV TRANSFORMS

DONALD M. MONRO
Engineering in Medicine Laboratory, Department of Electrical Engineering, Imperial College of Science and Technology,
London, England

SUMMARY
Transform methods for the interpolation of regularly spaced data are described, based on fast evaluation
using discrete Fourier transforms. For periodic data adequately sampled, the fast Fourier transform (FFT)
is used directly. With undersampled or aperiodic data, a Chebyshev interpolating polynomial is evaluated
by means of the FIT to provide minimum deviation and distributed ripple. The merits of two kinds of
Chebyshev series are compared. All the methods described produce an interpolation passing directly
through the given values and are applied easily to the multi-dimensional case.

INTRODUCTION

Many fewer points on a curve are required to describe it than are needed to draw a pleasing
representation of it. For this reason, over a wide range of applications information is acquired in
minimal quantities for obvious reasons of economy, and is later interpolated by some means for
graphical display. It is shown here how the efficiency of the fast Fourier transform (FFT)can be
applied in the interpolation of any number of regularly spaced samples. Where the curve is
periodic and adequately sampled, it is well known that ‘ideal’ reconstruction is possible, but it is
less well known that the FFT is the most efficient approach to the task. In the case of aperiodic
data or data inadequately sampled, it is generally appreciated that the Chebyshev polynomial is
a near-optimal interpolating polynomial in several respects but is not widely used because it is
thought to involve prohibitive computational effort. By exploiting the close relationship of the
Chebyshev coefficients to the discrete Fourier transform (DFT), it is shown how the interpolat-
ing virtues of the Chebyshev series can be achieved at reasonable cost. Available DFT
algorithms to operate on any length of sequence make the methods perfectly general for any
number of regularly spaced samples.

Interpolation by discrete Fourier transform


Suppose N samples {Fk}are taken from a real periodic waveform f ( t ) of period T at times
kT/N, where k = 0 , 1 , . . . ,N - 1 , as shown in Figure l(a) for N = 8. The Fourier series
reconstruction of f ( t )in the usual complex form is

0029-5981/79/1114-1679$01.00 Received 8 November 1977


0 1 9 7 9 by John Wiley & Sons, Ltd. Revised 13 December 1978
1679
1680 D. M. MONRO

Figure 1. Interpolation by discrete Fourier transform of a periodic waveform: (a) 8 samples taken from one period; (b)
the discrete Fourier coefficients--only the real part is shown; (c) expanded array of 16 coefficients; (d) the interpolated
waveform

where the complex Fourier coefficients d,, are

If the Fourier spectrum of f(t> is limited to the first N / 2 harmonics so that

d,=O for Inl>N/2 (3)

then any number of waveform samples can be reconstructed by equation (1)using the non-zero
Fourier coefficients; this will be the basis of interpolation. In particular the N samples {Fk}can
be recovered from
INTERPOLATION BY FAST FOURIER AND CHEBYSHEV TRANSFORMS 1681

and in this, the discrete case, the Fourier coefficients are obtained by the sampled equivalent of
(3,
2 N-1
-jZvknlN
d,=- F k e for n = O , l , ..., N - 1 (5)
N k=O

Equations (4)and (5) could be taken as a discrete Fourier transform pair, but it is usual to
observe in equation (5) that

d - , = dN-, (6)
so that the preferred form of equation (4)is
1 N-l
F~= - c
d, ei2wknfN for k = O , 1 , . . . ,N - 1 (7)
2 n=O
It is worth commenting that the DFT is confusingly named in that it resembles a Fourier series
rather than a Fourier transform.
It is also evident in (5) that for real {Fk}

and this Hermitian symmetry of the coefficients {d,} becomes an important fact in practical.
applications of the DFT through the fast Fourier transform (FIT). Equations ( 5 ) and (7) are a
discrete Fourier transform pair, and although different normalization is often used" this
definition has the advantage of similar normalization to the Fourier series. The use of these
transforms came to prominence after Cooley and T ~ k e yin , ~1965, introduced the FFT as it is
now known-an algorithm for computing the DFT in the order of N log2 N operations as
compared to the naive N 2 suggested by the definition. As the calculation of large transforms
remains substantial, much work has been done on efficient implementation, and FFT programs
are widely available; a convenient set covering the special cases used in interpolation is found in
the series by M ~ n r oand
~ . Monro
~ and Branch.'
The interpolation process follows directly. If pN samples are desired, where p is an integer
factor of interpolation, then Figure 1 illustrates the procedure. The Fourier coefficients of the
new waveform { d ; } are a simple rearrangement as follows:
1 . For N odd

N-1
d ; =d, for n = O , l , ...,-
2
N+l N+l
d;=O for n =- , . . . , pN - -
2 2
N-1
dL =d,--(,,-I)N for n = p N - - ,
2
, . ., p N - 1 (9)

or alternatively the latter group

N-1
dL = d h - , , for n = p N - - - ,
2
. . . ,p N - 1
1682 D. M. MONRO

2. For N even
N
dL=d, for n = 0, 1, . . .-- 1
2
N N
d‘ =-d n for n=- and n = p N - -
“ 2 2 2
N N
d; = O for n = - + 1 , . . . , pN - - - 1
2 2
N
dL=dn-(p-l)N for n=pN--+l,
2
...,p N - 1 (10)

or symmetry can be used for the latter group as before.


In making this rearrangement it is important to remember that the coefficients are complex
and so the real and imaginary parts are both treated. For harmonics {d,} up to n = N / 2 , the
spectra are the same for the original and resampled versions as would be expected, except that
for N even the amplitude of dNI2is divided between the symmetric parts. The symmetry of the
transform is preserved and the intermediate harmonics are zero. The resampled version is then
obtained from the inverse transform of length pN.
The procedure involves steps using available library routines for the DFT. For N odd the
complex Chirp DFT would be used which is the most general case but least rapid,* while for even
N the real Chirp DFT can be used. In using a real transform, the upper half or symmetric part is

(bl
Figure 2. Two Fourier interpolations: (a) an aortic blood pressure trace which is thought to be adequately sampled; (b)
possibly an impulse, although it could be the unlikely band limited waveform revealed by the interpolation
INTERPOLATION BY FAST FOURIER AND CHEBYSHEV TRANSFORMS 1683

dispensed with in the computer programs and so the procedure is further simplified, although it
is still necessary to halve the coefficient dNI2.Where N happens to be a power of 2 the real FFT is
the most efficient of all.7 Computation of the inverse is the most costly part of the process and so
it is advantageous to make pN even or better still a power of 2 (which of course implies that p and
N are both powers of 2). Figure 2 shows two interpolations achieved in this way; the ripple in
Figure 2(b) suggests that the sampling may not after all have been adequate.
The method lends itself conveniently to two dimensions. Figure 3 illustrates a contour
drawing of an interpolation to a 32 x 64 array from 24 measuring positions. As originally
reported' this application used a two-dimensional transform, but the manipulation is more
convenient if one dimension is interpolated before the other to give the identical result.

The fast Chebyshev transform


The relationship between the Chebyshev coefficients and the DFT has been pointed out at
various times"s but only exploited once, in numerical quadrature by Gentleman.s In general,4
the best discrete approximation of order N - 1 to the infinite Chebyshev series is the expansion
co
fCx)=-+
2
c
N-l

n=O
C"T"(X) (11)

over the range -1 S x S 1, where Co, C 1 , .. . , CN-1 are the Chebyshev coefficients approxi-
mated by

cn=-
2
N
c Fk cos (2k +Nl ) n r
N-l

k=O
n = 0,1, . . . ,N - 1

SUBJECT C.E.

MlCROVOLTS
1684 D . M. MONRO

obtained using samples F k = f ( x k ) which are not uniformly spaced in x k

but which are regularly spaced in tk

The Chebyshev polynomials Tn are defined by


T,(x)= cos nt (15)
and the series ( 1 1) is most usually evaluated by Clenshaw's algorithm' based on the recurrence

with

However, observe that by substitution in (1l ) ,

co N1- l n(2k + 1 ) ~
f(Xk)=Fk=-+ cnCOS k = 0 , 1 , . . . ,N - 1
2 n=l 2N
which forms a discrete transform pair with (12). This could justifiably be caIled the discrete
Chebyshev transform, although it is also referred to as the discrete cosine transform.'
A rapid means of evaluation based on the FFT is sought. It is evident from (12) and (17) that

c n =-c2N-n (19)
i.e. if extended { F k } would most naturally be Hermite symmetric in length 2N - 1 and the pair
can be written in terms of sums of double length 2N

12N-1 n(2k + l ) ~
Fk = - 1 Cncos k = 0 , 1 , . . . ,2 N - 1
2 n=O N
with
2 n(2k + l ) ~
cn=-
2N
c
2N-1

k=O
F k COS
2N
n =0,1, . . . ,2N - 1
It follows readily that a pair amenable to treatment by the FFT is
12N-1
..=Re{? c
n =O
Cne
ind2N
e
i2?rkn/2N
k = O , 1 , . . ., 2 N - 1 (22)

and
INTERPOLATION BY FAST FOURIER AND CHEBYSHEV TRANSFORMS 1685

Equation (22) is the inverse DFT of length 2N using the Chebyshev coefficients {C,} multiplied
by a time-shifting function exp (jn.rr/2N).Equation (23) is the DFT of {Fk} post-multiplied by
the opposite shift. In interpolation these shifts are not exactly self-cancelling because different
transform lengths are used. It will be seen, however, that both the procedure and the results are
more convenient if the shifting factors are omitted. For the present, the development in the most
usual form will be pursued. In general, the DFT of {Fk}is not real because the Hermite symmetry
is of length 2N - 1, not 2N.

Interpolation by Chebyshev transforms


The importance of Chebyshev polynomials in curve fitting is well e ~ ta b lis h e dThere
.~ is for any
function a polynomial interpolating function with minimum maximum error, and it is easily
shown that this interpolation has Chebyshev-like proper tie^.^ Although the Chebyshev series is
not exactly this minimal interpolation, in general if the coefficients {C,} decrease rapidly it is
very nearly identical in -1 S x s 1. The coefficients {C,} normally decrease much more rapidly
with n than do those of a Fourier series. Additionally, the errors are evenly distributed over the
interval of fit with at most one extremum in the truncated Chebyshev polynomial between the
given values, which it passes through exactly. These are excellent qualifications for inter-
polation.
Interpolation by transform is straightforward and similar to the Fourier interpolation, as
illustrated by Figure 4. The N data values are distributed in t according to equation (14), and are

cn t

Figure 4. Interpolation by Chebyshev transform: (a) 9 samples of a curve arranged as 18 values in Hermite symmetry;
(b) the Chebyshev coefficients; (c) expanded array of 54 coefficients; (d) the interpolated waveform
1686 D. M. MONRO

arranged in an array of length 2N which is given Hermite symmetry by repeating all the data in
reverse order in the upper half. The discrete Fourier transform of length 2N is computed, which
is always even so that a real transform procedure can always be used. The results of the
transform are post-multiplied by exp ( - j n ~ / 2 N and
) the real parts are transferred to the
appropriate locations in an array of length 2pN in an analogous manner to equations (9) and
(lo),where p is again the integer interpolation factor. The coefficient CNwill always be zero, so
it is not necessary to divide its amplitude. Each non-zero coefficient is then premultiplied by
) the inverse DFT is applied. The result is an interpolated array of 2pN data
exp ( j n 7 ~ / 2 p Nand
values with Hermite symmetry. The first pN values are the interpolation but their relation in
time to the original set is worth consideration.
Figure 5 shows the relation between original and interpolated data values for odd and even
values of p . The original samples were taken at
(2k + 1 ) ~
tk = k = O , 1,.. . , 2 N - 1
2N

and the interpolated results occur at


(2k + 1 ) ~
tk = k = 0 , 1 , ... , 2 p N - 1
PN

(b )
Figure 5. Relationships between original and interpolated ordinates using the transform pair of equations (20) and (21):
(a) for odd factor p = 3, N = 3; (b) for even factor p = 2, N = 3
INTERPOLATION BY FAST FOURIER AND CHEBYSHEV TRANSFORMS 1687

and it is clear from (25) and in Figure 5 that the interpolated result is only a refinement
containing the original samples if p is odd. The first and last (p - 1)/2 samples are outside the
interval enclosed by the original data if p is odd. For evenp there are p/2 outside samples at each
end.

Interpolation with coincident samples


Since equations (22) and (23) contain a time-shifting factor it is logical to enquire into the
effect of eliminating the shift. In the forward transform this implies the use of

(26)

as the assumed sampling points. In this case the Chebyshev transform pair becomes
2N-1
Fk --1
2 C Cne
jZrknf2N
k =0,1, .. ., 2 N - 1
n=O

with
2
c n = 2 N kcO
2N-1
Fk e
-j2rrkn/2N
n =0,1,. ..' 2 N - 1 (28)

which is-an attractively simplified procedure involving the FFT alone of the doubled-up data.
The coefficients C,, are now complex and the identical function is obtained on reconstruction,
but the samples are taken at different places after interpolation by a factor p,

(29)

which is convenient because the reconstructed set of pN samples is always a refinement which
contains the original N for any p. Figure 6 makes this clear. The last p - 1samples are outside the
interval enclosed by the original data.

Chebyshev series of the second kind


Another alternative is provided by a second kind of approximation to the Chebyshev
polynomial, as was used in Gentleman's program for numerical quadrature.' Except in special
circumstances the interpolations are not as good either in theory4 or in practice. However, there
is the advantage that the interpolated functions include the original samples for any integer
interpolation factor without the coefficients being complex.
The form of the series of second kind of order N - 1 is?

t Although Gentleman' refers to this as the Chebyshev series of the second kind, that title is more traditionally reserved
for the series formed from the functions

u,= sin(r+l)O
sin 0
which have practical disadvantages in curve fitting and have received little attention. In this paper the terms first and
second kind distinguish the alternative definitions of the cosine series.
1688 D. M. MONRO

? Interpolated

0 "4 2"s = 4y3 5% '2; ;

(b)
Figure 6. Relationships between original and interpolated ordinates for the shifted transform pair of equations (25) and
(26): (a) p = 3, N = 3; (b) p = 2, N = 3

with real coefficients

for

which is regularly sampled in tk:

The symmetry relationships in this formulation are


cn = C 2 N - n - 2 (34)
and
Fk = F 2 ~ - k - 2 (35)
INTERPOLATION BY FAST FOURIER AND CHEBYSIIEV TRANSFORMS 1689

in which the Hermite symmetry is of length 2N - 2 and applies to both {C,} and { F k } . Therefore
a (not quite) double-length transform pair which is amenable to treatment as a discrete Fourier
transform consists of
2N-3 2rkn
Fk --1
2 c
n=O
cncos-
2N-2
k = 0 , 1 , ..., 2 N - 3

and
2 2N-3 2r k n
cn=- 1F k COS- n = 0 , 1 , . . . ,2 N - 3 (37)
2N-2 k=O 2N-2
which is very convenient.
For interpolations of an N point sequence, the given values are entered in the first N locations
of an array of length 2N - 2. The inner N - 2 values are repeated above these in reverse order to
complete the Hermite symmetry. Note that the first and last values are not repeated; this is the
practical differencebetween methods of the first and second kind. A discrete Fourier transform
of length 2N - 2 will provide the coefficients {Cn}which are purely real. For an interpolation by
an integer factor p, these are arranged in an array of length p ( 2 N - 2 ) and in this case the
amplitude of coefficient C N p 1must be halved in the split. The inverse transform then gives
p ( N - 1)+ 1 useful points sampled at

which is a refinement of the original samples as in equation (33)for any p which includes exactly
the original samples.
This kind of interpolation of a short ramp is illustrated by Figure 7 for N = 4 and p = 4 . The
Hermite symmetry is shown, as is the angular relationship between original and interpolated
samples.

DISCUSSION AND EXAMPLES


Either kind of Chebyshev series can be used to interpolate one cycle of a periodic function. To
force a join at the ends, the first value is repeated as the last, so that to interpolate a waveform of
period M samples, M + 1are used. The first kind of Chebyshev series is likely to produce a more
satisfactory fit except that there will be a discontinuity of slope at t = 0 and t = r,but this does
not coincide with the sample values. When the time shift of Figure 6 is applied, the problem still
exists. The Chebyshev series of the second kind does have derivative continuity at the join where
the slope is zero and the first and last samples occur as in Figure 7. If these samples are the same,
a visually perfect join results. However, the fit may not be as good elsewhere.
In Figure 8 are shown interpolations obtained by several methods of a difficult periodic graph
which is undersampled. The data is from a spatial electrocardiogram measured at an instant
around the chest of a human subject.
To check the hypotheses that 8 samples are adequate for graphical representation, 24 samples
were taken and a subset of 8 chosen. Attempts were made to reconstruct all 24 from the 8 by
Fourier and both kinds of Chebyshev interpolation. To force a join at the ends for the
Chebyshev interpolations the first sample is repeated as the ninth so that the double arrays are of
length 18 for the first kind and 16 for the second. It is evident that 8 is an insufficient set for
Fourier interpolation and that by far the best interpolation is provided by the first kind of
1690 D. M. MONRO

Figure 7. Relationships between original and interpolated ordinates for the transform pair of equations (34) and (35)
with p = 4 and N = 4. The function is a ramp

Chebyshev series. A simple spline fit by cubic segments is also shown using the central difference
differentiation formula
fn-2-8fn-1+ sfn+l -fn+2
fl =
12
This is also felt to be inferior.

/XI
I..":.\ __ Original 2 4 samples
Fourier reconstruction
- -.
o
Chebyshev reconstruction, 1st kind
_ _ x Chebyshev reconstruction, 2nd kind
_- 4 Cubic spline reconstruction

'*.& /
a '

Figure 8. Interpolation of periodic spatial electrocardiographic data from a row encircling the chest of a human subject.
Shown are the original 24 samples and interpolations from a subset of 8 using FFT and Chebyshev interpolations, and a
simple spline fit
INTERPOLATION BY FAST FOURIER AND CHEBYSHEV TRANSFORMS 1691

L
......*
..... ............*,.' .

..........

..,,_,_0 ...... ...'.... ........


.... . ...... ,.

....""'. .''...'.' k*
Figure 9. An interpolation by Chebyshev transform of the first kind from 27 samples of an aperiodic function (a section
of a temperature field) by factor 4

LfO Y O 'E

30 7 30 Y

20 ' 'F
Figure 10. A geopotential contour map interpolated from a 15 x 15 original by factors of 12 in each direction to give
169 x 169 (ignoring the outside end values)
1692 D. M. MONRO

It is important to realize that the Chevyshev methods are sensitive to angular displacement
unlike the others; in other words, the choice of the place to make the join affects the shape of the
interpolation. In general, the ‘difficult’ parts of the function are best placed at or near the join
because the Chebyshev fit is optimized towards the ends of its interval of a p p r ~ x i m a t i o n . ~
For aperiodic waveforms the interpolation is carried out on the given values as in Figure 9,
which is an interpolation of a cross-section of air temperature data over a geographical area.
That Chebyshev interpolation lends itself naturally to two dimensions is demonstrated by Figure
10, which is a double contour plot of meteorological information interpolated from a 15 X 15
original by factors of 12 and 12 using the first kind of Chebyshev series, The interpolations are
carried out independently in each dimension.
Gentleman5 demonstrates how a special FFT can be arranged to compute the DFT of a
Hermite symmetric series of length 2 N - 2 using only N storage locations which is, however,
subject to the restriction that 2 N - 2 is a power of 2, meaning that N itself is one greater than a
power of 2. It also seems restricted to use with the second kind of Chebyshev series. For the
general case of interpolation, it is best at present to be satisfied with double-length transforms to
preserve generality in the length N ; these can always be of the real type.

CONCLUSIONS
It has been demonstrated that the close relationship between the discrete Fourier transform and
the Chebyshev series can be exploited to achieve fast interpolation of regularly spaced data. The
method appears to have advantages because of its speed and the near optimal aspects of
Chebyshev polynomials. By placing a curve of good characteristics exactly through the data
points, the method faces directly the traditionally difficult task of interpolation. The transform
method lends itself naturally to the multi-dimensional situation.

ACKNOWLEDGEMENT

The meteorological data used in Figures 9 and 10 were provided by the European Centre for
Medium Range Weather Forecasts (ECMWF) at Bracknell, Berkshire, England for purposes of
demonstration of interpolation and contouring programs. Figure 10 was prepared on ECMWF
facilities. Thanks are due to D. R. Attwood for carrying out some of the calculations.

REFERENCES
1. N. Ahmed, T. Natarajan and K. R. Rao, ‘Discrete cosine transform’, ZEE Trans. Computers;23 90-93 (1974).
2. C. W. Clenshaw, ‘A Note on the summation of Chebyshev series’, Mathi Tables and Other Aids to Computation 9,
118 (1955).
3. J. W. Cooley and J. W. Tukey, ‘An algorithm for the machine calculation of complex Fourier series,’ Math. Comp.
19 297-301 (1965).
4. L. Fox and I. B. Parker, Chebyshev Polynomials in Numerical Analysis, Oxford University Press, 1968.
5. W. M. Gentleman, ‘Implementing Clenshaw-Curtis quadrature, I1 computing the cosine transformation’,Comm.
ACM, 15,343-346 (1972).
6. D. M. Monro, ‘Complex discrete fast Fourier transform’, Algorithm AS83, Applied Statistics, 24,153-160 (1975).
7. D. M. Monro, ‘Real discrete fast Fourier transform’,Aigorithm AS97, Applied Statistics, 25, 166-172 (1976).
8. D. M. Monro and J. L. Branch, ‘The Chirp discrete Fourier transform of general length’, Algorithm AS1 17, Applied
Statistics, 26, 351-361 (1977).
9. D. M. Monro, R. A. L. Guardo, P. J. Bourdillon and J. Tinker, ‘A Fourier technique for simultaneous
electrocardiographicsurface mapping’, Cardio. Res. 8,688-700 (1 974).
10. L. R. Rabiner, J. W. Cooley, H. D. Helms, L. B. Jackson, J. F. Kaiser, C. M. Rader, R. W. Shafer. K. Steightz and C.
J. Weinstein, ‘Terminology in digital signal processing’, ZEEE Trans. Audio Electroacoustics, AU-20,322-337
(1972).

You might also like