Accelerating the pace of engineering and science

# Documentation Center

• Trial Software

# wentropy

Entropy (wavelet packet)

## Syntax

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

## Description

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 string containing the type of entropy and P is an optional parameter depending on the value of T.

Entropy Type Name (T)

Parameter (P)

'shannon'

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'string

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

FunNameNo constraints on P

FunName is any other string 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.

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

so

with the convention 0log(0) = 0.

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

E2(si ) = |si|p  so

• The "log energy" entropy.

so

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 De-Noising of the User's Guide.

## Examples

```% 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 =
-142.7607

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

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

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

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

% 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')
```

## References

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.