Qu

csd

Builtin index · Signal processing

result = csd(x, y, fs, [nperseg=min(256,len(x),len(y))], [noverlap=nperseg/2], [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 = csd(x, y, fs, [nperseg=min(256,len(x),len(y))], [noverlap=nperseg/2], [window="hann"])
x vectorx/y: equal-length real vectors.
y vectorx/y: equal-length real vectors.
fs numberfs (number, Hz).
nperseg vector or CVec, optional (default min(256,len(x),len(y)))Returns a length-nperseg/2 + 1 complex vector (CVec), the one-sided cross-spectral density Pxy — Welch's method, sharing welch's own framing/windowing/averaging exactly, so it lines up bin-for-bin with welch(x, ...)/welch(y, ...).
noverlap optional (default nperseg/2)not documented yet
window optional (default "hann")not documented yet
result vector or CVec
Returns a length-nperseg/2 + 1 complex vector (CVec), the one-sided cross-spectral density Pxy — Welch's method, sharing welch's own framing/windowing/averaging exactly, so it lines up bin-for-bin with welch(x, ...)/welch(y, ...). abs(csd(x, y, fs)) is cross-power magnitude, angle(csd(x, y, fs)) is phase.

Examples

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

How it works

csd(x, y, fs, [nperseg=], [noverlap=], [window="hann"]) — cross-spectral density Pxy of x and y, Welch's method, sharing welch's own framing/windowing/averaging exactly (numeric::transforms::csd) so it lines up bin-for-bin with welch(x, ...)/welch(y, ...). Returns the one-sided complex CSD as a CVec (nperseg/2 + 1 bins, DC to Nyquist) — abs(csd(...)) is the cross-power magnitude, angle(csd(...)) the phase; spectral_coherence below is the normalized |Pxy|^2/(Pxx*Pyy) derived from this plus two welch calls.

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