dsp.SineWave
Generate discrete sine wave
Description
The dsp.SineWave
System object™ generates a real or complex, multichannel sinusoidal signal with independent
amplitude, frequency, and phase in each output channel.
For both real and complex sinusoids, the Amplitude, Frequency, and PhaseOffset properties can be scalars or length-N vectors, where N is the number of channels in the output. When you specify at least one of these properties as a length-N vector, scalar values specified for the other properties are applied to each of the N channels.
The dsp.SineWave
object and the sin
function both generate a discrete sine wave signal. However, the object can
process large streams of real-time data and handle system states automatically. The function
performs one-time computations on data that is readily available and cannot handle system
states. For a comparison between the two, see System Objects vs MATLAB Functions.
To generate a discrete-time sinusoidal signal:
Create the
dsp.SineWave
object and set its properties.Call the object with arguments, as if it were a function.
To learn more about how System objects work, see What Are System Objects?
Creation
Syntax
Description
creates a sine wave
object that generates a real-valued sinusoid with an amplitude of 1, a frequency of 100
Hz, and a phase offset of 0. By default, the sine wave object generates only one
sample.sine
= dsp.SineWave
creates a sine wave object with each specified property set to the specified value.
Enclose each property name in single quotes. sine
= dsp.SineWave(Name,Value
)
Example: sine = dsp.SineWave('Amplitude',2);
creates a sine wave object with the Amplitude property set to sine
= dsp.SineWave(amp,freq,phase,Name,Value
)amp
, Frequency property set to freq
,
PhaseOffset property set to phase
,
and any other specified properties set to the specified values.
Properties
Usage
Syntax
Output Arguments
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)
Examples
More About
Algorithms
Extended Capabilities
Version History
Introduced in R2012a