ccoh {seewave}R Documentation

Continuous coherence function between two time waves

Description

This function returns a two-dimension coherence representation between two time waves. The function corresponds to a sliding coherence function along the two signals. This produces a 2-D density plot. An amplitude contour plot can be overlaid.

Usage

ccoh(wave1, wave2, f, channel = c(1,1), wl = 512, ovlp = 0, plot = TRUE,
grid = TRUE, scale = TRUE, cont = FALSE,
collevels = seq(0, 1, 0.01), palette = reverse.heat.colors,
contlevels = seq(0, 1, 0.01), colcont = "black",
colbg="white", colgrid = "black",
colaxis = "black", collab="black",
xlab = "Time (s)", ylab = "Frequency (kHz)",
scalelab = "Coherence",
main = NULL,
scalefontlab = 1, scalecexlab =0.75, axisX = TRUE, axisY = TRUE,
flim = NULL, flimd = NULL,
...)

Arguments

wave1

a first R object

wave2

a second R object

f

sampling frequency of wave (in Hz). Does not need to be specified if embedded in wave.

channel

channel of the R objects, by default left channel (1) for each object.

wl

window length for the analysis (even number of points, by default = 512).

ovlp

overlap between two successive windows (in %).

plot

logical, if TRUE plots the continuous coherence function (by default TRUE).

grid

logical, if TRUE plots a y-axis grid (by default TRUE).

scale

logical, if TRUE plots a dB colour scale on the right side of the plot (by default TRUE).

cont

logical, if TRUE overplots contour lines on the plot (by default FALSE).

collevels

a set of levels which are used to partition the amplitude range of the coherence (should be between 0 and 1.

palette

a color palette function to be used to assign colors in the plot, see Details.

contlevels

a set of levels which are used to partition the amplitude range for contour overplot (in dB).

colcont

colour for cont plotting.

colbg

background colour.

colgrid

colour for grid plotting.

colaxis

color of the axes.

collab

color of the labels.

xlab

label of the time axis.

ylab

label of the frequency axis.

scalelab

label fo the amplitude scale.

main

label of the main title.

scalefontlab

font of the amplitude scale label.

scalecexlab

cex of the amplitude scale label.

axisX

logical, if TRUE plots time X-axis (by default TRUE).

axisY

logical, if TRUE plots frequency Y-axis (by default TRUE).

flim

modifications of the frequency Y-axis limits.

flimd

dynamic modifications of the frequency Y-axis limits. New wl and ovlp arguments are applied to increase time/frequency resolution.

...

other contour and oscillo graphical parameters.

Details

Coherence is a frequency domain function computed to show the degree of a relationship between two signals. The value of the coherence function ranges between zero and one, where a value of zero indicates there is no causal relationship between the signals. A value of one indicates the existence of linear frequency response between the two signals. This can be used, for instance, to compare the input and output signals of a system.
Any colour palette can be used. In particular, it is possible to use other palettes coming with seewave: temp.colors, reverse.gray.colors.1, reverse.gray.colors.2, spectro.colors, reverse.terrain.colors, reverse.topo.colors, reverse.cm.colors corresponding to the reverse of terrain.colors, topo.colors, cm.colors.
Use locator to identify points.

Value

This function returns a list of three items:

time

a numeric vector corresponding to the time axis.

freq

a numeric vector corresponding to the frequency axis.

amp

a numeric matrix corresponding to the coherence. Each column corresponds to a coherence function of length wl.

Note

This function is based on spec.pgram, contour and filled.contour. See spectro for graphical changes.

Author(s)

Jerome Sueur sueur@mnhn.fr but this function is mainly based on spec.pgram by Martyn Plummer, Adrian Trapletti and B.D. Ripley

See Also

coh, spectro, spec.pgram.

Examples

wave1<-synth(d=1,f=4000,cf=500)
wave2<-synth(d=1,f=4000,cf=800)
ccoh(wave1,wave2,f=4000)

[Package seewave version 2.2.3 Index]