(t) ¶(t, f0) ¶(t, f0, t1) ¶(t, f0, t1, f1) ¶(t, f0, t1, f1, shape) ¶(t, f0, t1, f1, shape, phase) ¶Evaluate a chirp signal at time t. A chirp signal is a frequency swept cosine wave.
vector of times to evaluate the chirp signal
frequency at time t=0 [ 0 Hz ]
time t1 [ 1 sec ]
frequency at time t=t1 [ 100 Hz ]
shape of frequency sweep ’linear’ f(t) = (f1-f0)*(t/t1) + f0 ’quadratic’ f(t) = (f1-f0)*(t/t1)^2 + f0 ’logarithmic’ f(t) = (f1/f0)^(t/t1) * f0
phase shift at t=0
For example:
specgram (chirp ([0:0.001:5])); # default linear chirp of 0-100Hz in 1 sec specgram (chirp ([-2:0.001:15], 400, 10, 100, "quadratic")); soundsc (chirp ([0:1/8000:5], 200, 2, 500, "logarithmic"), 8000);
If you want a different sweep shape f(t), use the following:
y = cos (2 * pi * integral (f(t)) + phase);
The following code
t = 0:0.001:5; y = chirp (t); specgram (y, 256, 1000); %------------------------------------------------------------ % 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.
Produces the following figure
| Figure 1 |
|---|
![]() |
The following code
t = -2:0.001:15;
y = chirp (t, 400, 10, 100, "quadratic");
[S, f, t] = specgram (y, 256, 1000);
t = t - 2;
imagesc(t, f, 20 * log10 (abs (S)));
set (gca (), "ydir", "normal");
xlabel ("Time");
ylabel ("Frequency");
%------------------------------------------------------------
% Shows a quadratic chirp of 400 Hz at t=0 and 100 Hz at t=10
% Time goes from -2 to 15 seconds.
Produces the following figure
| Figure 1 |
|---|
![]() |
The following code
t = 0:1/8000:5; y = chirp (t, 200, 2, 500, "logarithmic"); specgram (y, 256, 8000); %------------------------------------------------------------- % 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.
Produces the following figure
| Figure 1 |
|---|
![]() |
Package: signal