Qu

spectral_coherence

Builtin index · Signal processing

result = spectral_coherence(x, y, fs, [nperseg=], [noverlap=], [window="hann"])

Input: x, y, fs, nperseg, noverlap, window · Output: result

What it is

x/y: equal-length real vectors; fs (number, Hz).

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
result = spectral_coherence(x, y, fs, [nperseg=], [noverlap=], [window="hann"])
x vectorx/y: equal-length real vectors.
y vectorx/y: equal-length real vectors.
fs numberfs (number, Hz).
nperseg vector, optionalReturns a length-nperseg/2 + 1 real vector, the magnitude-squared coherence |Pxy|^2 / (Pxx*Pyy) in [0, 1] — 1 at a frequency where y is an exact linear/time-invariant function of x's content there.
noverlap optionalnot documented yet
window optional (default "hann")not documented yet
coherence(A) —see the Compressed Sensing chapter
Returns a length-nperseg/2 + 1 real vector, the magnitude-squared coherence |Pxy|^2 / (Pxx*Pyy) in [0, 1] — 1 at a frequency where y is an exact linear/time-invariant function of x's content there. Unrelated to coherence(A) (see the Compressed Sensing chapter) — the largest inner product between two different normalised columns of a compressed-sensing matrix — which is a different, pre-existing function under its own name.

Examples

No documentation example calls this form yet. The Signal processing chapter is where one belongs.

How it works

spectral_coherence(x, y, fs, ...) — magnitude-squared spectral coherence of two signals, |Pxy|^2 / (Pxx*Pyy), via numeric::transforms::coherence (itself welch+csd sharing one framing). Named separately from the pre-existing, unrelated compressed-sensing coherence(A) above rather than overloaded onto it by argument count — two unrelated operations sharing one name is a trap for callers and for future dispatch changes alike.

From the note above this builtin in the interpreter, where the reasoning was written down as it was built.