Learn R Programming

emuR (version 0.1.7)

dbnorm: Function to dB-normalise spectral objects

Description

The function can be used to rescale a spectrum to a dB value at a particular frequency - for example, to rescale the spectrum so that 3000 Hz has 0 dB and all other values are shifted in relation to this.

Usage

dbnorm(specdata, f = 0, db = 0)

Arguments

specdata
An object of class 'spectral'
f
A single element vector specifying the frequency. Defaults to 0
db
A single element vector specifying the dB value to which the spectrum is to be rescaled. Defaults to zero

Value

  • An object of the same class with rescaled dB values. The default is to rescale the dB-values of the spectrum to 0 dB at 0 Hz.

See Also

dbtopower plot.spectral

Examples

Run this code
# normalise to - 40 dB at 1500 Hz
res = dbnorm(e.dft, 1500, 0)
# compare the two
ylim = range(c(res, e.dft))
plot(e.dft, ylim=ylim, type="l")
par(new=TRUE)
plot(res, ylim=ylim, type="l", col=2)

Run the code above in your browser using DataLab