HyperMath

Coherence

Coherence

Previous topic Next topic No expanding text in this topic  

Coherence

Previous topic Next topic JavaScript is required for expanding text JavaScript is required for the print function  

Estimates frequency coherence between two signals.  There are two forms.

Syntax

y = Coherence(input, output, block_size, overlap, length)

y = Coherence(input, output, window, overlap, length)

Arguments

Name

Description

 

input

A vector representing the input to a system.

 

output

A vector representing the output from a given system.

 

block_size

The number of elements to be used for each coherence calculation (should be a power of 2). Must be a positive integer.

 

overlap

The number of elements shared between consecutive blocks. Must be a non-negative integer and less than block_size.

 

window

A vector of window weights to apply to the signal blocks.  Its length is used as the block size.

 

length (optional)

The length of the output vector if specified as a positive integer.  If omitted or zero, the length will be the block size or window length.  If the length is specified as ‘pad’, the length will be rounded up (zero padding the inputs) if necessary to obtain a power of 2.

Output

Name

Description

 

y

A vector of the coherence at the frequency points.  Its length is the same as block_size unless the argument length is specified.

Example

Given time-domain signals data1 and data2, a vector is created which is the coherence between input data1 and output data2, using a block size of 256 and an overlap of 128.

 

Syntax

 

y = Coherence(data1, data2, 256, 128)

 

Result

 

y is a vector of length 256 ranging between 0 and 1 inclusive.

Comments

The Coherence function estimates the correlation between input and output signals as a function of frequency.  The value of the coherence ranges from 0 to 1.  A coherence of 0 means that the signals have no correlation, while a coherence of 1 means the signals are perfectly correlated.

input and output must be vectors with the same number of elements. block_size and overlap must be scalars.

If block_size is greater than the number of elements in input and output, the coherence is 1 for all frequencies, since no averaging occurs.

If input and output are the same, the coherence is 1 at all frequencies, since a signal is perfectly correlated with itself. input and output are assumed to be evenly sampled at the same rate.

The frequency axis can be generated from the time stamp data using the function Freq.

When length is set to ‘pad’, the block size is padded with zeros (if needed) to round it up to power of 2 before processing the block.

See Also:

BlockFrfImag

BlockFrfMag

BlockFrfPhase

Fold

Freq