dsp.Chirp

Generate swept-frequency cosine (chirp) signal

Description

The Chirp object generates a swept-frequency cosine (chirp) signal.

To generate the chirp signal:

  1. Create the dsp.Chirp object and set its properties.

  2. Call the object with arguments, as if it were a function.

To learn more about how System objects work, see What Are System Objects? (MATLAB).

Creation

Syntax

chirp = dsp.Chirp
chirp = dsp.Chirp(Name,Value)

Description

chirp = dsp.Chirp returns a chirp signal, chirp, with unity amplitude.

example

chirp = dsp.Chirp(Name,Value) returns a chirp signal, chirp, with each specified property set to the specified value.

Properties

expand all

Unless otherwise indicated, properties are nontunable, which means you cannot change their values after calling the object. Objects lock when you call them, and the release function unlocks them.

If a property is tunable, you can change its value at any time.

For more information on changing property values, see System Design in MATLAB Using System Objects (MATLAB).

Specify the frequency sweep type as Swept cosine, Linear, Logarithmic, or Quadratic. This property specifies how the output instantaneous frequency sweep varies over time.

Specify the sweep direction as either Unidirectional or Bidirectional.

When you set the Type property to Linear, Quadratic, or Logarithmic, this property specifies the initial instantaneous frequency in hertz of the output chirp signal. When you set the Type property to Logarithmic, the value of this property is one less than the actual initial frequency of the sweep. Also, when the sweep is logarithmic, the initial frequency must be less than the target frequency, specified by the TargetFrequency property.

Tunable: Yes

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

When you set the Type property to Linear, Quadratic, or Logarithmic, this property specifies the instantaneous frequency of the output signal in hertz at the target time. When you set the Type property to Swept Cosine, the target frequency is the instantaneous frequency of the output at half the target time. Also, when the sweep is logarithmic, the target frequency must be greater than the initial frequency, specified by the InitialFrequency property.

Tunable: Yes

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

When you set the Type property to Linear, Quadratic, or Logarithmic, this property specifies the target time in seconds at which the target frequency is reached. When you set the Type property to Swept cosine, this property specifies the time at which the sweep reaches 2ftgt – finit Hz, where ftgt is the TargetFrequency and finit is the InitialFrequency. The target time should not be greater than the sweep time, specified by the SweepTime property.

Tunable: Yes

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

When you set the SweepDirection property to Unidirectional, the sweep time in seconds is the period of the output frequency sweep. When you set the SweepDirection property to Bidirectional, the sweep time is half the period of the output frequency sweep. The sweep time should be no less than the target time, specified by the TargetTime. This property must be a positive numeric scalar.

Tunable: Yes

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Specify initial phase of the output in radians at time t = 0.

Tunable: Yes

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Specify the sampling rate of the output in hertz as a positive numeric scalar.

Data Types: single | double | logical

Specify the number of samples to buffer into each output as a positive integer. The default value is 1.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Specify the output data type as double or single. The default value is double.

Usage

For versions earlier than R2016b, use the step function to run the System object™ algorithm. The arguments to step are the object you created, followed by the arguments shown in this section.

For example, y = step(obj,x) and y = obj(x) perform equivalent operations.

Syntax

y = chirp()

Description

example

y = chirp() returns a swept-frequency cosine output, y.

Output Arguments

expand all

Swept-frequency cosine output, returned as a scalar or a column vector. The length of the output vector equals the value you specify in the SamplesPerFrame property.

Data Types: double

Object Functions

To use an object function, specify the System object as the first input argument. For example, to release system resources of a System object named obj, use this syntax:

release(obj)

expand all

stepRun System object algorithm
releaseRelease resources and allow changes to System object property values and input characteristics
resetReset internal states of System object

Examples

expand all

Note: This example runs only in R2016b or later. If you are using an earlier release, replace each call to the function with the equivalent step syntax. For example, myObject() becomes step(myObject).

chirp = dsp.Chirp(...
    'SweepDirection', 'Bidirectional', ...
    'TargetFrequency', 25, ...
    'InitialFrequency', 0,...
    'TargetTime', 1, ...
    'SweepTime', 1, ...
    'SamplesPerFrame', 400, ...
    'SampleRate', 400);
plot(chirp());

Algorithms

This object implements the algorithm, inputs, and outputs described on the Chirp block reference page. The object properties correspond to the block parameters.

See Also

System Objects

Introduced in R2012a