Learn R Programming

seewave (version 1.5.5)

sh: Spectral entropy

Description

This function computes the entropy of a frequency spectrum.

Usage

sh(spec)

Arguments

spec
a data set resulting of a spectral analysis obtained with spec or meanspec (not in dB).

Value

  • A single value varying between 0 and 1 is returned. The value has no unit.

Details

Spectral entropy is calculated according to: $$S = -\frac{\sum_{i = 1}^{N} y_i log_2(y_i)}{log_2(N)}$$ with: y = relative amplitude of the i frequency, and $$\sum_{i = 1}^{N} y_i = 1$$ and N = number of frequencies.

References

Nunes, R. R., Almeida de, M. P. & Sleigh, J. W. 2004 Spectral entropy: a new method for anesthetic adequacy. Revista Brasileira de Anestesiologia, 54, 413-422.

See Also

csh,th, H, sfm

Examples

Run this code
a<-synth(f=8000,d=1,cf=2000,plot=FALSE)
speca<-spec(a,f=8000,at=0.5,plot=FALSE)
sh(speca)
# [1] 0.2336412
b<-noise(d=1,f=8000)
specb<-spec(b,f=8000,at=0.5,plot=FALSE)
sh(specb)
# close to 1

Run the code above in your browser using DataLab