The English word wavelet (from French “ondelette”) literally translates as “short (small) wave”. In various translations of foreign articles into Russian there are more terms: “surge”, “wavelet function”, “low wavelength function”, “wave”, etc.
Wavelet transform (VP) is widely used for signal analysis. In addition, it finds a great use in data compression. A VP of a one-dimensional signal is its representation in the form of a generalized series or Fourier integral over a system of basis functions.
, (one) ')
constructed from the mother (source) wavelet having certain properties due to the operations of shift in time (b) and changes in the time scale (a).
Factor ensures the independence of the norm of functions (1) on the scaling number (a). For the given values of the parameters a and b function and there is a wavelet generated by the mother wavelet .
As an example, we present the “Mexican hat” wavelet in the time and frequency domains:
Wavelet listing for the time domain
from numpy import* import matplotlib.pyplot as plt x= arange(-4,30,0.01) defw(a,b,t): f =(1/a**0.5)*exp(-0.5*((tb)/a)**2)* (((tb)/a)**2-1) return f plt.title(" « »:\n$1/\sqrt{a}*exp(-0,5*t^{2}/a^{2})*(t^{2}-1)$") y=[w(1,0,t) for t in x] plt.plot(x,y,label="$\psi(t)$ a=1,b=12") y=[w(2,12,t) for t in x] plt.plot(x,y,label="$\psi_{ab}(t)$ a=2 b=12") y=[w(4,12,t) for t in x] plt.plot(x,y,label="$\psi_{ab}(t)$ a=4 b=12") plt.legend(loc='best') plt.grid(True) plt.show()
Listing for wavelet spectrum
from numpy import* from pylab import * from scipy import * import os defw(a,b,t): f =(1/a**0.5)*exp(-0.5*((tb)/a)**2)* (((tb)/a)**2-1) return f x= arange(-4,30,0.2) defplotSpectrum(y,Fs): n = len(y) k = arange(n) T = n/Fs frq = k/T frq = frq[range(int(n/2))] Y = fft(y)/n Y = Y[range(int(n/2))] return Y,frq xlabel('f (Hz)') ylabel('|Y(f)|') Fs=1024.0 y=[w(1,12,t) for t in x] Y,frq=plotSpectrum(y,Fs) plot(frq,abs(Y),label="$\psi(\omega)$ a=1,b=12") y=[w(2,12,t) for t in x] Y,frq=plotSpectrum(y,Fs) plot(frq,abs(Y),label="$\psi_{ab}(\omega)$ a=2 b=12") y=[w(4,12,t) for t in x] Y,frq=plotSpectrum(y,Fs) plot(frq,abs(Y),label="$\psi_{ab}(\omega)$ a=4 b=12") plt.title(" « » $\omega$") legend(loc='best') grid(True) show()
Conclusion:
1. Between the concept of Fourier harmonics and the wavelet scale there is indeed a relationship. The main thing in this relationship is the inverse proportionality of the natural frequency and scale. In addition, by reducing the scale, we increase the bandwidth of the wavelet spectrum.
2. By changing the scale (an increase in a leads to a narrowing of the Fourier spectrum of the function ), wavelets are able to detect differences in characteristics at different scales (frequencies), and due to a shift, analyze the properties of the signal at different points throughout the studied interval. Therefore, when analyzing non-stationary signals, due to the locality property of wavelets, they get a significant advantage over the Fourier transform, which gives only global information about the frequencies (scales) of the signal being analyzed, since the system of functions used (complex exponent or sines and cosines) is defined on infinite interval.
3. The above listings, written in a free high-level language, Python allow you to select wavelet functions that meet specified requirements. However, in addition, it is necessary to take into account all the main features of the wavelets.
The main signs of wavelet
Limitations. The square of the norm of the function must be finite: . (2)
Localization. VP, in contrast to the Fourier transform, uses a localized source function both in time and in frequency. For this it is enough that the following conditions are met:
and at , (3)
For example, the delta function and the harmonic function does not satisfy the necessary condition for simultaneous localization in the time and frequency domains.
Zero average. The graph of the original function must oscillate (be alternating) around zero on the time axis and have zero area:
. (four)
From this condition it becomes clear the choice of the name “wavelet” - a small wave.
Equality zero area function i.e. zero momentum, leads to the fact that the Fourier transform this function is zero when and has the form of a bandpass filter. With different values (a) this will be a set of bandpass filters.
Often, for applications, it is necessary that not only zero, but all the first n moments should be zero:
. (five)
Wavelets of the nth order make it possible to analyze the finer (high-frequency) structure of the signal, suppressing its slowly varying components.
Automaking. A characteristic feature of the EP is its self-similarity. All wavelets of a specific family have the same number of oscillations as the mother wavelet , since obtained from it by means of scale transformations (a) and shift (b).
Continuous wavelet transform
Continuous (integral) wavelet transform (NVP or CWT - continuous wavelet transform). We construct the basis using continuous scale transformations (a) and transfers (b) of the mother wavelet with arbitrary values of the basic parameters a and b in the formula (1).
Then, by definition, the direct (analysis) and reverse (synthesis) of the CWP (i.e., the CST and CST) of the signal S (t) are written as: , (6)
Where - the normalizing factor where: (•, •) is the scalar product of the corresponding factors, - wavelet Fourier transform . For orthonormal wavelets .
From (6) it follows that the wavelet spectrum (wavelet spectrum, or time-scale-spectrum - time-scale spectrum), in contrast to the Fourier spectrum (single spectrum) is a function of two arguments: the first argument a (time scale) is similar to the oscillation period, i.e. is inverse to the frequency, and the second b is similar to the signal offset along the time axis.
It should be noted that characterizes the time dependence (with whereas dependencies frequency dependence can be assigned (at ).
If the signal under study S (t) is a single pulse of duration concentrated in the neighborhood then its wavelet spectrum will have the greatest value in the vicinity of the point with coordinates .
Ways of representation (visualization)may be different. Spectrum is a surface in three-dimensional space. However, instead of the image of the surface, they often represent its projection on the ab plane with iso-levels (or figures of different colors), which allow tracing the change in the intensity of the amplitudes of the EPs at different scales (a) and in time (b).
In addition, they depict pictures of local extremum lines of these surfaces, the so-called skeleton, which reveals the structure of the signal being analyzed.
The continuous wavelet transform in determining the wavelet spectrum based on the maternal wavelet is a “Mexican hat”.
Other maternal wavelets used for NVP are also used:
Continuous VP has found wide application in signal processing. In particular, wavelet analysis (VA) provides unique opportunities to recognize local and “subtle” features of signals (functions), which is important in many areas of radio engineering, communications, radio electronics, geophysics, and other branches of science and technology. Consider this possibility in some of the simplest examples.
from scipy.integrate import quad from numpy import* import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from matplotlib import cm N=256 T=50defS(t):return sin(2*pi*t/T) plt.figure() plt.title(' ', size=12) y=[S(t) for t in arange(0,100,1)] x=[t for t in arange(0,100,1)] plt.plot(x,y) plt.grid() defw(a,b): f = lambda t :(1/a**0.5)*exp(-0.5*((tb)/a)**2)* (((tb)/a)**2-1)*S(t) r= quad(f, -N, N) return round(r[0],3) x = arange(1,50,1) y = arange(1,50,1) z = array([w(i,j) for j in y for i in x]) X, Y = meshgrid(x, y) Z = z.reshape(49,49) fig = plt.figure("- : ") ax = Axes3D(fig) ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.jet) ax.set_xlabel(' :a') ax.set_ylabel(': b') ax.set_zlabel(' : $ N_{ab}$') plt.figure("2D- z = w (a,b)") plt.title(' ab ', size=12) plt.contourf(X, Y, Z,100) plt.show()
Signal graph.
Graph of the two-parameter spectrum displayed as a surface in three-dimensional space.
It should be noted that the W (a, b) section for the time scale characterizes the original oscillation s (t). In this case, its amplitude is maximum at . Dependencies the current spectrum of oscillation can be assigned to .
The sum of two harmonic oscillations.
The signal is:
Where: .
, N: = 256, , a: = 1 ... 30, b: = 0 ... 50, .
Program listing
from scipy.integrate import quad from numpy import* import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from matplotlib import cm N=256defS(t):return sin(2*pi*t/10)+sin(2*pi*t/50) plt.figure(' ') plt.title(' ', size=12) y=[S(t) for t in arange(0,250,1)] x=[t for t in arange(0,250,1)] plt.plot(x,y) plt.grid() defw(a,b): f = lambda t :(1/a**0.5)*exp(-0.5*((tb)/a)**2)* (((tb)/a)**2-1)*S(t) r= quad(f, -N, N) return round(r[0],3) x = arange(1,50,1) y = arange(1,50,1) z = array([w(i,j) for j in y for i in x]) X, Y = meshgrid(x, y) Z = z.reshape(49, 49) fig = plt.figure("-:2- ") ax = Axes3D(fig) ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.jet) ax.set_xlabel(' :a') ax.set_ylabel(': b') ax.set_zlabel(' : $ N_{ab}$') plt.figure("2D- z = w (a,b)") plt.title(' ab ', size=12) plt.contourf(X, Y, Z, 100) plt.figure() q=[w(2,i) for i in y] p=[i for i in y] plt.plot(p,q,label='w(2,b)') q=[w(15,i) for i in y] plt.plot(p,q,label='w(15,b)') q=[w(30,i) for i in y] plt.plot(p,q,label='w(30,b)') plt.legend(loc='best') plt.grid(True) plt.figure() q=[w(i,13) for i in x] p=[i for i in x] plt.plot(p,q,label='w(a,13)') q=[w(i,17) for i in x] plt.plot(p,q,label='w(a,17)') plt.legend(loc='best') plt.grid(True) plt.show()
Signal graph.
The graph of the two-parameter spectrum W (a, b) is plotted as a surface in three-dimensional space.
The plane of the parameters a, b on which the results of the EP are highlighted with colored areas.
The graph shows the "cross section" of the wavelet spectrum for two values of the parameter a. With a relatively small time scale parameter a, with , the cross section of the spectrum carries information only about the high-frequency component of the signal, filtering (suppressing) its low-frequency component.
As a grows, the base function stretches. , therefore, the narrowing of its spectrum, and the narrowing of the frequency bandwidth of the “window”. As a result, The cross section of the spectrum is only a low frequency component of the signal.
With a further increase in a, the window band is still reduced and the level of this low-frequency component decreases to a constant component (with a> 25) equal to zero for the analyzed signal.
The graph shows the cross section of the wavelet spectrum W (a, b), characterizing current signal spectrum at and . The spectrum of the considered signal, in contrast to the harmonic signal, contains a high-frequency component in the region of small values of the time scale a (a: 1..3), which corresponds to the second component of the signal .
Rectangular impulse.
Program listing
from scipy.integrate import quad from numpy import* import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from matplotlib import cm N=256defS(t): U=5;t0=20;tau=60if t0<=t<=t0+tau: return U else: return0 plt.figure() plt.title(' ', size=12) y=[S(t) for t in arange(0,120,1)] x=[t for t in arange(0,120,1)] plt.plot(x,y) plt.grid() defw(a,b): f = lambda t :(1/a**0.5)*exp(-0.5*((tb)/a)**2)* (((tb)/a)**2-1)*S(t) r= quad(f, -N, N) return round(r[0],3) x = arange(1,100,1) y = arange(1,100,1) z = array([w(i,j) for j in y for i in x]) X, Y = meshgrid(x, y) Z = z.reshape(99, 99) fig = plt.figure("3D- ") ax = Axes3D(fig) ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.jet) ax.set_xlabel(' :a') ax.set_ylabel(': b') ax.set_zlabel(' : $ N_{ab}$') plt.figure("2D- z = w (a,b)") plt.title(' ab ', size=12) plt.contourf(X, Y, Z,100) plt.show()
The wavelet spectra are shown in the graphs, the wavelet spectrum well conveys the subtle features of the signal - its jumps in the samples b = 20 and b = 80 (for a: 1..10).
findings
This publication is educational in nature, it contains basic information about wavelet analysis in general, and simple examples of the freely-distributed high-level programming language Python show the features of continuous wavelet analysis with extensive 3D and 2D visualization.
PS The author does not detract from the unconditional advantages of wavelet analysis using Matlab both in terms of the number of wavelets and in speed. But in Python there is still much room for development; it is scipy.signal and PyWavelets.