hilbert(transforms( signal(envelopes ... · ! 7!!...
Post on 25-Mar-2020
0 Views
Preview:
TRANSCRIPT
1
Hilbert Transforms Signal envelopes, Instantaneous amplitude and instantaneous frequency!
Kate Allstadt’s final project for ESS522 – June 10, 2010
The Hilbert transform is a useful way of looking at an evenly sampled signal. It is used to obtain the analytic signal -‐ a complex signal from which the negative frequencies have been removed. The advantage of using this complex ‘analytic signal’ over the original signal is that it separates the amplitude information from the frequency information. The amplitude information is represented by the signal envelope, which gives the overall shape of a signal. The frequency portion gives the instantaneous frequency at any given time, this is essentially the mean frequency at that point. The math The Hilbert transform is the convolution of the function f(t) with the “kernel” (-‐πt)-‐1.
This can be written as:
€
H f (t)[ ] =−1πt* f (t) =
1π
f (τ)dττ − t−∞
∞
∫
(because convolution is
€
c(t) = a(t) *b(t) = a(τ )b(t − τ )dτ−∞
∞
∫ and it is communative.)
Because (-‐πt)-‐1 goes to infinity at t=0, this integral is not solvable for a finite value…this can be solved by removing an infinitesimal slice of the function centered at the singularity by using the Cauchy principal value, denoted by P:
€
H f (t)[ ] =1πP f (τ )dτ
τ − t−∞
∞
∫
Since convolution in the time domain is multiplication in the frequency domain, an easier way to grasp this is to go to the frequency domain. The fourier transform of the kernel function (-‐πt)-‐1 is the signum (sgn) function times I = isgn(f). This is equal to +i for negative frequencies and –i for negative frequencies. See Figure 2:
Figure 1 Showing the Kernel function (-π x)-1 at left, and its fourier transform, i* the signum function From Bracewell (1965).
2
The amplitude of the signal in the frequency domain is not changed by this because the signum is just multiplying by 1. The phase, on the other hand, is shifted by π/2 for positive frequencies, and -‐ π/2 for negative frequencies. The shift is π/2 because the i*sgn(s) function flips the signal a quarter of the way around the imaginary axis. This means that two Hilbert transforms will recover the negative of the original signal (because phase was shifted by ± π), and four Hilbert transforms will recover the original signal (because phase is shifted by ± 2π ). This is illustrated in the figure below from Bracewell (1965):
Figure 2 The column at left is in the time domain, at right in frequency domain. Each successive plot downwards is a Hilbert transform Bracewell (1965).
The analytic signal The important part of all this is that the Hilbert transform is used to compute the analytic signal from a real signal. The analytic signal is computed by subtracting i times the Hilbert transform of the function f(t) from the function itself:
€
fa (t) = f (t) − iH f (t)[ ] The analytic signal fa(t) is a complex helical sequence with a real part -‐ the original data -‐ and an imaginary part -‐ the Hilbert transform. Again, the Hilbert transform is simply the real signal with a 90-‐degree phase shift. This means that if the real part of the signal is sine, the imaginary part becomes cosine and vice versa. The analytic signal fa(t) can be used to get the envelope (instantaneous amplitude), the phase and the instantaneous frequency by the following formulas:
3
€
envelope = Re( fa (t))2 + Im( fa (t))
2
phase = arctan(Im( fa (t)) /Re( fa (t)))
inst. freq =∂phase∂t
The envelope will give the overall shape of the signal, only touching at maxima. It is representing the combined amplitude of all frequencies involved but removes the frequency information. The formula above will give the upper envelope, the negative of that formula will give the lower envelope. This is different from just taking the absolute value – the absolute value will only give the envelope at maxima or minima, while the envelope obtained from the analytic signal will give the envelope at all times. We will explore this in the exercise. The phase will be a value that is always increasing (except if there are jumps in frequency content). Changes in slope represent changes in frequency. Sometimes this can be a clearer way to see changes than the instantaneous frequency, which will vary rapidly due to small changes in the phase. The instantaneous frequency will represent the mean frequency contained in the signal at a given time (in radians per time unit…it must be adjusted to obtain Hz). The advantage of this over a spectrogram is that is gives a single value -‐ in a spectrogram it is easier to see how frequency is changing with time, but it is difficult to quantify and takes longer to compute. The instantaneous frequency often must be smoothed to be clear because a tiny sharp jump in phase will cause a huge jump in instantaneous frequency, even if it is from an insignificant small magnitude portion of the signal, like in the noise before an earthquake. How to do this for discrete signals Matlab uses FFT to move into the frequency domain, sets the second half of fft(x) (not including the nyquist) equal to zero (which is essentially removing the redundant negative frequency information). It then doubles the positive frequency and takes the IFFT of that to get the complex analytic signal. To get the envelope (instantaneous amplitude) we just need to take the magnitude of this signal sqrt(Re^2+Im^2). To get the phase, we just need to take the ‘angle’ of the signal and ‘unwrap’ it. The slope of the phase is the instantaneous frequency which can be obtained using the ‘diff ‘function. The reason that the analytic signal is equivalent to removing the negative frequencies and doubling the positive frequencies is illustrated on the last page of these notes. Examples Now we’ll look at different types of seismic signals using the Hilbert transform. The following figures show what instantaneous amplitude, phase, and instantaneous frequency look like for different types of seismic events. Each plot also includes a spectrogram so we can better understand what the plots are showing us:
4
Figure 3 Broadband recording (horizonal component) in Washington state of the M8.8 Chile earthquake on Feb 27, 2010. Note the rapid change in phase when the P-waves arrive (~1050sec), and a lowering of the instantaneous frequency when the S-waves (~2800sec) and surface waves arrive (~2100sec Rayleigh, ~2600 Love?). Note that the inst. Freq. gradually increases again after the surface waves arrive, this is because surface waves are dispersive, lower frequencies arrive sooner than higher frequencies.
5
Figure 4 Local earthquake, M3.4 near Bellevue on May 25, 2010. Note that sudden high amplitude arrival of waves. This recording is from so close that the P and S waves are not distinguishable on this time scale. The slope of phase, and thus instantaneous frequency both decrease here showing that the earthquake has a lower average frequency than the ambient noise, particularly in the coda.
6
Figure 5 Mt Redoubt (near Anchorage, Alaska) volcanic eruption – March 28, 2009. The actual eruption is the blast at about 3300 seconds, the noise before that is volcanic tremor which in this case had a strong fundamental frequency and higher modes and these actually increased in frequency approaching the eruption (gliding spectral lines – their cause is still being investigated). This is apparent in the phase, which swoops upwards as the average frequency increases. This is represented as a linear increase in instantaneous frequency. Then, right before the eruption, frequency rapidly increases, then all is quiet for a few seconds – the inst frequency drops way down, (very noticeable on the envelope) and then the blast occurs at lower frequencies.
7
Figure 6 Main event of Nile Valley Landslide near Naches, WA, Oct 11, 2009. This signal was recorded 12km away from the slide so it is not very strong, but the increase in noise between 0 and 10Hz is noticeable, particularly at 5Hz, which is probably due to a site amplification where the station is located. Note that the envelope shows that this event has an emergent onset, unlike the earthquakes which had sudden arrivals. This entire signal is dominated by the 5Hz amplification, so the instantaneous frequency is rather flat at 5Hz. As the amplitude of the 5Hz signal increases around 700seconds as the landsliding intensifies, the instantaneous frequency is more dominated by 5Hz. The higher frequency blip is due to local noise on the station, not due to the landslide, it clearly stands out in the instantaneous frequency.
8
Exercise (exerciseK.m) A) What is the envelope of a sine wave? What do phase and instantaneous frequency look like? Construct a sine wave with a frequency of 1Hz that lasts for 5 seconds with a sample interval of 0.01 seconds: t=0:0.01:5-0.01; %subtract one sample so there is no jump xr=sin(1*2*pi*t); %1Hz sine wave plot(t,xr) hold on get the analytic signal (use function ‘hilbert’ if have signal processing toolbox, otherwise follow these steps) xf=fft(xr); %take fft of sine wave half=ceil(length(xf)/2); %find the halfway point of the vector xf(half+1:end)=0; %set repeated part of FT to zero xf=2*xf; %double the amplitude of the freq. domain signal x=ifft(xf); take ifft to go back to time domain Now plot the envelope (a.k.a. instantaneous amplitude), what is the envelope of a sine? hilbx=sqrt(real(x).^2+imag(x).^2); %take magnitude of signal to get envelope plot(t,hilbx,'r'); %upper envelope hold off Now plot the phase phase1=unwrap(angle(x)); %get phase angle and unwrap so it plots as always increasing instead of repeating every 2pi plot(t,phase1) ylabel('radians') title('Phase') Take the derivative of the phase to get the instantaneous frequency – normalize by the sample interval and 2*pi to get to Hz (because the slope is in units of radians per sample). deriv=(diff(phase1)/0.01)/(2*pi); plot(t(1:end-1),deriv,'k') B) Same thing but with a real signal. How is envelope different from absolute value of signal? Now we will work with a real signal composed of ambient noise recorded at a seismometer. This is saved as signal.mat, it has a sampling rate of 100Hz.
9
First plot the signal and its upper and lower envelopes. Zoom in and look around. Also plot the phase and instantaneous frequency. Apply a lowpass filter to the instantaneous frequency to eliminate outlying spikes. Now replot the original signal, but this time take the absolute value. Plot the upper envelope over this, zoom in and look around and comment on the differences. The end. References Bracewell, R. (1965). The Fourier Transform and Its Applications. McGrawHill: New York, p.268-‐272. Farnbach, J.S. (1975). The Complex Envelope in Seismic Signal Analysis. Bull. of Seis. Soc. of America: v.65, p951-‐962. King, F. (2009). Hilbert Transforms, Volume I. Cambridge University Press: Cambridge. p.??? Matlab help section
top related