File Exchange

image thumbnail


version 2.0 (9.87 KB) by

Generates a 1D FIR filter to minimize the entropy of the filtered signal(s)

3 Ratings



View License

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 MED-based submissions:
This is a similar deconvolution problem posed by Carlos Cabrelli based on MED that
has a non-iterative solution directly for the optimal deconvolution filter. I recommend
checking this out if you are interested in MED, however often the non-optimal solution
reached by MED is a better expected result, since OMED is able to better achieve
the optimal solution of a single impulse.
This is the optimal solution to the periodic impulses and is recommended for rotating
machine faults instead of MED or OMED. Since it is non-iterative, 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

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

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

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.

If this value is > 0, plots will be generated of the iterative
performance and of the resulting signal.

The input signal(s) x, filtered by the resulting MED filter.
This is obtained simply as: y_final = filter(f_final,1,x);

The final 1d MED filter in finite impulse response format.

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))

% -------- 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 impulse-like
% 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);

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.

Comments and Ratings (7)

xingwei zhao


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 cross-correlation using for-loop is extremely slow.

To improve, I used FFT-based 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

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

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

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

Bruno Luong (view profile)

It seems the function requires Stat toolbox and or signal processing toolbox. Author should mention the requirement.

Geoff McDonald

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.



- Updated description


- Updated description.


- 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.


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


- Additional input added to specify a termination number of iterations.
- No longer requires the Statistical Toolbox.
- The final MED filter is now normalized.


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

MATLAB Release
MATLAB 7.6 (R2008a)

MATLAB Online Live Editor Challenge

Win cash prizes and have your live script featured on our website

Learn more

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video