chirp {gsignal} | R Documentation |
Chirp signal
Description
Evaluate a chirp signal (frequency swept cosine wave).
Usage
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 |
phase |
Initial phase, specified as a positive scalar expressed in degrees. Default: 0. |
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
f_i(t)
given byf_i(t) = f_0 + \beta t
, where\beta = (f_1 - f_0) / t_1
and the default value forf_0
is 0. The coefficient\beta
ensures that the desired frequency breakpointf_1
at timet_1
is maintained.- "quadratic"
Specifies an instantaneous frequency sweep
f_i(t)
given byf_i(t) = f_0 + \beta t^2
, where\beta = (f_1 - f_0) / t_1^2
and the default value forf_0
is 0. Iff_0 > f_1
(downsweep), the default shape is convex. Iff_0 < f_1
(upsweep), the default shape is concave.- "logarithmic"
Specifies an instantaneous frequency sweep
f_i(t)
given byf_i(t) = f_0 \times \beta t
, where\beta = \left( \frac {f_1}{f_0} \right) ^ \frac{1}{t1}
and the default value forf_0
is10^{-6}
.
Value
Chirp signal, returned as an array of the same length as t
.
Author(s)
Paul Kienzle, pkienzle@users.sf.net,
Mike Miller.
Conversion to R by Geert van Boxtel, G.J.M.vanBoxtel@gmail.com.
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)