chirp function

Chirp signal

Chirp signal

Evaluate a chirp signal (frequency swept cosine wave).

chirp( t, f0, t1 = 1, f1 = 100, shape = c("linear", "quadratic", "logarithmic"), phase = 0 )

Arguments

  • t: Time array, specified as a vector.
  • f0: Initial instantaneous frequency at time 0, specified as a positive scalar expressed in Hz. Default: 0 Hz for linear and quadratic shapes; 1e-6 for logarithmic shape.
  • t1: Reference time, specified as a positive scalar expressed in seconds. Default: 1 sec.
  • f1: Instantaneous frequency at time t1, specified as a positive scalar expressed in Hz. Default: 100 Hz.
  • shape: Sweep method, specified as "linear", "quadratic", or "logarithmic" (see Details). Default: "linear".
  • phase: Initial phase, specified as a positive scalar expressed in degrees. Default: 0.

Returns

Chirp signal, returned as an array of the same length as t.

Details

A chirp is a signal in which the frequency changes with time, commonly used in sonar, radar, and laser. The name is a reference to the chirping sound made by birds.

The chirp can have one of three shapes:

  • "linear": Specifies an instantaneous frequency sweep fi(t)f_i(t)

     given by $f_i(t) = f_0 + \beta t$, where c("$\\beta = (f_1 - f_0) /\n$", "$  t_1$") and the default value for $f_0$ is 0. The coefficient $\beta$
     
     ensures that the desired frequency breakpoint $f_1$ at time $t_1$
     
     is maintained.
    
  • "quadratic": Specifies an instantaneous frequency sweep fi(t)f_i(t)

     given by $f_i(t) = f_0 + \beta t^2$, where c("$\\beta = (f_1 - f_0) /\n$", "$  t_1^2$") and the default value for $f_0$ is 0. If $f_0 > f_1$
     
     (downsweep), the default shape is convex. If $f_0 < f_1$ (upsweep), the default shape is concave.
    
  • "logarithmic": Specifies an instantaneous frequency sweep fi(t)f_i(t) given by fi(t)=f0×βtf_i(t) = f_0 \times \beta t, where c("beta=\n\\beta =\n", " \\left( \\frac {f_1}{f_0} \\right) ^ \\frac{1}{t1}") and the default value for f0f_0 is 10610^{-6}.

Examples

# Shows linear sweep of 100 Hz/sec starting at zero for 5 sec # since the sample rate is 1000 Hz, this should be a diagonal # from bottom left to top right. t <- seq(0, 5, 0.001) y <- chirp (t) specgram (y, 256, 1000) # Shows a quadratic chirp of 400 Hz at t=0 and 100 Hz at t=10 # Time goes from -2 to 15 seconds. specgram(chirp(seq(-2, 15, by = 0.001), 400, 10, 100, "quadratic")) # Shows a logarithmic chirp of 200 Hz at t = 0 and 500 Hz at t = 2 # Time goes from 0 to 5 seconds at 8000 Hz. specgram(chirp(seq(0, 5, by = 1/8000), 200, 2, 500, "logarithmic"), fs = 8000)

Author(s)

Paul Kienzle, pkienzle@users.sf.net ,

Mike Miller.

Conversion to R by Geert van Boxtel, G.J.M.vanBoxtel@gmail.com .

  • Maintainer: Geert van Boxtel
  • License: GPL-3
  • Last published: 2024-09-11