Qu

dominant_frequency

Builtin index · Signal processing

result = dominant_frequency(x, [fs])

Input: x, fs · Output: result

What it is

x: a length-N real vector or Signal; fs (optional number, Hz) is read off a Signal input the same way welch/rfft do, or passed explicitly โ€” a plain vector with neither returns a normalized frequency in cycles/sample instead of Hz.

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
result = dominant_frequency(x, [fs])
x vector or Signalx: a length-N real vector or Signal.
fs number, Signal, or vector, optionalfs (optional number, Hz) is read off a Signal input the same way welch/rfft do, or passed explicitly โ€” a plain vector with neither returns a normalized frequency in cycles/sample instead of Hz.
result number
Returns a single number: the frequency of the largest non-DC bin in x's one-sided spectrum, accurate to the bin's own resolution fs/N. The cheapest of the estimators a full sine-fit or phase-regression method would improve on; both names are the same function.

Examples

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

How it works

dominant_frequency(x, [fs]) / estimate_frequency(x, [fs]) -- the Hz of the largest non-DC bin in x's one-sided spectrum, the cheapest of the estimators toolkit-signal.md ยง6 names (zero-crossing, FFT interpolation, phase regression, least squares, and super-resolution methods for closely-spaced tones are not implemented here; this is the FFT-bin estimator only, with the bin's own resolution fs/N as its error bound). fs is read off a Signal input the same way welch/rfft do, or passed explicitly; a bare vector with no rate returns a normalized frequency in cycles/sample.

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

See also

estimate_frequency — documented in the same entry.