emd
Decomposition of the signal into empirical modes.
| Library |
|
Syntax
Function call
-
imf,residual = emd(x)— returns functionsimfdecomposition into Intrinsic Mode Function (IMF) and residual signalresidualcorresponding to the decomposition of the signalxin an empirical fashion. Use the functionemdto decompose and simplify complex signals into a finite number of internal mode decomposition functions necessary to perform Hilbert spectral analysis.
-
___ = emd(___,Name,Value)— decomposes the signal into empirical modes with additional parameters specified by one or more arguments of the typeName,Value.
-
emd(___;out=:plot)— Plots the original signal, IMF, and residual signal as separate graphs in one figure.
Arguments
Input arguments
# x is a time domain signal
+
vector
Details
A time domain signal defined as a vector of real values.
Name-value input arguments
Specify optional argument pairs as Name,Value, where Name — the name of the argument, and Value — the appropriate value. Name-value arguments should be placed after other arguments, but the order of the pairs does not matter.
Use commas to separate the name and value, and Name put it in quotation marks.
# SiftRelativeTolerance — Cauchy convergence criterion
+
0.2 (by default) | positive scalar
Details
The Cauchy convergence criterion, defined as a comma-separated pair consisting of "SiftRelativeTolerance" and a positive scalar. Argument SiftRelativeTolerance It is one of the criteria for stopping screening, that is, screening stops when the current relative tolerance is less than the value SiftRelativeTolerance. For more information, see Relative screening tolerance.
# SiftMaxIterations — maximum number of screening iterations
+
100 (by default) | a positive integer scalar
Details
The maximum number of screening iterations, set as a comma-separated pair consisting of "SiftMaxIterations" and a positive integer scalar. Argument SiftMaxIterations it is one of the criteria for stopping screening, that is, screening stops when the current number of iterations is greater than the value SiftMaxIterations.
Argument SiftMaxIterations It can only be specified with positive integers.
# MaxNumIMF — maximum number of IMFs extracted
+
10 (by default) | a positive integer scalar
Details
The maximum number of extracted IMFs, specified as a comma-separated pair consisting of "MaxNumIMF" and a positive integer scalar. Argument MaxNumIMF It is one of the criteria for stopping decomposition, that is, decomposition stops when the number of generated IMFs is equal to MaxNumIMF.
Argument MaxNumIMF It can only be specified with positive integers.
# MaxNumExtrema — maximum number of extremes in the residual signal
+
1 (by default) | a positive integer scalar
Details
The maximum number of extremes in the residual signal, defined as a comma-separated pair consisting of "MaxNumExtrema" and a positive integer scalar. Argument MaxNumExtrema It is one of the criteria for stopping decomposition, that is, decomposition stops when the number of extremes is less than the value MaxNumExtrema.
Argument MaxNumExtrema It can only be specified with positive integers.
# MaxEnergyRatio is the ratio of signal energy to residual energy
+
20 (by default) | scalar
Details
The ratio of signal energy to residual energy, defined as a comma-separated pair consisting of "MaxEnergyRatio" and a scalar. Argument MaxEnergyRatio is the ratio of the energy of the signal at the beginning of screening to the average energy of the envelope. Argument MaxEnergyRatio It is one of the criteria for stopping decomposition, that is, decomposition stops when the current energy ratio is greater than the value MaxEnergyRatio. For more information, see The ratio of energies.
# Interpolation is an interpolation method for building an envelope
+
"spline" (by default) | "pchip"
Details
An interpolation method for constructing an envelope, specified as a pair separated by a comma, consisting of "Interpolation" and either "spline", or "pchip".
Set for the argument Interpolation one of the values is:
The interpolation method "spline" uses cubic splines, and "pchip" — piecewise cubic Hermite interpolation polynomials.
# Display — switching the information display in the command window
+
0 (by default) | 1
Details
Switching the information display in the command window, set as a comma-separated pair consisting of "Display" and either 0, or 1. The data table generated in the command window indicates the number of screening iterations, the relative tolerance, and the screening stop criterion for each generated IMF. Set for the argument Display meaning 1 to display the table, or 0 to hide it.
# out — type of output data
+
:none (by default) | :plot
Details
Type of output data:
-
:none— the function returns data; -
:plot— the function returns a graph.
Output arguments
# imf — decomposition function into internal modes
+
the matrix
Details
The Intrinsic Mode Function (IMF) returned as a matrix. Each IMF is an amplitude and frequency modulated signal with positive and slowly varying envelopes. For spectral analysis of a signal, you can apply the Hilbert—Huang transform to its IMF. For more information, see Decomposition functions into internal modes.
Argument imf it is returned as a matrix, each column of which is imf if x — vector.
# info — additional diagnostic information
+
structure
Details
Additional diagnostic information returned as a structure with the following fields:
-
NumIMF— the number of IMFs extracted;NumIMF— vector from before , where — the number of IMF. If IMFs are not extracted,NumIMFempty; -
NumExtrema— the number of extremes in each IMF;NumExtremais a vector whose length is equal to the number of IMF. -th element of the argumentNumExtremais the number of extremes found in -th IMF. If IMFs are not extracted,NumExtremaempty; -
NumZerocrossing— the number of zero crossings in each IMF;The number of zero crossings in each IMF.
NumZerocrossingis a vector whose length is equal to the number of IMF. -th element of the argumentNumZerocrossingis the number of zero crossings in -th IMF. If IMFs are not extracted,NumZerocrossingempty; -
NumSifting— the number of screening iterations used to extract each IMF;NumSiftingis a vector whose length is equal to the number of IMF. -th element of the argumentNumSiftingis the number of screening iterations used in the extraction -th IMF. If IMFs are not extracted,NumSiftingempty; -
MeanEnvelopeEnergy— the energy of the average value of the upper and lower envelopes obtained for each IMF;If
UE— the upper envelope, andLE— lower, then the value of the argumentMeanEnvelopeEnergyequallymean(((LE+UE)/2).^2).MeanEnvelopeEnergyis a vector whose length is equal to the number of IMF. -th element of the argumentMeanEnvelopeEnergyis the average energy of the envelope for -th IMF. If IMFs are not extracted,MeanEnvelopeEnergyempty; -
RelativeTolerance— the final relative tolerance of the remainder for each IMF;The relative tolerance is defined as the ratio of the square of the second norm of the difference between the remainder from the previous screening stage and the remainder from the current screening stage to the square of the second norm of the remainder from -the th screening step. The screening process stops when the value
RelativeToleranceless valueSiftRelativeTolerance. For more information, see Relative screening tolerance.RelativeToleranceis a vector whose length is equal to the number of IMF. -th element of the argumentRelativeTolerance— this is the final relative tolerance obtained for -th IMF. If IMFs are not extracted,RelativeToleranceempty.
Examples
Zero crossings and extremes in the decomposition function into internal sinusoid modes
Details
This trigonometric identity represents two different views of the same scalar signal.:
Generate two sinusoids, s and z, so that s it was the sum of three sine waves, and z — one sine wave with a modulated amplitude. Let’s make sure that the two signals are equal by calculating the norm of their difference, which is equal to infinity.
import EngeeDSP.Functions: norm
t = 0:1e-3:10
omega1 = 2π*100
omega2 = 2π*20
s = 0.25*cos.((omega1-omega2)*t) + 2.5*cos.(omega1*t) + 0.25*cos.((omega1+omega2)*t)
z = (2 .+ cos.(omega2/2*t).^2) .* cos.(omega1*t)
norm(s-z,Inf)
3.2740476996195866e-13
Let’s plot the sinusoids and select the interval in 1 one second, starting from 2 seconds.
plot(t, [s z],
xlim = (2, 3),
xlabel = "Time (s)",
ylabel = "Signal")
Using the function emd to calculate the functions of decomposition into internal modes (Intrinsic Mode Function, IMF) of the signal and additional diagnostic information. By default, the function outputs data indicating the number of screening iterations, the relative error, and the screening stop criterion for each IMF. Decomposition into empirical modes considers the signal as z.
import EngeeDSP.Functions: emd
imf, _, info = emd(s)
The number of zero crossings and local extremes differs by no more than one. This satisfies the necessary condition for the signal to be IMF.
info["NumZerocrossing"] - info["NumExtrema"]
1-element Vector{Float64}:
1.0
Let’s plot the IMF graph and select the interval in 0.5 seconds, starting from 2 seconds. The IMF is an AM signal because the function emd considers this signal to be amplitude-modulated.
plot(t, imf,
xlim = (2, 2.5),
xlabel = "Time (s)",
ylabel = "IMF")
Additional Info
The method of signal decomposition into empirical modes
Details
The algorithm of signal decomposition into empirical modes (EMD) decomposes the signal decomposition functions into Intrinsic Mode Function (IMF) and remainder in an iterative process. The main component of the algorithm is to eliminate the function to get a new feature :
-
First, find the local minima and maxima of the function ;
-
Then use the local extremes to build the lower and upper envelopes. and accordingly, for the function . Generate the average value of the envelopes ;
-
Subtract the average from to get the remainder: .
In short, the decomposition looks like this.
-
To begin with, let , where — the initial signal, and let .
-
Before screening, check :
-
Find the total number local extremes of the function .
-
Find the energy ratio for the function (see the The ratio of energies section).
-
-
If
MaxEnergyRatio, orMaxNumExtrema, or the number of IMFMaxNumIMF, then stop the decomposition. -
Let .
-
Filter out to get .
-
Check :
-
Find the relative tolerance functions (see Relative screening tolerance).
-
Get the current number of the screening iteration .
-
-
If
SiftRelativeToleranceorSiftMaxIterations), then stop screening. IMF found: . Иначе, пусть and go to step 5. -
Let .
-
Let . Return to step 2.
Decomposition functions into internal modes
Details
The EMD algorithm decomposes the signal for internal mods and the residual function through an iterative screening process:
When Huang et al. [1] first introduced IMF, it was defined as a function with two characteristics:
-
the number of local extremes — the total number of local minima and local maxima — and the number of zero crossings differ by no more than one;
-
The average value of the upper and lower envelopes constructed on the basis of local extremes is zero.
However, as noted in [4], screening before obtaining a strict IMF can lead to IMF having no physical meaning. In particular, filtering out until the number of zero crossings and local extremes differs by less than one can lead to IMFs similar to pure tones, in other words, to functions very similar to those that would be obtained by projection onto the Fourier basis. This is exactly the situation that the EMD algorithm seeks to avoid by preferring AM-FM modulated components because of their physical meaning.
The link [4] offers options for obtaining physically significant results. Function emd weakens the original definition of IMF by using Relative screening tolerance, the Cauchy convergence criterion. Function emd iteratively extracts natural AM-FM modes. The generated IMFs may not meet the criteria of local extremum and zero crossing. See the example Zero crossings and extremes in the decomposition function into internal sinusoid modes.
Relative screening tolerance
Details
The relative elimination tolerance is the Cauchy convergence criterion proposed in [4]. Screening stops when the current relative tolerance is less than the value of the argument. SiftRelativeTolerance. The current relative tolerance is defined as
Since the Cauchy criterion does not directly take into account the number of zero crossings and local extrema, it is possible that the IMF obtained as a result of decomposition does not satisfy the strict definition of the decomposition function into internal modes. In such cases, you can try to reduce the value of the argument. SiftRelativeTolerance compared to its default value. For a detailed discussion of the stopping criteria, see [4]. This link also discusses the advantages and disadvantages of insisting on strictly defined IMFs when decomposed into empirical modes.
The ratio of energies
Details
The energy ratio is the ratio of the energy of the signal at the beginning of screening to the average energy of the envelope [2]. Decomposition stops when the current energy ratio is greater than the value of the argument. MaxEnergyRatio. For The -th IMF energy ratio is defined as
Literature
-
Huang, Norden E., Zheng Shen, Steven R. Long, Manli C. Wu, Hsing H. Shih, Quanan Zheng, Nai-Chyuan Yen, Chi Chao Tung, and Henry H. Liu. «The Empirical Mode Decomposition and the Hilbert Spectrum for Nonlinear and Non-Stationary Time Series Analysis.» Proceedings of the Royal Society of London. Series A: Mathematical, Physical and Engineering Sciences 454, no. 1971 (March 8, 1998): 903–995. https://doi.org/10.1098/rspa.1998.0193.
-
Rato, R.T., M.D. Ortigueira, and A.G. Batista. «On the HHT, Its Problems, and Some Solutions.» Mechanical Systems and Signal Processing 22, no. 6 (August 2008): 1374–1394. https://doi.org/10.1016/j.ymssp.2007.11.028.
-
Rilling, Gabriel, Patrick Flandrin, and Paulo Gonçalves. «On Empirical Mode Decomposition and Its Algorithms.» IEEE-EURASIP Workshop on Nonlinear Signal and Image Processing 2003. NSIP-03. Grado, Italy. 8–11.
-
Wang, Gang, Xian-Yao Chen, Fang-Li Qiao, Zhaohua Wu, and Norden E. Huang. «On Intrinsic Mode Function.» Advances in Adaptive Data Analysis 02, no. 03 (July 2010): 277–293. https://doi.org/10.1142/S1793536910000549.