Learn R Programming

seewave (version 1.5.5)

coh: Coherence between two time waves

Description

This function returns the frequency coherence between two time waves.

Usage

coh(wave1, wave2, f, plot =TRUE, xlab = "Frequency (kHz)",
ylab = "Coherence", xlim = c(0,f/2000), type = "l",...)

Arguments

wave1
a vector, a matrix (first column), an object of class ts, Sample (left channel), or Wave (left channel).
wave2
a vector, a matrix (first column), an object of class ts, Sample (left channel), or Wave (left channel).
f
sampling frequency of wave1 and wave2 (in Hz). Does not need to be specified if wave1 and/or wave2 are/is of class ts, Sample, or
plot
logical, if TRUE plots the continuous coherence function (by default TRUE).
xlab
title of the frequency X-axis.
ylab
title of the coherence Y-axis.
xlim
range of frequency X-axis.
type
if plot is TRUE, type of plot that should be drawn. See plot for details (by default "l" for lines).
...
other plot graphical parameters.

Value

  • When plot is FALSE, this coh returns a two-column matrix, the first column being the frequency axis in kHz (x-axis) and the second column being the coherence (y-axis).

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.

See Also

ccoh, spectro, spec.pgram.

Examples

Run this code
wave1<-synth(d=1,f=4000,cf=500)
wave2<-synth(d=1,f=4000,cf=800)
coh(wave1,wave2,f=4000)

Run the code above in your browser using DataLab