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.
2.0.0.0   Updated description 

2.0.0.0   Updated description. 

2.0.0.0   Updated MED iterative algorithm to use only use only the valid output range of the convolution. This convolution fix (forming MEDA) resolves a lot of the 'spurious impulse' deconvolution problems with the traditional method. 

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. 
Randall SONG (view profile)
lewei yan (view profile)
xingwei zhao (view profile)
Minh (view profile)
MED is a terrific algorithm and the author has made a very good job.
However, I found that improvement might be needed when dealing with large data or filter kernel. In such cases, calculation the crosscorrelation using forloop is extremely slow.
To improve, I used FFTbased cross correlation and the speed was hundred times faster. Anyone interested might look into Matlab's function xcorr.m and make your own improvement.
Santhana Raj (view profile)
Good work....But I don understand why the author didnt use already existing functions like autocorr, corr, kurtosis and all... this implementation takes more time to execute...
Geoff McDonald (view profile)
I just thought I would note that the Stat toolbox is not needed anymore. I updated this to implement the kurtosis() function internally.
Geoff McDonald (view profile)
Thanks Bruno. I forgot the kurtosis() function was from the statistical toolbox. I will update the description to include it as a requirement, or just code the kurtosis function myself.
Bruno Luong (view profile)
It seems the function requires Stat toolbox and or signal processing toolbox. Author should mention the requirement.
Geoff McDonald (view profile)
If anyone would like the 2D MED implementation, just let me know and I will work on adding it to this file. I don't need the 2d approach for my work, and I want to make sure someone else would get use out of the extension before working at.