K&rational Spectroscopy, 3 (1992) 155-160 Elsevier Science Publishers B.V., Amsterdam
155
The Kalman filter in quantitative infrared spectral analysis K. Volka *, M. Suchanek and P. Urban Department of Analytical Chemistry, Prague Institute of Chemical Technology, 166 28 Prague (Czechoslovakia) (Received 24th September 1991)
Abstract
The feasibility of determining the components in model mixtures of heptane with hept-1-ene, c&-hept-2-ene and hept-3-ene by applying adaptive Kalman filtration of the infrared spectrum was examined. The minority components were found to be determinable with satisfactory accuracy and repeatability, which, combined with the rapid and simple processing, makes the method suitable for technological process control purposes. Keywords: Infrared spectrometry; Kalman filter
The Kalman filter has been employed in analytical chemistry since 1979, when it was applied to the deconvolution of overlapping UV-visible spectra [l]. Resolution of overlapping signals and calibration remain the principal fields of application of this algorithm in analytical chemistry, not only in conventional spectrometry but also, for instance, in the smoothing and quantification of electrochemical peaks [2]. Its established main asset consists in its ability to model complex chemical relationships directly from experimental data, as can be demonstrated by the work by Monfre and Brown [3], who were able to determine parameters of ester hydrolysis directly from Fourier transform infrared (FIXR) spectra. In this work, the Kalman filter was applied to a typical analytical task, viz., the analysis of a multi-component mixture by infrared spectral analysis. The object of the study was mixtures of heptane with hept-1-ene, cis-hept-2-ene and hept-3=ene, which served as models of technologically interesting mixtures such as products of the hydrogenation of oligomers. The aim of the work 0924-2031/92/$05.00
was to examine the potential of the Kalman filter in quantitative analysis with respect to the accuracy and repeatability of the results.
THEORETICAL
Concentrations of components of a multi-component mixture usually satisfy the Beer-Lambert law, which for the Kalman filtration purposes can be written in the form a(k)=hT(k)*c+r
(1)
where a(k) is the absorbance at the k th wavelength, c is the concentration vector and hT is the transpose of a vector h containing the molar absorption coefficients of all species at the kth wavelength. Vector h has to be determined prior to the calculation, e.g., by measuring the spectral dependences for the pure components. The term r is referred to as the measurement noise. The concentrations are assumed to be independent of
0 1992 - Elsevier Science Publishers B.V. All rights reserved
156
K. VOLKA
time and Beer’s law is assumed to be a true model. Therefore, the equation of state can be reduced to c(k) =c(k-1)
(2)
where k is a sequential step of the filter corresponding to the kth wavelength. Equation 1 can be solved for parameters c either by conventional regression methods or by using various kinds of filters, including the Kalman filter. The advantages of Kalman filtration in the processing of signals from multi-component analysis are its insensitivity to gross errors during the measurement of the points and the possibility of establishing invalidity of the model (Eqn. 1) across the entire spectral region, e.g., due to other components present being ignored. The algorithm of the Kalman filter for the calculation of the estimate of concentrations of all components includes the following sequence of equations: Kalman gain: k(k)=P(k-1)-h(k) .[hT(k)+-‘(k-l).h(k)+r]-l Update covariance tor:
matrix of concentration
vec-
1)
i i
(4)
v(k -j)
j=l
.v(k -j) 1
-hr(k)+‘(k-1)-h(k)
vector in kth point:
e(k)=t(k-l)+k(k).a(k)-h=(k) *C(k-
chosen to be high (high uncertainty of the initial concentration estimate). The measurement noise r must be known in advance; its value is determined as the average variance of the baseline. In the adaptive Kalman filter the noise is automatically changed (see below). The Kalman filter has many advantages but also some shortcomings. The advantages include high flexibility of the model, the possibility of on-line filtration and reduced demands placed on the computer memory as the matrix inversion operation is not used in the calculation of the parameter estimates. Unless the chemical model has been established unambiguously, the model parameters (concentrations) are not determined correctly, and filter divergence can take place (concentration estimates do not converge to constant values). The filter can also diverge if some of the points measured are beyond the region of measurement. In such cases the so-called adaptive Kalman filter can be employed. In this algorithm one calculates the adaptive variance R(k) which replaces the measurement noise in the conventional filter; this is done recursively according to the equation [4] r(k) = (l/m)
P(k)=P(k-l)-k(k).hr(k)+‘(k-1) Update concentration
(3)
ET AL.
(5)
where k(k) is a vector (n x l), P(k) is a covariante matrix (n x n), i%(k)is the vector of concentration estimates (n x 1) and n is the number of assumed chemical components in the model. Kalman gain is the weight factor for the calculation of concentration in the kth point from the value in the preceding point. It is clear from the algorithm that starting estimates P(O) and c(O) are prerequisite for commencing the calculation. The c(O) estimate is usually chosen to be zero in the first passage of the filter; in the subsequent repeated passages through the same data the zeroth approximation is usually the result of the first passage. The diagonal values of P(O) are
(6) where m is the length of the smoothing window and v(k) is the kth element of the so-called innovative sequence: v(k)=a(k)-hT(k)*c(k-1)
(7) which is the difference between the experimental absorbance and its Kalman filter estimate. This sequence should possess properties of white noise with a zero mean value. It can be used to establish a poorly measured signal or an erroneous model.
EXPERIMENTAL
Alkenes (hept-1-ene, hept-3-ene and c&hept2-ene) and heptane were distilled with sodium
KALMAN
FILTER
IN QUANTITATIVE
157
IR ANALYSIS
prior to use. Mixtures were obtained by precise weighing-in of the components. Infrared spectra of the pure substances and their mixtures were measured on a Specord M 80 grating spectrophotometer (Carl Zeiss, Jena) using slit programme 4, integration times 1, 3 and 5 s and wavenumber axis expansion, whereby intensity data were obtained in 2 cm-l steps. Owing to the instrument design, each IR spectrum is obtained as a set of discrete values for the individual wavenumbers, the integration time being the time for which the signal is integrated in the sample beam; the time corresponds to the time of integration in the reference beam. The measurements were performed in three blocks in the regions of 2800-2500, 1900-1500 and 1300-400 cm-? The data obtained (in the internal representation as integers, 100% = 16384) were transmitted to a PC for processing. The number of points over the entire spectral region was ca. 900. Computer program The basic algorithm of the adaptive filter was taken from [4]; the filter worked in the off-line mode. The program was written in Turbo-Pascal for IBM-AT-compatible computers. Double passage through the adaptive Kalman filter was chosen with a window length of m = 10 points. Transmittance values were automatically converted into absorbances. As the densities and molar masses of the substances studied are close to one another, Eqn. 1
was expressed in weight amounts instead of molar concentrations.
RESULTS AND DISCUSSION
The average noise r was calculated from the spectrometer zero line for the three integration times as the average variance of all 900 points. It showed little dependence on the integration time, its values lying within the range 7.5 x 10-6-1.9 x 10 -‘. The spectrometer standard deviation was about 0.003 absorbance for integration times of 3 and 5 s and 0.004 absorbance for an integration time of 1 s. The accuracy of calculation by means of the Kalman filter depends on the number of points and on the chosen section of the spectrum. The larger the number of points, the less sensitive the calculation is to gross errors during measurement. In some parts of the spectrum where the spectra of the substances approach each other closely the information content is zero; the filter diverges or the content values obtained are incorrect. For testing the properties of the signal in the various parts of the spectrum, a sample containing 2.27% of hept-1-ene and 97.73% of heptane was prepared; the contents of the two constituents (in %, w/w) obtained from the IR spectrum by using the Kalman filter were as follows: 2.56 and 95.8, respectively, from the entire spectrum (2800-400 cm-l); 2.35 and 96.5 (1900-400
TABLE 1 Repeatability of the measurement of (1) heptane and (2) hept-1-ene contents as a function of the spectral region chosen a WOO-400cm- ’
Sample No. b
2800-400 cm-l 1
2
1
2
1
2
1 2 3 4 5 x-c
96.3 96.7 96.1 96.8 98.5 96.9
4.37 3.49 4.10 3.57 2.02 3.51
99.2 98.9 99.2 99.1 96.6 98.6
2.75 2.55 2.59 2.55 2.53 2.59
98.6 99.2 99.1 99.1 97.4 98.7
2.91 2.49 2.56 2.48 2.43 2.57
2.6 0.9,
2.52 0.91
3.1 1.1
0.09 0.25
0.8 2.2
0.53 0.19
1300-400 cm-l
C
E,, c
a Added: 2.38% (w/w) hept-1-ene in heptane solution; cell, 0.053 nmb Independent weighed amounts. c 2 = Average; s= standard deviation estimate; L 1,2= confidence interval (95% probability)
158
K. VOLKA
ET AL.
TABLE 2 Comparison of accuracies of the conventional and adaptive Kalman filters for the determination of (1) heptane and (2) hept-1-ene contents (%, w/w) in binary mixtures (cell thickness 0.117 mm) Found
Added 1
98.99 96.37 94.10 92.03 89.11
2
Conventional Kabnan filter (2800-400 cm-‘)
1.01 3.63 5.90 7.97 10.89
1
2
96.6 93.5 92.1 88.8 86.2
1.15 4.49 7.26 9.62 12.87
Adaptive Kalman filter 2800-4OOCm-’
1900-400 cm-’
1300-400 cm-’
1
2
1
2
1
2
96.8 94.6 93.0 91.0 88.1
0.79 3.45 6.21 7.68 11.02
96.5 94.9 94.6 91.9 89.7
0.85 3.32 5.62 7.17 10.44
96.9 95.0 94.7 91.9 91.5
0.85 3.32 5.56 7.09 9.83
cm-‘); 2.23 and 96.8 (1300-400 cm-‘); and 14.85 and 85.9 (2800-1500 cm-‘). The results indicate that the most accurate values are derived from the 1900-400 and 1300-400 cm-’ ranges, whereas in the 2800-1500 cm-’ range, where the spectra of all the substances are nearly identical, the filter diverges. These results were confirmed for other mixtures. The effect of the integration time on the accuracy of determination was established by analysing a heptane-hept-1-ene mixture containing 2.69% (w/w) of hept-1-ene. The following contents were obtained by processing the spectrum over the 1900-400 cm-’ region: 1 s, 2.69%; 3 s, 2.70%; and 5 s, 2.63%. Hence the results do not differ appreciably, and an integration time of 3 s was applied in subsequent measurements. The repeatability of the determination was examined by evaluating the results for a binary mixture containing 97.62% of heptane and 2.38% of hept-1-ene. The results are given in Table 1,
demonstrating that the confidence interval for the minority component content is ca. 0.3%, which also limits the accuracy of determination of the substances by the spectral method under study. As expected, the higher contents, i.e., the predominating component contents, can be determined with considerably lower accuracy. The effect of choice of the Kalman filter algorithm was investigated; the accuracy for the adaptive Kalman filter was compared with that for the conventional Kalman filter with a constant noise across the entire spectrum. For the latter, the complete spectral region was processed, the results being independent of the choice of the region. The results are given in Table 2. It is evident that the conventional Kalman filter invariantly gives poorer results than the adaptive Kalman filter. Further, it is noteworthy that for higher concentrations of the minority components the results become less accurate. From the determined confidence interval of the minority
TABLE 3 Analysis of mixtures of heptane and heptenes (%, w/w) using the 1900-400 cm-’ spectral range (cell thickness 0.053 mm) Hept-1-ene
Heptane
Hept3-ene
cti-Hept-2-ene
Added
Found
Added
Found
Added
Found
Added
Found
97.5 95.17 97.53 93.08
97.4 95.2 98.7 93.0
0.00 0.00 0.00 2.30
0.01 0.00 0.04 2.45
0.00 2.41 2.47 2.33
0.00 2.49 2.51 2.32
2.48 2.42 0.00 2.29
2.60 2.43 0.04 2.30
KALMAN FILTER IN QUANTITATIVE
159
IR ANALYSIS
C
Fig. 1. Infrared spectra of (a) heptane, (b) hept-1-ene, (c) cis-hept-2-ene and (d) hept-3-ene.
component contents, viz., f0.3%, it follows that minority components can be determined reliably up to 5% contents.
The accuracy of determination of minority components in various mixtures of heptane and heptenes is demonstrated in Table 3. The minor-
160
K. VOLKA
ET AL.
ity component contents were chosen so as to approach those in technological mixtures. For illustration, Figs. 1 and 2 show spectra of the four pure components and of a quatemary mixture, and the course of concentration calculation over the entire spectra1 region and innovative sequences. Whereas for the range of 1300-400 cm-’ the results are virtually identical, for the entire spectrum the results of calculation differ considerably. Table 3 indicates that the accuracy of the analysis of multi-component mixtures of substances which exhibit similar spectra1 properties and occur as minority components is good and the method is usable in practice. Advantages of the method include simplicity of processing, resistance to gross errors and rapidity of obtaining information. For real technological samples it is recommended that mode1 samples should be first measured and processed so as to obtain information on a suitable choice of the spectra1 region, cell thickness and expected precision and accuracy.
I
REFERENCES
J Fig. 2. (a) Innovative sequence and (b) content trends in the Kalman filtration of a quaternary mixture. For content, see Table 3; spectrum trace in absorbance scale included in (b).
1 H.N.J. Poulisse, Anal. Chim. Acta, 112 (1979) 361. 2 T.F. Brown and S.D. Brown, Anal. Chem., 53 (1981) 1410. 3 S.L. Monfre and S.D. Brown, Anal. Chim. Acta, 200 (1987) 397. 4 S.C. Rutan and S.D. Brown, Anal. Chim. Acta, 160 (1984) 99.