convolution lies outside the realm of this book, but can be found in many
textbooks on mathematics or on mathematical physics. Here we merely
The connection of convolution with Fourier transformation (and the
reason to include it in this chapter) lies in the convolution theorem, which
shows that a convolution in the time domain is equivalent to a simple multi-
plication in the frequency domain, and vice versa:
y(t) ⇔X(f )·Y(f )
Consequently we can use Fourier transformation to perform a convolu-
tion. This is illustrated in spreadsheet exercise 7.5-1 by using a simulated
spectrum of three almost baseline-separated peaks, and showing the broad-
ening (i.e., loss of resolution) resulting from, e.g., using a spectrometer with
wide-open slits. Alternatively one might think of that example in terms of,
say, nearly baseline-separated chromatographic peaks, distorted by a detec-
tor with too large a dead volume. The mathematical symbols t and f merely
denote complementary parameters, such that their product is dimension-
less. We will here describe convolution generically in terms of time and fre-
quency, but t could also stand for, say, wavelength, in which case f would
denote wave number.
Before we embark on exercise 7.5-1 we will ﬁrst sketch its spreadsheet
layout, see Fig. 7.5-1. We will use two input functions, x(t) and y(t), to be
placed in columns ABC and GHI respectively, say tin column A, the real part
Re(x) of x in B, and its imaginary part Im(x) in C. Columns DEF and JKL are
reserved for their Fourier transforms, X(f ) and Y( f ) respectively. In columns
MNO we then multiply X and Y to form their product, X·Y, and in columns
PQR we ﬁnally calculate the convolution x
yby inverse Fourier transforma-
tion of X ·Y. Note that the individual components of X(f ) and Y( f) are
complex numbers, which must be taken into account in computing their
Below we will convolve a synthetic signal (in A12:B75) with a window
function (in G12:H75) and observe what happens. First we will use a -
shaped window function, one that mimics the eﬀect of, say, a narrow slit on a
spectrum as long as edge diﬀraction can be neglected.
X( f )
X · Y
multiply X and Y →X · Y
Fig.7.5-1:The layout of the data in convolution exercise 7.5-1. The top row identiﬁes the
columns used, the middle row the functions encountered there, and the bottom row the
mathematical operations between them. The data for X ·Yare computed as the prod-
ucts of the complex numbers in X( f ) and Y(f ).
Instructions for exercise 7.5-1
1 Open a spreadsheet.
2 In cells A10, G10 and P10 deposit the label time; in cells D10, J10 and M10 the label
freq., in cells B10, E10, H10, K10, N10, and Q10 the label real, and in cells C10, F10, I10,
L10, O10, and R10 the label imag.
3 In cells A12:A75 and G12:G75 place the times -4 (0.125) 3.875.
4 In cell B12 deposit the instruction=0.4*EXP(-((2.3+A12)^2)/0.2)+0.5*
EXP(-((0.7+A12)^2)/0.2)+0.3*EXP(- ((1.1-A12)^2)/0.2) or a similar expression
containing a number of almost baseline-separated peaks. (Here we use Gaussians, but
you can take other functions.) Copy this instruction down to row 75.
5 In C12:C75 deposit zeros.
6 In A1:C8 place a thumbnail sketch of the function x(t).
7 Fourier transform these data to generate X(f) in columns DEF.
8 In D1:F8 place a small graph of X(f).
9 Fill H12:I75 with zeros, then deposit the value 1 in cell H44.
10 Plot y(t) in G1:I8.
11 Fourier transform G12:I75 to obtain Y(f) in J12:L75.
12 Plot Y(f) in J1:L8.
13 Copy the frequency scale (i.e., the contents of D12:D75 or J12:J75) to M12:M75.
14 Now comes the multiplication of the complex numbers. Consider X(f) as a set of
complex numbers e +j f where j=
, and likewise Y (f ) as a set of complex
numbers k+j . We then have (e +j f ) (k +j )=(e k - f )+j (e + f k). Therefore, in
cell N12 deposit the instruction= E12*K12-F12*L12 (for the real part of that
product), and in cell O12 the instruction =E12*L12+F12*K12 (for its imaginary part).
This will generate the product X ·Y. Copy these two instructions down to row 75.
15 Make a graph of X·Yin M1:O8.
16 Finally, use the inverse Fourier transform of M12:O75 to compute the convolution x
in P12:R75, and show it graphically in P1:Q8. The top of your spreadsheet should now
look similar to Fig. 7.5-2.
The operation does not modify the original signal beyond reducing its
amplitude, as an ideal monochromator slit also would, by restricting the
amount of light that reaches the photodetector. Below we will take care of
that signal attenuation.
Fig.7.5-2:The top of the spreadsheet, shown here in two parts (since it is too wide to
display in one piece), as it might look at this point.
17 Normalizing the window function is most readily done by using as normalizing factor
the average value of the window function y(t) used. Therefore, modify the instruction
in N12 by dividing it by AVERAGE($H$12:$H$75) or, equivalently, by $K$44, and simi-
larly correct the instruction in O12. Copy both modiﬁcations down to row 75.
18 Repeat the inverse FFT of M12:O75. Now you should recover the original function of
A12:C75 without attenuation, because we have eﬀectively convolved it with the digital
equivalent of a Dirac delta function, which is zero everywhere except at one place
(here: t= 0), where it is so large that it has unit area.
We are now ready to explore the consequences of various window func-
19 Replace the zeros by ones in H42, H43, H45, and H46.
20 Apply the Fourier transform to G12:I75, and the inverse Fourier transform to M12:O75.
21 You have now simulated opening the monochromator slits (without changing the
amount of light falling on the photodetector, because of the normalization you built in
at step 17), and you will see the resulting distortion of the output signal, as illustrated
in Fig. 7.5-3.
22 Figure 7.5-3 also shows the eﬀects of widening the window even further. Verify those
Other window functions, such as triangular windows of variable widths,
can also be used. In fact, there is a whole bevy of window functions available,
often named after their originators or proponents, such as Bartlett,
Hamming, Hanning, Parzen (for the triangular window), and Welch. Some of
these are discussed in Section 12.7 of the book Numerical Recipes (W. H.
Press et al., Cambridge University Press 1986).
23 Reﬁll H12:H75 with zeros.
24 Replace the zeros in H41 through H47 by 0.25, 0.5, 0.75, 1, 0.75, 0.5, and 0.25 respec-
tively. This constitutes a triangular window.
25 Fourier transform G12:I75, then inverse Fourier transform M12:O75.
We note that the convolution causes a broadening of the original peaks,
reducing their heights and increasing their widths, thereby increasing
their overlap. This smearing eﬀect can be reduced by using a narrower
(and therefore less distorting) window function y(t), or worsened by
making y(t) broader. Incidentally, in this particular example, by using a
How to C#: Basic SDK Concept of XDoc.PDF for .NET
delete, re-order, copy, paste, cut, rotate, and PDF file text processing like text writing, extracting process images contained in PDF document, the following C# c# extract text from pdf; extract text from pdf file
VB.NET PDF: Basic SDK Concept of XDoc.PDF
delete, re-order, copy, paste, cut, rotate, and PDF file text processing like text writing, extracting process images contained in PDF document, the following VB delete text from pdf online; get text from pdf c#
rectangular window of 15 or more points, we may even generate phantom
While there will be other convolution exercises, we will postpone them
until we have simpliﬁed the computation. To that end a simple macro is pro-
vided, called Convolution. For the sake of simplicity it assumes that the
input functions have no imaginary components, and that the same applies
to the resulting output function. Moreover, it does not display any of the
intermediate transforms. These constraints greatly simplify the spread-
sheet, since now only four columns are needed: one for the common time
scale, two for the two real input functions, and one for the result. The macro
handles all mathematical manipulations out-of-sight, but the method
follows the same logic as exercise 7.5-1, and its VBA code is given in section
10.6. You will need this macro for the next few exercises; if it has not yet been
installed on your computer, this is the time to copy it from the disk(ette) into
your spreadsheet module.
For the convenience of the user, the Convolution macro has been written
such as to accept a time scale that can start at any arbitrary value. Of course,
the time increments must still be equidistant, and there must be 2
data, where N is a positive integer subject to the constraint 2 N10.
Fig.7.5-3:Distortion resulting from a rectangular window of increasing width.
(a): Original signal; (b): after convolution with a ﬁve-point rectangular window func-
tion; (c): after convolution with a nine-point rectangular window function; (d): after
convolution with a 13-point rectangular window function.
Instructions for exercise 7.5-2
1 Open a new spreadsheet.
2 In cells A10 through D10 deposit the labels time, x, y, and x*y respectively.
3 In cells A12:A75 place the times 0 (0.125) 7.875.
4 In cell B12 deposit the instruction=0.4*EXP(-((1.7-A12)^2)/0.2)+0.5*
EXP(-((3.3-A12)^2)/0.2)+0.3*EXP(- ((5.1-A12)^2)/0.2) or a similar expression.
Copy this instruction down to row 75.
5 In C12:C75 deposit the nine-point rectangular window function used in exercise 7.5-1.
Make sure that it is centered around C44, i.e., that its ones are placed in C40:C48.
6 Highlight the area A12:C75, and call the macro Convolution.
7 The result x
ywill now appear in D12:D75.
8 In A1:D8 make a graph of x, y, and x
yversus t. Figure 7.5-4 shows what the top of your
spreadsheet might now look like.
Fig.7.5-4:The top of the spreadsheet showing a convolution. The original function xis
shown in color, the window function yas open circles, and the convolution x
Now, with the macro taking care of the mechanics of convolution, we can
more conveniently explore its properties. First, move the window function y
around on the time axis.
9 Move the set of nine contiguous 1’s in C12:C75 a few spaces forward or back, and
record the resulting convolution. Remember, the convolution macro does not update
automatically, but must be invoked every time you want it updated.
10 Also, move it more boldly, i.e., more than a just a few spaces. Figure 7.5-5 shows such a
Clearly, shifting y with respect to xyields a phase shift of the resulting con-
y. It is as if the open circles drag the closed circles with them. In
order to avoid such phase shifts we will below only use centered window
11 Explore the eﬀect of other window functions, such as the triangular function (see exer-
cise 7.5-1 under instruction 24), a trapezoidal function, a Gaussian, a Lorentzian, or
12 Note that too wide a window function may make the convolution spill over an edge.
You can avoid this by adding zeros to the beginning and end of columns B and C, with
an accompanying extension of the time scale in column A. The total number of points
must remain an integer power of 2, so that it is best in the present example to add 32
zeros at both the beginning and end.
Fig.7.5-5:Shifting the center of the window function (here a nine-point rectangular
function) oﬀ-center causes a time shift of the resulting convolution (solid black circles).
Why belabor convolution? Obviously, instruments or methods sometimes
distort what we want to measure, and the answer would seem to be to build
instruments or utilize methods that introduce less distortion. True enough,
but we seldom can wait for the ideal instrument or procedure, and typically
need to work with what is available to us now. Here is where convolution
comes in or, rather, deconvolution.
We will ﬁrst summarize what we have found so far. Let us assume that we
have some quantity q (such as a spectrum, a chromatogram, or a decay
curve) that we want to measure, with a minimum of distortion. The observa-
tion convolutes this with a response function r, which may be caused by,
e.g., instrumental distortion. Consequently what we measure is the signal s,
which is related to q by
In general, q, r, and s will be functions of wavelength (for a spectrum), of
time (for an audio response, or a ﬂuorescent decay), etc. We measure the
signal s, but we are really interested in the underlying, undistorted quantity
q. We have seen that Fourier transformation converts (7.6-1) into a simple
where, as before, capital symbols denote the Fourier-transformed quan-
tities, and the sign×stands for multiplication.
Let us assume for the moment that we can measure the instrument
response function r by itself. We certainly can measure the signal s. We then
take their Fourier transforms, which yields R and S. Equation (7.6-2) now
allows us to calculate Q simply as Q= S / R. From there it is only an inverse
Fourier transformation to calculate q, the quantity of interest, corrected for
distortion! This process is called deconvolution. The same macro that can
perform a convolution can also do the deconvolution. The relevance of
deconvolution to spectrometry is illustrated in W. E. Blass and G. W. Halsey,
Deconvolution of Absorption Spectra, Academic Press 1981, and P. A.
Jansson, Deconvolution with Applications in Spectroscopy, Academic Press
You may think that this sounds too good to be true, and it often is: in prac-
tice it may not always be possible to recover the undistorted signal. But
sometimes we can, and the following exercises will demonstrate under what
conditions this may be the case.
Instructions for exercise 7.6-1
1 Reopen the same spreadsheet used for exercise 7.5-2.
2 Place the labels time, x
y, y, and x (or, if you prefer, s, r, and q) in cells E10 through H10.
3 Copy the column starting with A12 to cell E12.
4 Likewise, copy the data for x
y in column D to the new column F. And copy the column
for y from C to G. Do not ﬁll column H.
5 Highlight the data in columns E through G, and use the macro to deconvolve them.
6 Ignore for now the input box labeled Adjustable Hanning Window; when it shows, just
7 In E1:H8 plot the data in columns F through H versus those in column E. You should
obtain a copy of the graph in A1:D8, except that the input and output curves are
8 Also compute, in column I, the diﬀerence between corresponding data (on the same
row) in columns B and H. You may have to multiply the diﬀerence by quite a large
factor to see non-zero numbers.
So far so good: the method works beautifully. Then why the warning on the
previous page? Here is the problem: the presence of noise often makes
deconvolution impractical or even impossible. Again, we will use the
spreadsheet to demonstrate this.
9 Generate two columns of Gaussian noise of zero average and unit standard deviation,
and in new columns add natimes that noise to both the signal in column F and the
response function in column G. (Of course add noise from a diﬀerentset to each
column.) The noise amplitude nais used to control the amount of noise added.
10 Now increase the value of nafrom, say, 1E-12 to 1E-6, 1E-3 and 1E-2, every time
invoking the macro to perform the deconvolution.
As Fig. 7.6-1b shows, deconvolution is extremely sensitive to noise. While
convolution smears out and smoothens the data, deconvolution does the
opposite. As long as the noise is very much smaller than the signal, deconvo-
lution works well; with relatively more noise, deconvolution may not be fea-
Since our deconvolution method is based on Fourier transformation, a
simple method for noise reduction suggests itself: take the Fourier transforms
X ·Yand Y of the noisy functions x
yand y, and ﬁlter both (or just Y in case y is
noise-free) by replacing their high-frequency parts by zeros before perform-
ing their division. Here we use a somewhat more gradual high-frequency
cut-oﬀ function [0.5+0.5 cos(
, based on the Hanning window
), made adjustable with the parameter w so that we can
select the minimum noise reduction needed.
Figure 7.6-3 illustrates some results of such filtering on the data of Fig. 7.6-
1b. As can be seen, the presence of noise now generates oscillations, and fil-
tering these out by increasing w (i.e., by narrowing the frequency range)
introduces considerable distortion. Deconvolution clearly works best for
signals with a very high signal-to-noise ratio.
In order to see what is happening here we go back to the power spectrum.
Figure 7.6-2 shows the power spectra of the original function (the colored
curves in Figs. 7.5-4 and 7.5-5) on two diﬀerent scales, and the power spec-
trum of the same with added noise as was used in Fig. 7.6-1b. Clearly, when
the noise gets larger, it will obscure all but a few low frequencies, and eventu-
ally these will be overwhelmed as well. At that point, the original signal obvi-
ously cannot be recovered any more by deconvolution.
Keep in mind that, because of the Nyquist criterion, the number of avail-
able frequencies is only half the number of data points. Or, to put it diﬀer-
ently, all frequencies f in the Fourier transform have their negative
counterparts at -f. The largest number you can therefore select for ﬁltering
is half the number of data points in the set, and at that point you would ﬁlter
In order to decide at what frequency to start ﬁltering, we go back to the
power spectrum. Figure 7.6-2 shows the power spectra of the original func-
tion (the colored curves in Figs. 7.5-4 and 7.5-5) on two diﬀerent scales, and
the power spectrum of the same with added noise as was used in Fig. 7.6-1b.
Clearly, when the noise gets larger, it will obscure all but a few low frequen-
cies, and eventually these will be overwhelmed as well. At that point, the
original signal obviously cannot be recovered any more by deconvolution.
Unfortunately, the boundary between signal and noise is not sharp: there
is signal and noise at all frequencies. The color in Fig. 7.6-2 suggests what
Fig.7.6-1:Deconvolution of x
y with y when both have added Gaussian noise of ampli-
tude na=0.001 (left) and 0.01 (right) respectively. Colored points: the deconvoluted
data; colored line: the original curve.
Documents you may be interested
Documents you may be interested