You are here : matlabSignal Processingchirp

chirp() - Signal Processing

y = chirp(t,f0,t1,f1) generates
samples of a linear swept-frequency cosine signal at the time instances
defined in array t, where f0 is
the instantaneous frequency at time 0, and f1 is
the instantaneous frequency at time t1. f0 and f1 are
both in hertz. If unspecified, f0 is e-6 for
logarithmic chirp and 0 for all other methods, t1 is 1, and f1 is 100.y = chirp(t,f0,t1,f1,'method') specifies
alternative sweep method options, where method can
be:linear, which specifies an instantaneous
frequency sweep fi(t)given
byfi(t)=f0+βtwhereβ=(f1−f0)/t1and the default value for f0 is
0.  β ensures that the desired frequency breakpoint f1 at
time t1 is maintained.quadratic, which specifies an instantaneous
frequency sweep fi(t)
given byfi(t)=f0+βt2whereβ=(f1−f0)/t12and the default value for f0 is
0.  If f0 > f1 (downsweep),
the default shape is convex. If f0 < f1 (upsweep),
the default shape is concave.logarithmic specifies an instantaneous
frequency sweep fi(t)
given byfi(t)=f0×βtwhereβ=(f1f0)1t1and the default value for f0 is
1e-6. Both an upsweep (f1 > f0)
and a downsweep (f0 > f1) of frequency
is possible.Each of the above methods can be entered as 'li', 'q',
and 'lo', respectively.y = chirp(t,f0,t1,f1,'method',phi) allows
an initial phase phi to be specified in degrees.
If unspecified, phi is 0.
Default values are substituted for empty or omitted trailing input
arguments.y = chirp(t,f0,t1,f1,'quadratic',phi,'shape') specifies
the shape of the quadratic swept-frequency signal's
spectrogram. shape is either concave or convex,
which describes the shape of the parabola in the positive frequency
axis. If shape is omitted, the default is convex
for downsweep (f0 > f1) and is concave
for upsweep (f0 < f1).


Syntax

y = chirp(t,f0,t1,f1)y = chirp(t,f0,t1,f1,'method')y = chirp(t,f0,t1,f1,'method',phi)y = chirp(t,f0,t1,f1,'quadratic',phi,'shape')


Example

Linear ChirpOpen This Example
Generate a chirp with linear instantaneous frequency deviation. The chirp is sampled at 1 kHz for 2 seconds. The instantaneous frequency is 0 at t = 0 and crosses 250 Hz at t = 1 second.
t = 0:1/1e3:2;
y = chirp(t,0,1,250);
Compute and plot the spectrogram of the chirp. Specify 256 DFT points, a Hamming window of the same length, and 250 samples of overlap.spectrogram(y,256,250,256,1e3,'yaxis')

Quadratic ChirpOpen This Example
Generate a chirp with quadratic instantaneous frequency deviation. The chirp is sampled at 1 kHz for 2 seconds. The instantaneous frequency is 100 Hz at t = 0 and crosses 200 Hz at t = 1 second.
t = 0:1/1e3:2;
y = chirp(t,100,1,200,'quadratic');
Compute and plot the spectrogram of the chirp. Specify 128 DFT points, a Hamming window of the same length, and 120 samples of overlap.spectrogram(y,128,120,128,1e3,'yaxis')

Convex Quadratic ChirpOpen This Example
Generate a convex quadratic chirp sampled at 1 kHz for 2 seconds. The instantaneous frequency is 400 Hz at t = 0 and crosses 300 Hz at t = 1 second.
t = 0:1/1e3:2;
fo = 400;
f1 = 300;
y = chirp(t,fo,1,f1,'quadratic',[],'convex');
Compute and plot the spectrogram of the chirp. Specify 256 DFT points, a Hamming window of the same length, and 200 samples of overlap.spectrogram(y,256,200,256,1e3,'yaxis')

Symmetric Concave Quadratic ChirpOpen This Example
Generate a concave quadratic chirp sampled at 1 kHz for 4 seconds. Specify the time vector so that the instantaneous frequency is symmetric about the halfway point of the sampling interval, with a minimum frequency of 100 Hz and a maximum frequency of 500 Hz.
t = -2:1/1e3:2;
fo = 100;
f1 = 200;
y = chirp(t,fo,1,f1,'quadratic',[],'concave');
Compute and plot the spectrogram of the chirp. Specify 128 DFT points, a Hann window of the same length, and 120 samples of overlap. Note that the spectrogram function measures time starting at t = 0;spectrogram(y,hann(128),120,128,1e3,'yaxis')

Logarithmic ChirpOpen This Example
Generate a logarithmic chirp sampled at 1 kHz for 10 seconds. The instantaneous frequency is 10 Hz initially and 400 Hz at the end.
t = 0:1/1e3:10;
fo = 10;
f1 = 400;
y = chirp(t,fo,10,f1,'logarithmic');
Compute and plot the spectrogram of the chirp. Specify 256 DFT points, a Hamming window of the same length, and 200 samples of overlap.spectrogram(y,256,200,256,1e3,'yaxis')


Output / Return Value


Limitations


Alternatives / See Also


Reference