ccoh {seewave} | R Documentation |
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.
ccoh(wave1, wave2, f, wl = 512, ovlp = 0, plot = TRUE, grid = TRUE, scale = TRUE, cont = FALSE, collevels = seq(0, 1, 0.01), palette = rev.heat.colors, contlevels = seq(0, 1, 0.01), colcont = "black", colbg="white", colgrid = "black", colaxis = "black", collab="black", plot.title = title(main = "", xlab = "Time (s)", ylab = "Frequency (kHz)"), scalelab = "Coherence", scalefontlab = 1, scalecexlab =0.75, axisX = TRUE, axisY = TRUE, flim = NULL, flimd = NULL, ...)
wave1 |
data or a Sample object generated loading a wav file
with loadSample (package sound) describing a first time wave. |
wave2 |
data or a Sample object generated loading a wav file
with loadSample (package sound) describing a second time wave. |
f |
sampling frequency of wave1 and wave1 (in Hz).
Does not need to be specified if wave1 and/or wave2 are/is (a)
Sample object(s). |
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. |
plot.title |
statements which add titles to the plot. |
scalelab |
amplitude scale label. |
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. |
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
, rev.gray.colors.1
,
rev.gray.colors.2
,
spectro.colors
, rev.terrain.colors
, rev.topo.colors
,
rev.cm.colors
corresponding to the reverse of
terrain.colors
, topo.colors
, cm.colors
.
Use locator
to identify points.
If plot
is FALSE
, this function returns a matrix. Each column
corresponds to a coherence function of length wl
.
This function is based on spec.pgram
, contour
and
filled.contour
. See spectro
for graphical changes.
Jerome Sueur sueur@mnhn.fr but this function is
mainly based on spec.pgram
by Martyn Plummer, Adrian Trapletti
and B.D. Ripley
coh
, spectro
, spec.pgram
.
wave1<-synth(d=1,f=4000,cf=500) wave2<-synth(d=1,f=4000,cf=800) ccoh(wave1,wave2,f=4000)