Last chance! 50% off unlimited learning
Sale ends in
This function returns the instantaneous frequency (and/or phase) of a time wave through the computation of the analytic signal (Hilbert transform).
ifreq(wave, f, phase = FALSE, threshold = NULL,
plot = TRUE, xlab = "Time (s)", ylab = NULL,
ylim = NULL, type = "l", ...)
an R object.
sampling frequency of wave
(in Hz). Does not need to be specified if embedded in wave
.
if TRUE
and plot
is also TRUE
plots the instantaneous phase instead of the instantaneous frequency.
amplitude threshold for signal detection (in % ).
logical, if TRUE
plots the instantaneous frequency or phase
against time (by default TRUE
).
title of the x axis.
title of the y axis.
the range of y values.
if plot
is TRUE
, type of plot that should be drawn.
See plot
for details (by default "l" for lines).
other plot
graphical parameters.
If plot
is FALSE
, ifreq
returns a list of two components:
a two-column matrix, the first column corresponding to time in seconds (x-axis) and the second column corresponding to instantaneous frequency in kHz (y-axis).
a two-column matrix, the first column corresponding to time in seconds (x-axis) and the second column corresponding to wrapped instantaneous phase in radians (y-axis).
The instantaneous phase is the argument of the analytic signal obtained throught the Hilbert transform. The instantaneous phase is then unwrapped and derived against time to get the instantaneous frequency. There may be some edge effects at both start and end of the time wave.
Mbu Nyamsi, R. G., Aubin, T. & Bremond, J. C. 1994 On the extraction of some time dependent parameters of an acoustic signal by means of the analytic signal concept. Its application to animal sound study. Bioacoustics, 5: 187-203.
# NOT RUN {
# generate a sound with sine and linear frequency modulations
a<-synth(d=1, f=8000, cf=1500, fm=c(200,10,1000,0,0))
# plot on a single graphical device the instantaneous frequency and phase
op<-par(mfrow=c(2,1))
ifreq(a,f=8000,main="Instantaneous frequency")
ifreq(a,f=8000,phase=TRUE,main="Instantaneous phase")
par(op)
# }
Run the code above in your browser using DataLab