Generate continuous or discrete sine wave
DSP System Toolbox / Sources
DSP System Toolbox HDL Support / Sources
The Sine Wave block generates a multichannel real or complex sinusoidal signal, with independent amplitude, frequency, and phase in each output channel. The block supports floating point and signed fixedpoint data types.
The block generates a real sinusoidal signal when you set the Output
complexity parameter to Real
. The real
sinusoidal output is defined by an expression of the type
$$y=A\mathrm{sin}\left(2\pi ft+\varphi \right)$$
where you specify A in the Amplitude parameter, f in hertz in the Frequency parameter, and ϕ in radians in the Phase offset parameter.
The block generates a complex exponential signal when you set the Output
complexity parameter to Complex
. This complex
exponential signal is defined by an expression of the type
$$y=A{e}^{j(2\pi ft+\varphi )}=A\left\{\mathrm{cos}\left(2\pi ft+\varphi \right)+j\mathrm{sin}\left(2\pi ft+\varphi \right)\right\}$$
For both real and complex sinusoids, the Amplitude, Frequency, and Phase offset parameter values (A, f, and ϕ) 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 parameters as a lengthN vector, scalar values specified for the other parameters are applied to every channel.
For example, to generate the threechannel output containing the following real sinusoids, set the block parameters as shown:
$$y=\{\begin{array}{cc}\mathrm{sin}\left(2000\pi t\right)& \text{(channel1)}\\ 2\mathrm{sin}\left(1000\pi t\right)& \text{(channel2)}\\ 3\mathrm{sin}\left(500\pi t+\frac{\pi}{2}\right)& \text{(channel3)}\end{array}\text{}$$
Output complexity =
Real
Amplitude = [1 2 3]
Frequency = [1000 500 250]
Phase offset = [0 0 pi/2]
Data Types 

Direct Feedthrough 

Multidimensional Signals 

VariableSize Signals 

ZeroCrossing Detection 
