340 likes | 511 Views
GG 450 March 18, 2008. Convolution and Fourier Transforms in Digital Signal Analysis. What’s a “filter”?
E N D
GG 450 March 18, 2008 Convolution and Fourier Transforms in Digital Signal Analysis
What’s a “filter”? A filter is a device or process that modifies the input process such that the output has different characteristics. The air filter in a car changes dirty air into clean air by filtering out particles. Soil filters out impurities in ground water.
An electronic filter changes the characteristics of an electronic signal. A digital filter changes the characteristics of a digital signal. The characteristics of time-invarientfilter don’t ever change. A linear filter has the same effects on a signal regardless of the signal characteristics. For example, a filter might always reduce the amplitude of frequencies below 10 Hz by 6 dB/octave. This would be a linear time-invarient filter.
When we pass a signal through a filter, or through the earth, or through a seismometer or amplifier, that device or operation changes our signal into a new signal. The purpose of signal analysis is to apply operations (filters) to our signals that make the information in them easier to see and understand, while reducing the effects of undesirable components such as noise and echoes.
For example, we will send a signal into the ground with a hammer. The earth will filter that signal by delaying it, reflecting part of the signal, and absorbing other parts. We will detect the signals with seismometers that will further modify the signal. What we WANT in this case are parts of the signal that represent reflections or refractions through the earth. In analysis we will attempt to remove the effects of those filters that tend to distort or hide these features.
Digital signal analysis is a very powerful tool for providing insight into geological problems. There are several important concepts used in digital analysis that we will look at briefly - The concept of the frequency domain and The process of convolution
We usually look at geophysical data in terms of amplitude changes with time (or distance). Another way to look at it is in terms of amplitude and frequency: time 0 frequency The heavy arrow implies that it is possible to go from the time domain to the frequency domain and back without losing any information. This transformation is accomplished with the FOURIER TRANSFORM.
The change from time domain to frequency domain is routine in nearly all signal analysis of geophysical and other data. Why is it so important? Often, more insight is acquired by displaying the desired information in one domain or the other, and many important mathematical operations are far easier to accomplish in one domain than in the other.
Transforming linear numbers into logarithms changes multiplication and division into addition and subtraction (which is how a slide rule works) and exponents into multipliers:
The Fourier transform can be used to change the process of CONVOLUTION into multiplication and division. It also changes DIFFERENTIATION and INTEGRATION into simple multiplication and division in many situations. More on that later..... So.... What's CONVOLUTION?? The convolution operation is very important in seismology and geophysics in general because it mathematically describes how the earth filters the signals we put into it. For example when we hit the earth with a hammer we generate an IMPULSE, or Delta function. As that impulse passes through the earth, what happens to that signal can be described by the operation of CONVOLUTION:
Consider the seismic case: The input to the ground is approximately an impulse: If all the ground did was pass this impulse on at a particular velocity with refractions and reflections arriving at various times, our seismograms might look like the following: This is called a response function.
In fact, the above figure shows exactly what we want: all the reflections and refractions, their amplitudes, signs, and times of arrival. But, the earth isn't so nice, and it changes the impulse by absorbing some frequencies and delaying the signal in a process called FILTERING. A filter can change both the amplitude and phase of a signal in different ways at different frequencies. The “earth filter” delayed the hammer blow peak “a” above changing the phase and amplitude of all frequencies the same way. The peak "b" did the same, except amplitude was "convolved" with a negative number (note that it is inverted with respect to peak “a”.
As usual, reality is more complicated, in that each refraction path and each reflector, and each seismometer and source for that matter, change our nice clean impulse into a train of waves, and our hammer blow might actually look like: called the “source function” every time this train of waves hits another interface it gets changes by whatever "filter" that interface applies. If each interface above applied only an "impulse" filter as shown, then our seismogram might look like:
This looks more like a seismogram, and the process that has been done is CONVOLUTION of the SOURCE function (hammer) with the RESPONSE function of the ground. The IMPULSE RESPONSE is defined as the output of a process if the input is an impulse. If a system (described by a combination of filters) has a LINEAR response then the impulse response of a system completely defines the operation of that system. The signal shown above is formed by replacing each of the impulses in the response function by the source function multiplied by the appropriate constant, then adding the results together.
In analog form (integral calculus) the convolution of two functions of time f and g is: Digital convolution is similar: Notice that convolution is NOT simple multiplication. Each g[x] is the SUM of products of g.h with time offsets.
Convolution involves • 1) multiplying each value of the input signal by the values of the filter IMPULSE RESPONSE • 2) adding the results together (this is the output for one • 3) stepping the signal one time step and repeating the operation. A simple “convolution box” is shown below set up to convolve x[n]= 0,0,1,1,1,1,1 with h[n]=1,-1 (We can ignore zero values past the ends). The mathematical notation for this operation is x[n]h[n]=v[n]
Go to: http://www.jhu.edu/signals/convolve/ and try their interactive convolution box. Use your mouse to generate x(t) and h(t). click on “x(t-v) and h(v)”. This places the functions in the convolver. Use your mouse to move x(t-v) over h(v). The values of x(t-v)h(v) are shown as well as the resulting integral. Try functions like those suggested and:
Another convenient way to think about digital convolution is using what is called the z transform. • Consider two discrete functions: x= 1, 2, 4, 0 • and y= -1, -1, 0, 1 • where the four values are the measurement or value of four consecutive samples. • The product of x and y is: z=-1,-2,0,0 (multiplying point-by-point) • but the convolutionof these two series is more difficult. An easy way to do it is to consider the values of x and y to be coefficients of a polynomial: • x(z)= 1 + 2 z +4 z2+0z3 • y(z)= -1 -1 z + 0z2 + 1z3 • Where z is a unit time delay, and the power of z is the sample number.
To convolve y and z, we simply find the produce of the two polynomials: • c(z) = x(z) y(z) = 1 - 1 z - 7 z 2 -4 z3 + z4 + z5 • and take the inverse z transform to obtain the time series: • c = 1, -1, -7, -4, 1, 1 • Note that the convolution of two functions creates a function that is longer than either of the original functions, thus convolution process can spread signals out. • When one or both of the time series we want to convolve get long, we have to do a huge number of multiplication's to accomplish convolution, but.. there is a better way, and that is to change to the frequency domain using the Fourier transform.
If you’d like to know how the Fourier transform is defined and calculated mathematically and by Fast Fourier Transform, check Google and MatLab functions for these terms. For our purposes, we only need to know what happens when we go from the time domain to the frequency domain and back (USING the Fourier transform), not how it's done. When we go from the time domain to the frequency domain the signal properties do not change. All of the information present in one domain is still there in the other. All that changes is how the signal is presented. In the time domain, time is the independent variable, and in the frequency domain, frequency is the independent variable. In both cases, amplitude is the dependent variable. In spatial data, wavenumber is often used as the independent variable. What happens to various signals on transformation?
The functions on the previous page are some famous transform pairs. Each is worth understanding. Be aware that there are many ways to display data in the frequency domain, real and imaginary components, phase and amplitude, power spectrum, etc. Those above show only part of the complete spectrum for simplicity. If the signal in the time domain is symmetric about zero, then the imaginary part of the Fourier transform is zero. That is the case in most examples above. The comb function transform pair was included here because it is critical in understanding of sampling of continuous signals. Discussed below.
• Both domains have both positive and negative values. Negative time is fairly easy to understand, but what does a negative frequency imply?? One clue is the sin wave transform. It's the only one of the above that isn't symmetric in the time domain. What do you think the transform of a cosine wave might be? • • Note the relationship between PERIOD in the time domain with FREQUENCY in the frequency domain. • • There is complete symmetry between time and frequency domain - that is, we could have called the time domain "frequency domain" and visa versa. • If this is true, though, how come the delta function transform looks so much like the transform of the sin wave? HINT: think about how the sine wave signal transform looks as the sine wave frequency approaches 0.
Referring to the Fourier transform pairs in the figure, What happens to the Sinc function as the width of the boxcar (d) approaches zero? Which of the other transform pairs does this limiting case approach? What happens to the cosine wave transform as the frequency of the wave approaches zero? What other transform pair does this case approach?
Convolution using the Fourier transform: A very simple and time-effective way of performing the convolution process is using the Fourier transform and the convolution theorem. If two functions are convolved in one domain (time or frequency), then if we multiply the Fourier transforms of those functions together, and take the inverse transform, the result is the sameas the convolution. As it is often easier to take a Fourier transform than do a convolution, this method is important:
Let's use the above principles to derive the sampling theorem, which says that a signal is completely determined if it is sampled AT LEAST twice per cycle at its highest frequency. A corollary of this theorem is that a signal will be ALIASED if the signal is sampled at a lower rate. Say we have the continuous analog signal below shown in both the frequency and time domain that we want to digitize: digitizing is the same operation as MULTIPLYING the signal in the time domain by a COMB function with samples every T seconds: (see the transform pairs)
The MULTIPLICATION of these signals in the time domain results in a CONVOLUTION of the equivalent signals in the frequency domain:
This analysis is worthy of lots of study and understanding. Note that if the frequency of the original signal is less than the nyquist frequency (as it is above), then, when we look at frequencies between 0 and the Nyquist frequency in the sampled data, the signal is identical to the analog signal. Notice that the frequency domain signal consists of many repeated pairs of the basic signal symmetric around zero. But we don’t care, since ALL of the information is contained between zero frequency and the Nyquist frequency. BUT, what happens when we look at a signal that has energy at frequencies ABOVE the Nyquist?
In this case, our signal contains energy ABOVE the Nyquist frequency. Notice that the convolution in the frequency domain results in the high frequency noise peak (light colored) appearing between 0 and the Nyquist frequency ! The digitizing process has resulted in this energy being ALIASED. It is IMPOSSIBLE to tell whether a sampled signal has been aliased or not, thus it is VERY IMPORTANT to be sure that your sample rate is high enough to prevent aliasing.
Or, you can FILTER with an ANTI-ALIASING filter. Such a filter decreases the power at frequencies near and above the Nyquist BEFORE sampling to insure that no significant energy remains to be aliased.
The above is an example of a LOW PASS FILTER. Note that the CONVOLUTION is done in the TIME DOMAIN, and the MULTIPLICATION in the FREQUENCY domain. After application of such a filter it is usually safe to digitize without worries about aliasing. Notice what happens when a signal is aliased – the energy in the signal is STILL PRESENT, but the frequency has been transformed to between zero frequency and the Nyquist frequency. The new frequency is folded back around the Nyquist (N) and zero frequency, one fold for every factor of a Nyquist. For example a signal with a frequency of 1.2 N will end up at a frequency of 0.8 N. A 2 N signal will be observed at zero frequency, and a signal at 2.3 N will end up at 0.3 N. Thus, the Nyquist frequency is also called the “folding” frequency.
The above statement on folding can be used to analyse the wheel rotation sampling in slide 18 of Lecture 28 (Last lecture). If the rotation rate of the wheel is 32 cycles per second: What is the sampling rate for each row? What is the Nyquist frequency for each row? What is the APPARENT rotation rate for each row.