Engee documentation

DSP Sine Wave

Generates a continuous or discrete sine wave.

sine wave

Description

The Sine Wave DSP unit generates a multi-channel real or complex sine wave signal with independent amplitude, frequency and phase in each output channel.

The unit generates a valid sine wave signal when you set the Output complexity parameter to Real.

A valid sine wave is defined by an expression of type:

π ,

where you specify A in Amplitude, f in hertz in Frequency and Φ in radians in Phase offset.

The block generates a complex exponential signal when you set the Output complexity parameter to Complex.

The complex exponential signal is defined by an expression like:

πππ

Generation of multi-channel outputs

For both real and complex sinusoids, the values of the Amplitude, Frequency, and Phase offset parameters (A, f, and Φ) can be scalars or vectors of length N, where N is the desired number of channels in the output. When you specify at least one of these parameters as a vector of length N, the scalar values specified for the other parameters are applied to each channel.

For example, to generate a three-channel output containing the following valid sine waves, set the block parameters as shown:

уπканалπканалππканал

  • Output complexity = Real.

  • Amplitude = [1 2 3].

  • Frequency = [1000 500 250].

  • Phase offset = [0 0 0 pi/2].

Ports

Output

Output_1 - sinusoidal signal
scalar | vector | matrix

Outputs a sinusoidal signal as a scalar or vector.

Data types: Float64.

Support for complex numbers: `Yes

Parameters

Amplitude - sine wave amplitude
1 (by default) | scalar | vector

A vector of length N containing the amplitudes of the sinusoids in each of the N output channels, or a scalar applied to all N channels. The vector must be the same length as the vectors specified in the Frequency and Phase offset parameters.

Frequency (Hz) - frequency of sinusoid (for each separately)
100 (By default) | scalar | vector

A vector of length N containing the frequencies (in hertz) of the sine waves in each of the N output channels, or a scalar applied to all N channels. The vector must be the same length as the vectors specified in the Frequency and Phase offset parameters. You can specify positive, zero or negative frequencies.

This parameter is configurable when you set:

  • Sample mode to Continuous.

Phase offset (rad) - phase shift of the sinusoid
0 (by default) | scalar | vector

A vector of length N containing the phase shift (in radians) of the sinusoids in each of the N output channels, or a scalar applied to all N channels. The vector must be the same length as the vectors specified in the Frequency and Phase offset parameters.

This parameter is configurable when you set:

  • Sample mode to Continuous.

Sample mode - continuous or discrete sampling mode
`Discrete (By default)

Sampling mode

  • Discrete.

    In discrete mode, the unit can generate a discrete time output signal by direct calculation of a trigonometric function, table lookup or differential method.

Output complexity - real or complex form of the signal
Real (By default) | Complex.

The type of generated signal: Real defines a real sinusoid, Complex defines a complex exponential sinusoid.

To use this parameter, set the Sample mode parameter to Discrete.

To generate fixed point sinusoids, set Computation method to Table lookup.
Sample time - interval between calculation steps
1/1000 (by default) | scalar.

The period at which the sine wave is sampled, Ts, specified as a finite scalar, is greater than zero. The period of the block output frame is M*Ts, where you specify M in the Samples per frame parameter.

Dependencies

To use this parameter, set the Sample mode parameter to Discrete.

Samples per frame - samples per frame
1 (By default) | `positive number

The number of consecutive samples from each sine wave to buffer into the output frame, M, specified as a positive scalar integer. This parameter is not configurable.

The block output is an M by N matrix with frame period M*Ts, where you specify Ts in the Sample time parameter.

Dependencies

To use this parameter, set the Sample mode parameter to Discrete.

Resetting states when re-enabled - behaviour of states within enabled subsystems
Restart at time zero (By default).

This parameter defines the behaviour of the Sine Wave block when an enabled subsystem is re-enabled. A reset to the initial state occurs.

Dependencies

This parameter applies only when the Sine Wave block is located within an enabled subsystem and the States when enabling parameter of the Enable block is set to reset.