# coherence

Coherence function.

## Syntax

coherence(input, output, block_size, overlap)

## Argument

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).
overlap
The number of elements shared between consecutive blocks.

## Example

Curve Math Vectors Result
x = freq(c1.x[0:255:1])

y = coherence(c1.y, c2.y, 256, 128)

Given c1 and c2, a curve is created which is the coherence between input c1 and output c2, using a block size of 256 and an overlap of 128.

## 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.