Chirp
Generate sweptfrequency cosine (chirp) signal
 Library:
DSP System Toolbox / Sources
Description
The Chirp block outputs a sweptfrequency cosine (chirp) signal with unity amplitude and continuous phase. To specify the desired output chirp signal, you must define its instantaneous frequency function, also known as the output frequency sweep. The frequency sweep can be linear, quadratic, or logarithmic, and repeats once every Sweep time by default. For a description of the algorithms used by the Chirp block, see Algorithms.
Ports
Output
Port_1
— Sweptfrequency cosine (chirp) signal
scalar  vector
Sweptfrequency cosine (chirp) signal. In Linear
,
Logarithmic
, and
Quadratic
modes (set by the
Frequency sweep parameter), the block outputs a
sweptfrequency cosine with instantaneous frequency values specified by
the frequency and time parameters. In Swept
cosine
mode, the block outputs a sweptfrequency
cosine with a linear instantaneous output frequency that may differ from
the one specified by the frequency and time parameters.
For more information about how the block computes the output, see Algorithms.
Data Types: single
 double
Parameters
Frequency sweep
— Type of frequency sweep
Linear
(default)  Swept cosine
 Logarithmic
 Quadratic
The type of output instantaneous frequency sweep,
f_{i}(t):
Linear
,
Logarithmic
,
Quadratic
, or Swept
cosine
. For more information, see Shaping the Frequency Sweep and Algorithms.
Limitations
When you want a linearly swept chirp signal, we recommend that you use
a Linear
frequency sweep. Though a
Swept cosine
frequency sweep also yields
a linearly swept chirp signal, the output might have unexpected
frequency content.
The swept cosine sweep value at the Target time is not necessarily the Target frequency. This is because the userspecified sweep is not the actual frequency sweep of the swept cosine output, as noted in Output Computation Method for Swept Cosine Frequency Sweep. See the table Instantaneous Frequency Sweep Values for the actual value of the swept cosine sweep at the Target time.
In Swept cosine mode, do not set the parameters so that 1/T_{sw} is much greater than the values of the Initial frequency and Target frequency parameters. In such cases, the actual frequency content of the swept cosine sweep might be closer to 1/T_{sw}, far exceeding the Initial frequency and Target frequency parameter values.
Sweep mode
— Sweep mode
Unidirectional
(default)  Bidirectional
The Sweep mode parameter determines whether your sweep is unidirectional or bidirectional, which affects the shape of your output frequency sweep (see Shaping the Frequency Sweep). The following table describes the characteristics of unidirectional and bidirectional sweeps.
Sweep Mode Parameter Settings  Sweep Characteristics 





The following diagram illustrates a linear sweep in both sweep modes. For information on setting the frequency values in your sweep, see Setting Instantaneous Frequency Sweep Values.
Initial frequency (Hz)
— Initial frequency
1000
(default)  scalar
For Linear
,
Quadratic
, and Swept
cosine
sweeps, the initial frequency,
f_{0}, of the output chirp
signal. You can specify the Initial frequency (Hz) as a
scalar, greater than or equal to zero. For
Logarithmic
sweeps, Initial
frequency is one less than the actual initial frequency of
the sweep. Also, when the sweep is Logarithmic
,
you must set the Initial frequency to be less than the
Target frequency.
For more information, see Setting Instantaneous Frequency Sweep Values.
Tunable: Yes
Target frequency (Hz)
— Target frequency
4000
(default)  scalar
For Linear
,
Quadratic
, and
Logarithmic
sweeps, the instantaneous
frequency,
f_{i}(t_{g}),
of the output at the Target time,
t_{g}. You can specify the
Target frequency (Hz) as a scalar, greater than or
equal to zero. For a Swept cosine
sweep,
Target frequency is the instantaneous frequency of
the output at half the Target time,
t_{g}/2. When
Frequency sweep is
Logarithmic
, you must set the
Target frequency to be greater than the
Initial frequency.
For more information, see Setting Instantaneous Frequency Sweep Values.
Tunable: Yes
Target time (s)
— Target time of sweep
1
(default)  scalar
For Linear
, Quadratic
, and
Logarithmic
sweeps, the time,
t_{g}, at which the sweep
reaches the Target frequency,
f_{i}(t_{g}).
For a Swept cosine
sweep, Target
time is the time at which the sweep reaches
2f_{i}(t_{g})
 f_{0}. Target
time must be a scalar that is greater than or equal to zero,
and less than or equal to Sweep time , $${T}_{sw}\ge {t}_{g}$$.
For more information, see Setting Instantaneous Frequency Sweep Values.
Tunable: Yes
Sweep time (s)
— Sweep time
1
(default)  scalar
In Unidirectional
Sweep
mode, the Sweep time,
T_{sw}, is the period of the
output frequency sweep. In
Bidirectional
Sweep
mode, the Sweep time is half the period of
the output frequency sweep. Sweep time must be a scalar
that is greater than or equal to Target time, $${T}_{sw}\ge {t}_{g}$$.
Tunable: Yes
Initial phase (rad)
— Initial phase of cosine output
0
(default)  scalar
The phase, $${\varphi}_{0}$$, of the cosine output at t=0; $${y}_{chirp}(t)=\mathrm{cos}({\varphi}_{0})$$. You can specify the Initial phase (rad) as a scalar that is greater than or equal to zero.
Tunable: Yes
Sample time
— Output sample period
1/8000
(default)  positive scalar
The sample period, T_{s}, of the output. The output frame period is M_{o}T_{s}, where M_{o} is the number of samples per frame.
Samples per frame
— Samples per frame
1
(default)  positive integer
The number of samples, M_{o}, to buffer into each output frame, specified as a positive integer scalar.
Output data type
— Output data type
Double
(default)  Single
The data type of the output, specified as single precision or double precision.
Model Examples
Block Characteristics
Data Types 

Direct Feedthrough 

Multidimensional Signals 

VariableSize Signals 

ZeroCrossing Detection 

More About
Shaping the Frequency Sweep
You control the basic shape of the output instantaneous frequency sweep, f_{i}(t), using the Frequency sweep and Sweep mode parameters.
Parameters for Setting Sweep Shape  Possible Setting  Parameter Description 

Frequency sweep  Linear Quadratic Logarithmic Swept cosine  Determines whether the sweep frequencies vary linearly, quadratically, or logarithmically. Linear and swept cosine sweeps both vary linearly. 
Sweep mode  Unidirectional Bidirectional  Determines whether the sweep is unidirectional or bidirectional. For details, see Sweep mode 
The following diagram illustrates the possible shapes of the frequency sweep that you can obtain by setting the Frequency sweep and Sweep mode parameters.
For information on how to set the frequency values in your sweep, see Setting Instantaneous Frequency Sweep Values.
Setting Instantaneous Frequency Sweep Values
Set the following parameters to tune the frequency values of your output frequency sweep.
Initial frequency (Hz), f_{0}
Target frequency (Hz), f_{i}(t_{g})
Target time (seconds), t_{g}
The following table summarizes the sweep values at specific times for all Frequency sweep settings. For information on the formulas used to compute sweep values at other times, see Algorithms.
Instantaneous Frequency Sweep Values
Frequency Sweep  Sweep Value at t = 0  Sweep Value at t = t _{g}  Time When Sweep Value Is Target Frequency, f _{i} ( t _{g} ) 

Linear  f_{0}  f_{i}(t_{g})  t_{g} 
Quadratic  f_{0}  f_{i}(t_{g})  t_{g} 
Logarithmic  f_{0}  f_{i}(t_{g})  t_{g} 
Swept cosine  f_{0}  2f_{i}(t_{g})  f_{0}  t_{g}/2 
Algorithms
The Chirp block uses one of two formulas to compute the block output, depending on the Frequency Sweep parameter setting. For details, see the following sections.
Equations for Output Computation
The following table shows the equations used by the block to compute the
userspecified output frequency sweep,
f_{i}(t), the block
output, y_{chirp}(t), and
the actual output frequency sweep,
f_{i(actual)}(t). The
only time the userspecified sweep is not the actual output sweep is when the
Frequency sweep parameter is set to Swept
cosine
.
Note
The following equations apply only to unidirectional sweeps in which f_{i}(0) < f_{i}(t_{g}). To derive equations for other cases, examine the following table and the diagram in Shaping the Frequency Sweep.
The table of equations used by the block contains the following variables:
f_{i}(t) — the userspecified frequency sweep
f_{i(actual)}(t) — the actual output frequency sweep, usually equal to f_{i}(t)
y(t) — the Chirp block output
$$\psi (t)$$ — the phase of the chirp signal, where $$\psi (0)=0$$, and $$2\pi {f}_{i}(t)$$ is the derivative of the phase
$${f}_{i}(t)=\frac{1}{2\pi}\cdot \frac{d\psi (t)}{dt}$$
$${\varphi}_{0}$$ — the Initial phase parameter value, where $${y}_{chirp}(0)=\mathrm{cos}({\varphi}_{0})$$
Equations for Unidirectional Positive Sweeps
Frequency Sweep  Block Output Chirp Signal  UserSpecified Frequency Sweep, f _{i} ( t )  $$\beta $$  Actual Frequency Sweep, f _{i(actual)} ( t ) 

 $$y(t)=\mathrm{cos}(\psi (t)+{\varphi}_{0})$$  $${f}_{i}(t)={f}_{0}+\beta t$$  $$\beta =\frac{{f}_{i}({t}_{g}){f}_{0}}{{t}_{g}}$$  $${f}_{i}{{}_{(actual)}}^{(t)}={f}_{i}{}^{(t)}$$ 
 Same as  $${f}_{i}(t)={f}_{0}+\beta {t}^{2}$$  $$\beta =\frac{{f}_{i}({t}_{g}){f}_{0}}{{t}_{g}^{2}}$$  $${f}_{i}{{}_{(actual)}}^{(t)}={f}_{i}{}^{(t)}$$ 
 Same as  $${F}_{i}(t)={f}_{0}{\left(\frac{{f}_{i}\left({t}_{g}\right)}{{f}_{0}}\right)}^{\frac{t}{{t}_{g}}}$$ Where f_{i}(t_{g}) > f_{0}> 0  N/A  $${f}_{i(actual)}(t)={f}_{i}(t)$$ 
 $$y(t)=\mathrm{cos}(2\pi {f}_{i}(t)t+{\varphi}_{0})$$  Same as  Same as  $${f}_{i(actual)}(t)={f}_{i}(t)+\beta t$$ 
Output Computation Method for Linear, Quadratic, and Logarithmic Frequency Sweeps
The derivative of the phase of a chirp function gives the instantaneous frequency
of the chirp function. The Chirp block uses this principle to
calculate the chirp output when the Frequency Sweep parameter
is set to Linear
, Quadratic
,
or Logarithmic
.
$${y}_{chirp}(t)=\mathrm{cos}(\psi (t)+{\varphi}_{0})$$  Linear, quadratic, or logarithmic chirp signal with phase $$\psi (t)$$ 
$${f}_{i}(t)=\frac{1}{2\pi}\cdot \frac{d\psi (t)}{dt}$$  Phase derivative is instantaneous frequency 
For instance, if you want a chirp signal with a linear instantaneous frequency sweep, set
the Frequency Sweep parameter to
Linear
, and tune the linear sweep values by setting
other parameters appropriately. The block outputs a chirp signal, the phase
derivative of which is the specified linear sweep. This ensures that the
instantaneous frequency of the output is the linear sweep you desired. For equations
describing the linear, quadratic, and logarithmic sweeps, see Equations for Output Computation.
Output Computation Method for Swept Cosine Frequency Sweep
To generate the swept cosine chirp signal, the block sets the swept cosine chirp output as follows.
$${y}_{chirp}(t)=\mathrm{cos}(\psi (t)+{\varphi}_{0})=\mathrm{cos}(2\pi {f}_{i}(t)t+{\varphi}_{0})$$  Swept cosine chirp output (Instantaneous frequency equation, does not hold.) 
The instantaneous frequency equation, shown in Output Computation Method for Linear, Quadratic, and Logarithmic Frequency Sweeps, does not hold for the swept cosine chirp, so the userdefined frequency sweep, f_{i}(t), is not the actual output frequency sweep, f_{i(actual)}(t), of the swept cosine chirp. Thus, the swept cosine output might not behave as you expect. To learn more about swept cosine chirp behavior, see Frequency sweep described for the Frequency sweep parameter and Equations for Output Computation.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
Version History
Introduced before R2006a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
 América Latina (Español)
 Canada (English)
 United States (English)
Europe
 Belgium (English)
 Denmark (English)
 Deutschland (Deutsch)
 España (Español)
 Finland (English)
 France (Français)
 Ireland (English)
 Italia (Italiano)
 Luxembourg (English)
 Netherlands (English)
 Norway (English)
 Österreich (Deutsch)
 Portugal (English)
 Sweden (English)
 Switzerland
 United Kingdom (English)