6
Low-Noise Fast Digital Differentiation Filters Dr. Abdulwahab A. Abokhodair King Fahd University of Petroleum and Minerals Department of Earth Sciences Dhahran 31261, Saudi Arabia [email protected] Abstract - Differentiation of discrete data is a classical problem of data analysis which arises in many scientific fields ranging from biology to chemistry and the geosciences. Because of its step-size sensitivity, conventional FD method is not suitable for discrete data collected at a preset sampling frequency. This paper introduces a class of differentiation filters known as least-squares digital differentiators (LSDD). I discuss methods of their fast generation for 1D and 2D data and examine their properties in the space and frequency domains. The filters have a range of desirable properties which include ease of generation with simple integer coefficients thus reducing the risk of cumulative round-off errors. They are low pass linear phase, maximally flat and moment preserving. The low- pass nature of the filters renders them noise suppressant with very low noise amplification factor, hence the filters are actually multitasking, performing data smoothing and differentiation simultaneously. They are easily generated for any order derivative with arbitrary length to suite any desired sampling frequency. Keywords: Digital Filters, Derivatives, Gradients, Separable filters. 1. Introduction Digital differentiation is widely used in many scientific fields for signal processing, imaging and data analysis. In potential field geophysics, for example, the usefulness of the spatial gradients as effective interpretation tools has long been recognized. Compared to the measured fields, gradients of the fields have greater spatial resolution, better definition of lateral boundaries, added depth discrimination and filtering properties, and better structural indicators. Examples of the use of gradients for detailed interpretations of specific geologic structures may be found in [1-5]. The high detectibility and resolution power of gradients are illustrated in [6-9], where gradients are utilized for locating and mapping near- surface cultural and archaeological artifacts. With recent advances in the power and graphics capabilities of modern computers, new gradient-based technologies have emerged. These include high resolution detection of geologic boundaries, Werner deconvolution for source depthing, Euler deconvolution and its extended form for the calculations of physical properties contrasts, dip information, location and depth of source, analytic, enhanced analytic signal and local wave numbers for source characterization and imaging [10-15]. The success of these new technologies made numerical computation of the spatial gradients and higher derivatives a basic geophysical data processing step. This paper introduces a class of differentiation filters known as least-squares digital differentiators (LSDD). These are very popular in absorption spectroscopy, chromatography and medical technologies, but are virtually unknown in the geosciences literature. Least-squares filters may be constructed and applied in a computationally efficient way. They are in effect multi-tasking, performing both smoothing and differentiation simultaneously. 2. Filter Generation LSDD filters are based on the principle of least squares data fitting. The underlying idea is to fit a vector x of equally spaced data of length 2n+1 to a polynomial d p() k of degree d in the integer index k, such that: x Vc Vc , (1) where V is Vandermonde matrix with elements , 0,1,..., j kj v k j d and c is the (d+1) vector of polynomial coefficients. The least-squares solution is the familiar normal equations: 1 1 ˆ T T T T ª º « » ¬ ¼ c V V V x Hx H V V V , (2) The individual filter operators are the elements of ˆ c given by equation (2). Each filter may be extracted explicitly by impulsing the matrix H with a unit impulse of appropriate delay, or the entire set of filters may be extracted at once by post multiplying H with an identity matrix of appropriate size. The Matlab script below generates the 1D filters for a given data window half-width (hw) and any polynomial degree (d). Int'l Conf. Scientific Computing | CSC'15 | 245

Low-Noise Fast Digital Differentiation Filtersworldcomp-proceedings.com/proc/p2015/CSC3133.pdf · Low-Noise Fast Digital Differentiation Filters Dr. Abdulwahab A. Abokhodair King

  • Upload
    hathien

  • View
    214

  • Download
    2

Embed Size (px)

Citation preview

Page 1: Low-Noise Fast Digital Differentiation Filtersworldcomp-proceedings.com/proc/p2015/CSC3133.pdf · Low-Noise Fast Digital Differentiation Filters Dr. Abdulwahab A. Abokhodair King

Low-Noise Fast Digital Differentiation Filters

Dr. Abdulwahab A. Abokhodair King Fahd University of Petroleum and Minerals

Department of Earth Sciences Dhahran 31261, Saudi Arabia

[email protected]

Abstract - Differentiation of discrete data is a classical problem of data analysis which arises in many scientific fields ranging from biology to chemistry and the geosciences. Because of its step-size sensitivity, conventional FD method is not suitable for discrete data collected at a preset sampling frequency. This paper introduces a class of differentiation filters known as least-squares digital differentiators (LSDD). I discuss methods of their fast generation for 1D and 2D data and examine their properties in the space and frequency domains. The filters have a range of desirable properties which include ease of generation with simple integer coefficients thus reducing the risk of cumulative round-off errors. They are low pass linear phase, maximally flat and moment preserving. The low-pass nature of the filters renders them noise suppressant with very low noise amplification factor, hence the filters are actually multitasking, performing data smoothing and differentiation simultaneously. They are easily generated for any order derivative with arbitrary length to suite any desired sampling frequency.

Keywords: Digital Filters, Derivatives, Gradients, Separable filters.

1. Introduction

Digital differentiation is widely used in many scientific fields for signal processing, imaging and data analysis. In potential field geophysics, for example, the usefulness of the spatial gradients as effective interpretation tools has long been recognized. Compared to the measured fields, gradients of the fields have greater spatial resolution, better definition of lateral boundaries, added depth discrimination and filtering properties, and better structural indicators.

Examples of the use of gradients for detailed interpretations of specific geologic structures may be found in [1-5]. The high detectibility and resolution power of gradients are illustrated in [6-9], where gradients are utilized for locating and mapping near-surface cultural and archaeological artifacts.

With recent advances in the power and graphics capabilities of modern computers, new gradient-based technologies have emerged. These include high resolution detection of geologic boundaries, Werner deconvolution for source depthing, Euler deconvolution

and its extended form for the calculations of physical properties contrasts, dip information, location and depth of source, analytic, enhanced analytic signal and local wave numbers for source characterization and imaging [10-15]. The success of these new technologies made numerical computation of the spatial gradients and higher derivatives a basic geophysical data processing step.

This paper introduces a class of differentiation filters known as least-squares digital differentiators (LSDD). These are very popular in absorption spectroscopy, chromatography and medical technologies, but are virtually unknown in the geosciences literature. Least-squares filters may be constructed and applied in a computationally efficient way. They are in effect multi-tasking, performing both smoothing and differentiation simultaneously.

2. Filter Generation

LSDD filters are based on the principle of least squares data fitting. The underlying idea is to fit a vector x of equally spaced data of length 2n+1 to a polynomial dp ( )k of degree d in the integer index k, such that:

x VcVc , (1) where V is Vandermonde matrix with elements

, 0,1,...,jkjv k j d and c is the (d+1) vector of

polynomial coefficients. The least-squares solution is the familiar normal equations:

1

1

ˆ T T

T T

c V V V x H x

H V V V

, (2)

The individual filter operators are the elements of c given by equation (2). Each filter may be extracted explicitly by impulsing the matrix H with a unit impulse of appropriate delay, or the entire set of filters may be extracted at once by post multiplying H with an identity matrix of appropriate size. The Matlab script below generates the 1D filters for a given data window half-width (hw) and any polynomial degree (d).

Int'l Conf. Scientific Computing | CSC'15 | 245

Page 2: Low-Noise Fast Digital Differentiation Filtersworldcomp-proceedings.com/proc/p2015/CSC3133.pdf · Low-Noise Fast Digital Differentiation Filters Dr. Abdulwahab A. Abokhodair King

function H = ls1D(hw,d) % Usage: H=sg1D(hw,d) % Output % H = Filter coeffecients W = 2*hw+1 ; Nc = d+1; if(Nc > W) error('Data window too small') end [i,j]=meshgrid(-hw:hw,0:d) G = (i.^j)’; id = eye(W); D = G\id; f = repmat(factorial((0:d)'),1,W); H = (f.*D)’; 3. Properties of LSDD

LSDD filter kernels for 1D and 2D data are compared in Figure 1. It is clear from the figure that the 1D filters are principle sections of their corresponding 2D kernels along the differentiation axis. This suggests that the properties of the 2D filters may be completely investigated from their 1D counterpart.

Figure 1: Amplitude spectra of first (top) and second derivative (bottom) filters for 1D (Left) and 2D (right) data.

3.1. General properties

The impulse responses of first- and second-order derivative filters are the same for any two consecutive degrees of the underlying polynomials. Thus the polynomial pairs of degrees (1,2), (3,4), (5,6), …, etc. produce the same first order differentiators, while polynomials of degree (2,3), (4/5), (6/7), …, etc. produce the same second order differentiators. Thus only even-degree polynomials produce unique first and second order derivative operators. Filters of both derivative orders are linear phase, non-recursive, FIR, highly stable and self-damping. The amplitude spectra of the filters are maximally flat closely approximating the ideal low-pass digital differentiation filters (IDD)

spectra at low frequency and attenuate rapidly at high frequencies (Figures 2). Thus, unlike IDD which strongly amplify noise especially at high frequencies, LSDD filters are low-pass filters, which is a significant advantage in practical applications.

Figure 2: Amplitude responses of first derivative (left) and second derivative (right) filters of different polynomial degrees (d) (left panel) and filter half-width (hw) (right panel compared to the responses of IDDs.

3.2. Spectral properties

The major spectral properties of LSDD filters are primarily determined by two parameters - the degree of the generating polynomial (d) and the filter half-width (hw). The initial slope of the main lobe, the width of the pass-band, the roll-off rate and the cut-off frequency, all vary with variations in the parameters of the underlying polynomial.

(a)

(b)

Figure 3: Variations of spectral characteristics of first (Blue) and second (Red) derivative filters with: (a) degree (d) of generating polynomial and (b) filter size (hw).

Figure 3a depicts the amplitude spectra of first- (blue) and second (red) order derivative operators of the same length (hw = 5) but of different polynomial degree (d) (left panel). Note that with increasing degree, the initial slopes of the spectra decrease while the pass-band, the roll-off rate and the cut-off frequencies

246 Int'l Conf. Scientific Computing | CSC'15 |

Page 3: Low-Noise Fast Digital Differentiation Filtersworldcomp-proceedings.com/proc/p2015/CSC3133.pdf · Low-Noise Fast Digital Differentiation Filters Dr. Abdulwahab A. Abokhodair King

increase. The opposite trend is seen in Figure 3b, which displays the spectra for a fixed degree (d = 4) and varying filter length (hw).

3.3. Noise amplification

The performance of filters in the presence of random noise (errors) is an important consideration in geophysical applications. One of the aims of the present study is to improve our understanding of LSDD with regards to their noise propagation and amplification characteristics. It is well known that FIR filters are generally less susceptible to round-off noise than IIR. Nonetheless, it is essential to understand the response of LSDD filters to noise of different structures. Much of the earlier work on noise transmission in FIR filters relates to numerical noise or round-off errors. These errors, however, are very small compared to measurement and other experimental errors typical of observational data. The relation between the noise variance 2 and the variance of the output 2

y of a

filter is given by (e.g. Rabiner and Gold, 1975; Hamming, 1989):

22 2hw

y ii hw

h (4)

Thus, the noise amplification factor (NAF) is proportional to the inner product of the filter vector. Figure 5 shows the dependence of NAF on the parameters (hw, d) of the generating polynomial for first and second order derivative operators. It is clear from the figure that these parameters have opposing influence on error amplification. For a fixed filter length (hw), noise is amplified rapidly with increasing degree of the generating polynomial. Inversely, for a fixed degree polynomial, noise is attenuated rapidly with increasing filter half-width (hw) for both order derivatives. This last behavior contrast sharply with the behavior of central finite difference (CFD) filters whose NAF is considerably larger and increase with increasing filter size as indicated in figure 6. It should be pointed out here that LSDD are moment preserving, implying that they are guaranteed to have optimum noise removal while preserving spectral details of the input signal.

Figure 5: Dependence of NAF of LSDD filters on polynomial degree (d) and filter size (hw).

Figure 6: Variation of NAF of CFD filters with size (hw).

3.4. Comparison with IDD

In designing optimal filters, a standard criterion often used is the requirement that the frequency response of the desired filter closely approximates that of the ideal filter. It is, therefore, informative to investigate how closely the LSDD approximate their corresponding IDDs. The frequency response of the ideal low-pass DD filters for first and second order derivatives are respectively given by:

2

id

id

H i

H, (5)

where the cut-off frequency parameter 0 1. And the frequency responses of the corresponding LSDD for first and second order derivatives respectively are:

1

1

2 ( ) sin ( )

(0) 2 ( ) cos( )

hw

lsk

hw

lsk

H i h k k

H h h k k

. (6)

As a measure of “closeness”, I use the mean square error (MSE) defined by:

1( ) ( ) ( )2 id lsMSE H H d , (7)

where ( )idH and ( )lsH are the frequency responses of the ideal and LSDD filters. Substituting from Equations (5) and (6) into (7) and carrying out the integration yields for first and second derivatives respectively:

21 1 2

1 1

2 22 2 3

1 1

4 ( )( , , ) sin cos 2 ( )

4 ( )( , , ) 2 sin 2 cos ( )

hw hw

k k kk khw hw

k k k kk k

h kMSE hw d q h kkh kMSE hw d q h kk

….. (8) where,

33 2 2

1 23 3 2

1 2 1 2 ;3 5 3

kk k k o ok q q h h

k k k.

Int'l Conf. Scientific Computing | CSC'15 | 247

Page 4: Low-Noise Fast Digital Differentiation Filtersworldcomp-proceedings.com/proc/p2015/CSC3133.pdf · Low-Noise Fast Digital Differentiation Filters Dr. Abdulwahab A. Abokhodair King

The behavior of MSE( is depicted in figure 7 for first and second derivative filters of different lengths (hw) and a fixed polynomial degrees (d = 4). The general trend shown by the figure is of increasing deviation of the LSDD filters of both orders from their corresponding IDDs at all filter lengths. Moreover, the increase in MSE of both derivative orders is smaller the larger the filter size. However, as indicated by the figure, the deviations of LSDD filters from ideal behavior are small ranging between 2 to 15% over the entire range of .

Figure 7: Variation of MSE() of first and second derivative filters with filter size (hw) for a polynomial degree d=4.

An important outcome of this analysis is the optimum cut-off frequency parameter ( for a given filter size (hw) and polynomial degree (d). This is obtained by optimizing the expressions in equations (8) with respect to . The results are shown in figure 8 for first and second derivative filters. Operators of both derivative order show similar trends of decreasing optimum parameter with increasing filter size; and for any filter size hw, optimum o is higher the higher the degree (d) of the parent polynomial.

Figure 8: Variation of o (left panel) and MSE( o) (right panel) with filter size (hw) and degree (d) of generating polynomial of first (top row) and second (bottom row) derivative filter.

Similarly, MSE( o) decreases with increasing filter size and decreasing polynomial degree. The rate of

decrease of MSE is steeper for second order derivative operators than for first derivative operators.

3.5. Comparison with CFD

Since finite difference is the differentiation method of choice of most researchers, it is instructive, therefore, to examine their spectral characteristics and compare them with LSDD. The amplitude spectra of central finite difference (CFD) filters for first and second order derivatives are compared in figure 9 with their LSDD equivalents. The differences in the passband and attenuation characteristic of the two types of filters are immediately apparent. Whereas LSDD operators are low-pass with filter-length-dependent cutoff frequencies, the CFD filter are allpass attaining their zero-value at the end of the Nyquist interval. Moreover, CFD are amplifying filters with spectral maxima greater than unity for any filter size (hw), and increase with increasing filter length. LSDD filters, on the other hand, are attenuating filters as evident from their spectral magnitude maxima of less than unity and which decrease with increasing filter size.

These contrasting spectral characteristics of the two filter types determine their filtering performances. Because of their lowpass and attenuating characteristics, the LSDD filters are noise suppressant performing both smoothing and differentiation simultaneously. CFD filters, in contrast, are high-noise allowing much of the high frequency noise to pass amplified. These same contrasting characteristics explain the contrast in the noise amplification factors of the two types of filters (see figures 5 and 7). Finite difference schemes, therefore, perform best on exact functions and noise-free digital data.

Figure 9: Amplitude spectra of CFD (top) and LSSD (bottom) filters of different lengths for first (right) and second (right) order derivatives. The dotted curve is the IDD.

248 Int'l Conf. Scientific Computing | CSC'15 |

Page 5: Low-Noise Fast Digital Differentiation Filtersworldcomp-proceedings.com/proc/p2015/CSC3133.pdf · Low-Noise Fast Digital Differentiation Filters Dr. Abdulwahab A. Abokhodair King

4. Performance Test

I tested the performance of the LSDD filters using a sine wave contaminated with a Gaussian white noise of zeros mean and 0.1 standard deviation. The noisy data were then differentiated using first derivative LSDD filter of length 21 and degree 2. The same data set was also differentiated using an equivalent CFD filter. As a measure of performance quality, I use the variance of the filter output. The results of these numerical experiments are shown in figure 10.

Figure 10: Output of first derivative LSDD and CFD filters.

As is clear from the figure, the LSDD results is of acceptable quality with output variance of 0.02, i.e. equivalent to a noise amplification factor of about 0.03. In contrast, the CFD filter has amplified the high frequency noise several orders of magnitude obscuring the output and rendering it useless.

5. Filter Selection Criterion

From the previous discussion, it is apparent that LSDD differentiation filters can yield excellent results provided the length (hw) and degree of the parent polynomial (d) are correctly chosen. To facilitate this task for interested user I have constructed contour plots (Figure 11) of the variation of the cut-off frequency versus (hw, d). In these maps, ‘cut-off’ frequency is defined as the frequency at half maximum on the amplitude spectra of the filter.

Figure 10: Contour plots of cut-off frequency versus filter half-length (hw) and degree (d) of generating polynomial.

6. Conclusion

Detailed examination of the spectral properties of LSDD filters has shown that this class of differentiators is low-pass, linear phase, highly stable and self-damping. The amplitude spectra of the filters are maximally flat closely approximating the ideal low-pass digital differentiators (IDD). Comparison with ordinary finite difference filters shows that LSDD filters perform considerably better on noisy data with high degree of noise reduction and smoothing of the output. Therefore, LSDD are more suitable for use with noisy data than FD schemes.

7. Refernces

]1[ H. M. Evjen, “The place of the vertical gradient in gravitational interpretations”, Geophysics, 1 (1936), p.127.

]2[ S. Hammer and R. Anzoleaga, “ Exploring for stratigraphic traps with gravity gradients”, Geophysics, 40 (1975), p.256.

]3[ E.E. Klingele, I. Marson, and H. G. Kahle, “Automatic interpretation of gravity gradiometric data in two dimensions -Vertical gradient”, Geophys. Prosp., 39 (1991), p. 407.

]4[ W.M. Moon, A. Ushah, V. Singh, and B. Bruce, “Application of 2-D Hilbert transform in geophysical imaging with potential field data”, IEEE Trans. on Geoscience and Remote Sensing, 26 (1988), p. 502.

]5[ R. T.Shuey, R. T., “Applications of Hilbert transforms to magnetic profiles”, Geophysics, 37(1972), p. 1043.

]6[ I. I. Mueller, “The gradients of gravity and their applications in geology”, Ph.D. dissertation (1960), Ohio

]7[ Z. J. Fajklewicz, “Gravity vertical gradient measurements for the detection of small geologic and anthropomorphic forms”, Geophysics, 41 (1976), p.1016.

]8[ C. A. Heiland, “A rapid method for measuring the profile components of horizontal and vertical gravity gradients” , Geophysics, 8 (1943), p. 119.

]9[ D. K. Butler, “Microgravimetry and the theory, measurement, and application of gravity gradients”, Ph.D. dissertation (1983), Texas A&M University.

]10[ Q. Shuang, “An analytic signal approach to the interpretation of total field magnetic anomalies”, Geophysical Prospecting, 44 (1996), p. 911.

]11[ R. J. Blakely, “ Potential theory in gravity and magnetic applications”, Cambridge University Press (1995.(

Int'l Conf. Scientific Computing | CSC'15 | 249

Page 6: Low-Noise Fast Digital Differentiation Filtersworldcomp-proceedings.com/proc/p2015/CSC3133.pdf · Low-Noise Fast Digital Differentiation Filters Dr. Abdulwahab A. Abokhodair King

]12[ R. J. Blakely and R. W. Simpson, “Approximating edges of source bodies from magnetic or gravity anomalies”, Geophysics, 51 (1986), p. 1494.

]13[ S. K. Hsu, J. C. Sibuet and C. T. Shyu, “High-resolution detection of geological boundaries from potential-field anomalies: An enhanced analytic signal technique”, Geophysics, 61 (1996), 373–386.

]14 [ I. N. MacLeod, K. Jones, and T. F.Dai, “3-D analytic signal in the interpretation of total magnetic field data at low magnetic latitudes”, Exploration Geophysics, 24 (1993), p. 679.

]15[ A. Salem, D. Ravat, T. J. Gamey, and K. Ushijima, “Analytic signal approach and its applicability in environmental magnetic applications”, Journal of Applied Geophysics, 49 (2002), 231–244.

250 Int'l Conf. Scientific Computing | CSC'15 |