The SineWave
object generates a discretetime
sinusoid. The sine wave object generates a real–valued sinusoid
or a complex exponential. A realvalued, discretetime sinusoid is
defined as:
$$y(n)=A\mathrm{sin}(2\pi fn+\varphi )$$
where A is the amplitude, f is the frequency in hertz, and φ is the initial phase, or phase offset, in radians. A complex exponential is defined as:
$$y(n)=A{e}^{j(2\pi fn+\varphi )}$$
For both real and complex sinusoids, the amplitude, frequency, and phase offsets can be scalars or lengthN vectors, where N is the desired number of channels in the output. When you specify at least one of these properties as a lengthN vector, scalar values specified for the other properties are applied to each of the N channels.
To generate a discretetime sinusoid:
Define and set up your sine wave. See Construction.
Call step
to generate the sinusoid according to
the properties of dsp.SineWave
. The behavior of step
is
specific to each object in the toolbox.
Note:
Starting in R2016b, instead of using the 
H = dsp.SineWave
returns
a sine wave object, H
, that generates a realvalued
sinusoid with an amplitude of 1, a frequency of 100 Hz, and a phase
offset of 0. By default, the sine wave object only generates one sample.
H = dsp.SineWave('
returns a sine wave object, PropertyName
',PropertyValue
,
...)H
, with
each property set to the specified value.
H = dsp.SineWave(AMP,FREQ,PHASE,
'
returns a sine wave object, PropertyName
',PropertyValue
,
...)H
, with
the Amplitude
property set to AMP
,
the Frequency
property set to FREQ
,
the PhaseOffset
property set to PHASE
,
and the other specified properties set to the specified values.

Amplitude of the sine wave Specify the amplitude as a lengthN vector
containing the amplitudes of the sine waves in each of N output
channels, or a scalar to apply to all N channels.
The vector length must equal that specified for the 

Frequency of the sine wave Specify a lengthN vector containing frequencies,
in hertz, of the sine waves in each of N output
channels, or a scalar to apply to all N channels.
The vector length must equal that specified for the 

Phase offset of the sine wave in radians A lengthN vector containing the phase offsets,
in radians, of the sine waves in each of N output
channels, or a scalar to apply to all Nchannels.
The vector length must equal that specified for the 

Indicates whether the sine wave is complex or real Set to 

Method used to generate sinusoids The sinusoids are generated by either the 

Optimizes the table of sine values for speed or memory Optimizes the table of sine values for 

Sampling rate for the sine wave Specify the sampling rate of the output, in hertz, as a positive numeric scalar. The default is 1000. 

Number of samples per frame Specify the number of consecutive samples from each sinusoid to buffer into the output frame. The default is 1. 

Output data type Specify the output data type as 
clone  Create sine wave object with same property values 
isLocked  Locked status for input attributes and nontunable properties 
release  Allow property value and input characteristics changes 
reset  Reset sine wave to the beginning 
step  Discretetime sine wave 
This object implements the algorithm, inputs, and outputs described on the Sine Wave block reference page. The object properties correspond to the block parameters.