Learn R Programming

seewave (version 1.6.4)

simspec: Similarity between two frequency spectra

Description

This function estimates the similarity between two frequency spectra.

Usage

simspec(spec1, spec2, f = NULL, plot = FALSE, type = "l",
lty1 = 1, lty2 = 2,
lty3 = 3, col1 = 2, col2 = 4, col3 = 1, flab = "Frequency (kHz)",
alab = "Amplitude (percentage)", flim = c(0, f/2000),
alim = c(0, 100),
legend = TRUE, ...)

Arguments

Value

  • The similarity index is returned. This value is in %. When plot is TRUE, both spectra and the similarity function are plotted on the same graph. The similarity index is the mean of this function.

Details

Spectra similarity is assessed according to: $$S = 100\times{\sum_{i=1}^N{\frac{\min{spec1(i),spec2(i)}} {\max{spec1(i),spec2(i)}}}}$$ with S in %.

References

Deecke, V. B. and Janik, V. M. 2006. Automated categorization of bioacoustic signals: avoiding perceptual pitfalls. Journal of the Acoustical Society of America, 119: 645-653.

See Also

spec, meanspec, corspec, diffspec, diffenv, kl.dist, ks.dist, logspec.dist, itakura.dist

Examples

Run this code
a<-noisew(f=8000,d=1)
b<-synth(f=8000,d=1,cf=2000)
c<-synth(f=8000,d=1,cf=1000)
d<-noisew(f=8000,d=1)
speca<-spec(a,f=8000,at=0.5,plot=FALSE)
specb<-spec(b,f=8000,at=0.5,plot=FALSE)
specc<-spec(c,f=8000,at=0.5,plot=FALSE)
specd<-spec(d,f=8000,at=0.5,plot=FALSE)
simspec(speca,speca)
simspec(speca,specb)
simspec(speca,specc,plot=TRUE)
simspec(specb,specc,plot=TRUE)
#[1] 12.05652
simspec(speca,specd,plot=TRUE)

Run the code above in your browser using DataLab