med2d(x,filterSize,termIter,termDelta,overlapMode,plotMode)
This is the iterative 2D Minimum Entropy Deconvolution implemented according to an iterative method in the original paper:
R.A. Wiggins, Minimum Entropy Deconvolution, Geoexploration, vol. 16, Elsevier Scientific Publishing, Amsterdam, 1978. pp. 21–35.
Updated in 2015 to include the convolution adjustment fix. Proposed
in the second reference paper. This is important to fix MED from
deconvolving the trivial solution at the convolution discontinuity:
overlapMode = 'valid': Uses the convolution adjustment fix;
overlapMode = 'full': Uses the original convolution definition proposed by R.A. Wiggins. I don't recommend this.
Note to readers, you may want to refer to some of my other MEDbased submissions:
OMED:
This is a similar deconvolution problem posed by Carlos Cabrelli based on MED that
has a noniterative solution directly for the optimal deconvolution filter. I recommend
checking this out if you are interested in MED, however often the nonoptimal solution
reached by MED is a better expected result, since OMED is able to better achieve
the optimal solution of a single impulse.
MOMEDA:
This is the optimal solution to the periodic impulses and is recommended for rotating
machine faults instead of MED or OMED. Since it is noniterative, it is able to
quickly generate spectrum's to diagnose machine health.
Algorithm Reference:
R.A. Wiggins, Minimum Entropy Deconvolution, Geoexploration, vol.
16, Elsevier Scientific Publishing, Amsterdam, 1978. pp. 21–35.
Convolution Adjustment:
G.L. McDonald, <others>, Multipoint Optimal Minimum Entropy Deconvolution and Convolution
Fix: Application to Vibration Fault Detection, unpublished
Inputs:
x:
Signal to perform Minimum Entropy Deconvolution on. If a single
column/row of data is specified, a 1d filter is designed to
minimize the entropy of the resulting signals. If a 2d data
matrix is specified, a single 1d filter will be designed to
minimize the averaged entropy of each column of the filtered
data.
filterSize:
This is the length of the finite inpulse filter filter to
design. Using a value of around 30 is appropriate depending on
the data. Investigate the performance difference using
different values.
termIter: (OPTIONAL)
This is the termination number of iterations. If the
the number of iterations exceeds this number, the MED process
will complete. Specify [] to use default value of 30.
termDelta: (OPTIONAL)
This is the termination condition. If the change in kurtosis
between iterations is below this threshold, the iterative
process will terminate. Specify [] to use the default value
of 0.01. You can specify a value of 0 to only terminate on
the termIter condition, ie. execute an exact number of
iterations.
overlapMode: (OPTIONAL)
You should always use 'valid' for this parameter to include the
convolution fix that corrects MED erroneously deconvolving
spurious impulses. See algorithm reference section for
details on the convolution adjustment. You can use 'full' if you want
to reproduce the original MED results, but it is not recommended for
the above reason.
plotMode:
If this value is > 0, plots will be generated of the iterative
performance and of the resulting signal.
Outputs:
y_final:
The input signal(s) x, filtered by the resulting MED filter.
This is obtained simply as: y_final = filter(f_final,1,x);
f_final:
The final 1d MED filter in finite impulse response format.
kurtIter:
Kurtosis according to MED iteration. kurtIter(end) is the
final kurtosis, ie. the summed kurtosis of each y_final
column of y_final. sum(kurtosis(each column of y_final))
Example:
%  1d deconvolution example 
n = 0:999;
x = [sin(n/30) + 0.2*(mod(n,21)==0)];
[y_final f_final kurt] = med2d(x',30,100,[],'valid',1);
%  2d deconvolution example 
% This will mostly extract the impulselike
% disturbances caused by 0.2*(mod(n,21)==0)
% and plot the result.
n = 0:999;
x = [sin(n/30) + 0.2*(mod(n,21)==0);
sin(n/13) + 0.2*(mod(n,21)==0)];
[y_final f_final kurt] = med2d(x',30,100,[],'valid',1);
Note:
The solution is not guaranteed to be the optimal solution to the
entropy minimizataion problem, the solution is just a local
minimum of the entropy and therefore a good pick.
Cite As
Geoff McDonald (2023). med2d(x,filterSize,termIter,termDelta,overlapMode,plotMode) (https://www.mathworks.com/matlabcentral/fileexchange/29151med2dxfiltersizetermitertermdeltaoverlapmodeplotmode), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
Acknowledgements
Inspired: Minimum Entropy Deconvolution Multipack (MED, MEDA, OMEDA, MOMEDA, MCKD), AR filter + Minimum Entropy Deconvolution for Bearing Fault Diagnosis
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version  Published  Release Notes  

2.0.0.0   Updated description.


1.4.0.0   Upgraded from the 1d MED to 2d med. It can now take twodimensional input signals x, where it minimizes the summed entropy of the signals filtered by a single 1d fir filter. 

1.3.0.0   Additional input added to specify a termination number of iterations.


1.2.0.0  Updated the general information summary and fixed some sentences in the description section. 

1.0.0.0 