This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Entropy (wavelet packet)


E = wentropy(X,T,P)
E = wentropy(X,T)
E = wentropy(X,T,0)


E = wentropy(X,T,P) returns the entropy E of the vector or matrix input X. In both cases, output E is a real number.

E = wentropy(X,T) is equivalent to E = wentropy(X,T,0).

T is a character vector or string scalar containing the type of entropy and P is an optional parameter depending on the value of T.

Entropy Type Name (T)

Parameter (P)



P is not used.

'log energy' 

P is not used.

'threshold'0 ≤ P

P is the threshold.

'sure'0 ≤ P

P is the threshold.

'norm'1 ≤ P

P is the power.

'user'Character vector or string scalar

P is a character vector or string scalar containing the file name of your own entropy function, with a single input X.

FunNameNo constraints on P

FunName is any other character vector or string scalar except those used for the previous Entropy Type Names listed above.

FunName contains the file name of your own entropy function, with X as input and P as additional parameter to your entropy function.


The 'user' option is historical and still kept for compatibility, but it is obsoleted by the last option described in the table above. The FunName option do the same as the 'user' option and in addition gives the possibility to pass a parameter to your own entropy function.

Functionals verifying an additive-type property are well suited for efficient searching of binary-tree structures and the fundamental splitting property of the wavelet packets decomposition. Classical entropy-based criteria match these conditions and describe information-related properties for an accurate representation of a given signal. Entropy is a common concept in many fields, mainly in signal processing. The following example lists different entropy criteria. Many others are available and can be easily integrated. In the following expressions, s is the signal and (si)i the coefficients of s in an orthonormal basis.

The entropy E must be an additive cost function such that E(0) = 0 and

  • The (nonnormalized) Shannon entropy.



    with the convention 0log(0) = 0.

  • The concentration in lp norm entropy with 1 ≤ p.

    E2(si ) = |si|p so

  • The “log energy” entropy.



    with the convention log(0) = 0.

  • The threshold entropy.

    E4(si) = 1 if |si| > p and 0 elsewhere so E4(s) = #{i such that |si | > p} is the number of time instants when the signal is greater than a threshold p.

  • The “SURE” entropy.

    E5(s) = n - #{i such that

    For more information, see the section Wavelet Packets for Compression and Denoising of the User's Guide.


% The current extension mode is zero-padding (see dwtmode).

% Generate initial signal. 
x = randn(1,200);

% Compute Shannon entropy of x. 
e = wentropy(x,'shannon')

e =

% Compute log energy entropy of x. 
e = wentropy(x,'log energy')
e =

% Compute threshold entropy of x 
% with threshold equal to 0.2. 
e = wentropy(x,'threshold',0.2)
e =

% Compute Sure entropy of x 
% with threshold equal to 3. 
e = wentropy(x,'sure',3)
e =

% Compute norm entropy of x with power equal to 1.1. 
e = wentropy(x,'norm',1.1)
e =

% Compute user entropy of x with a user defined 
% function: userent for example. 
% This function must be a code file, with first line 
% of the following form: 
%     function e = userent(x) 
% where x is a vector and e is a real number. 
% Then a new entropy is defined and can be used typing: 
% e = wentropy(x,'user','userent')
% or more directly
% e = wentropy(x,'userent')


Coifman, R.R.; M.V. Wickerhauser (1992), “Entropy-based Algorithms for best basis selection,” IEEE Trans. on Inf. Theory, vol. 38, 2, pp. 713–718.

Donoho, D.L.; I.M. Johnstone, “Ideal de-noising in an orthonormal basis chosen from a library of bases,” C.R.A.S. Paris, Ser. I, t. 319, pp. 1317–1322.

Introduced before R2006a