cwt
Builtin index · Signal processing
cwt(x, fs, [wavelet="morlet"], [scales=])
Input: x, fs, wavelet, scales · Output: no output
What it is
x is a length-N real vector or Signal; fs (number, Hz) is the sample rate, or is carried by a Signal. wavelet (optional string) is "morlet" (default, complex/analytic) or "mexh" (real, also spelled "ricker"); scales (optional vector, in seconds) picks the scales, defaulting to Torrence & Compo's dyadic ladder at eight voices per octave. Continuous wavelet transform: one column per input sample, with no framing and no decimation — unlike dwt, which halves its length at every level and visits only dyadic scales. Draws a dB heatmap and returns a Record with fields coef (a (scales, N) CMat, row 0 = the smallest scale and therefore the *highest* frequency), scale (each row's scale in seconds), freq (each row's equivalent Fourier frequency in Hz, descending), time (length-N Vec, seconds) and wavelet (the name used). A scale is not a period: freq applies the wavelet-specific conversion, which a naive 1/scale gets wrong by about 3% for Morlet and 58% for the Mexican hat. The wavelet names are deliberately disjoint from dwt's Haar — asking cwt for "haar" is an error that says which transform it belongs to. Added in v0.3.0.
Overloads
One call shape — this function is not overloaded.
| Code | Input | Output | Description |
cwt(x, fs, [wavelet="morlet"], [scales=]) | x vector or Signalx is a length-N real vector or Signal.fs number or Signalfs (number, Hz) is the sample rate, or is carried by a Signal.wavelet string, optional (default "morlet")wavelet (optional string) is "morlet" (default, complex/analytic) or "mexh" (real, also spelled "ricker").scales vector, optionalscales (optional vector, in seconds) picks the scales, defaulting to Torrence & Compo's dyadic ladder at eight voices per octave. | not documented yet | Added in v0.3.0. |
Examples
No documentation example calls this form yet. The Signal processing chapter is where one belongs.
How it works
cwt(x, fs, [wavelet="morlet"], [scales=]) — continuous wavelet transform, one column per input sample (no framing, no decimation). The wavelet names here are deliberately disjoint from dwt's Haar: these are continuous wavelets used at arbitrary scales, and a shared name would suggest the two transforms are interchangeable.
From the note above this builtin in the interpreter, where the reasoning was written down as it was built.