Linear or quadratic chirp.

Namespace: dsp

Prototype

static Vecf sigchirp(float f0, float f1, int n, char mode='l')

Parameters

f0Initial frequency (normalized).
f1Final frequency (normalized).
nNumber of points to generate.
mode'l' for linear, 'q' for quadratic.

Description

\[ x_k = \cos \phi_k, \quad \phi_k = 2 \pi \sum_{i=0}^k f_k \]

The \(f_k\) being lineairly or quadratically distribued between \(f_0\) and \(f_1\).

For a linear chirp: \[ f_k = f_0 + (f_1 - f_0) \left(\frac{k}{n-1}\right) \]

For a quadratic chirp: \[ f_k = f_0 + (f_1 - f_0) \left(\frac{k}{n-1}\right)^2 \]

Example


  // Fréquence initale = 0 Hz
  // Fréquence finale = 0.25 * fréquence d'échantillonnage
  // 500 échantillons
  soit x = sigchirp(0, 0.25, 500);
  Figure f;
  f.plot(x);

See also

sigtri(), sigsin(), sigcos(), sigexp()