Qu

chirp

Builtin index · Plotting

result = chirp(f0, f1, fs, n, [method=])

Input: f0, f1, fs, n, method · Output: result

What it is

Identical to sweep above — same four positional arguments (start frequency, end frequency, sample rate, sample count) and the same method= (string, "linear" default or "logarithmic"/"log"/"exponential").

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
result = chirp(f0, f1, fs, n, [method=])
f0 —not documented yet
f1 —not documented yet
fs —not documented yet
n SignalReturns a Signal of length n.
method string, optionalIdentical to sweep above — same four positional arguments (start frequency, end frequency, sample rate, sample count) and the same method= (string, "linear" default or "logarithmic"/"log"/"exponential").
result Signal
Returns a Signal of length n.

Examples

From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.

signum_chirp = chirp(20, 20000, 48 kHz, 4800) |> sign

# DIBS (Discrete-Interval Binary Sequence): a multisine tuned to

# concentrate power at chosen frequencies, then binarized

excitation = multisine([50, 150, 400], [1, 1, 1], 1000, 4000)
dibs_signum = excitation |> sign            # simple thresholding

dibs_sigma_delta = excitation |> sigma_delta  # higher fidelity, more switching

from numerics-dsp

s = sine(1 kHz, 48 kHz, 4800)             # a single tone

c = chirp(20, 20000, 48 kHz, 48000)       # linear sweep, 20Hz to 20kHz

lc = chirp(20, 20000, 48 kHz, 48000, method="logarithmic")
sq = square(100, 1000, 1000, duty=0.3)    # bipolar (+-1) pulse train

p = pwm(modulator, 5000, 48000)           # natural-sampling PWM against

                                           # a triangle carrier (duty

                                           # follows the modulator's value)

from numerics-dsp

How it works

chirp(f0, f1, fs, n, [method=]) (alias sweep) — a frequency sweep from f0 to f1 over n samples, reaching f1 exactly at the last sample (t = (n-1)/fs), MATLAB's own chirp convention. method="linear" (default) or "logarithmic"; see chirp_wave's own doc comment for the exact analytic-phase formulas (not a naive per-sample frequency-then-numerically-integrate approximation, which would accumulate phase error over a long sweep).

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