Engee documentation

DSP Sine Wave

Generates a discrete sinusoid.

blockType: SinDSP

Path in the library:

/Signal Operations/Sources/DSP Sine Wave

Description

Block DSP Sine Wave generates a multi-channel real or complex sinusoidal signal with independent amplitude, frequency and phase in each output channel.

The block supports signed floating-point and fixed-point data types.

The block generates a valid sinusoidal signal if for the parameter Output complexity the value is set Real.

A valid sinusoidal signal is defined by an expression like:

,

where

  • — parameter value Amplitude;

  • — parameter value Frequency (Hz) in Hz;

  • — parameter value Phase offset (rad) in the rad.

The block generates a complex exponential signal if for the parameter Output complexity the value is set Complex.

A complex exponential signal is defined by an expression like:

.

Generation of multi-channel outputs

For both real and complex sinusoids, the parameter values are Amplitude, Frequency (Hz) and Phase offset (rad) ( , and ) can be scalars or vectors of length , where — the desired number of channels at the output. When you set at least one of these parameters as a length vector 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 sinusoids

уканалканалканал ,

set the block parameters to the following values:

  • for the parameter Output complexity meaning Real.

  • for the parameter Amplitude meaning [1 2 3].

  • for the parameter Frequency (Hz) meaning [1000 500 250].

  • for the parameter Phase offset (rad) meaning [0 0 pi/2].

Ports

Output

# OUT_1 — sinusoidal signal
scalar | vector | matrix

Details

Outputs a sinusoidal signal as a scalar, vector or matrix.

To output fixed-point data types, you must set the parameters to Sample mode value Discrete and for Computation method value Table lookup.
Data types

Float64

Complex numbers support

No

Parameters

Parameters

# Amplitude — the amplitude of the sine wave
Scalar / array of real numbers

Details

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

Default value

1

Program usage name

Amplitude

Tunable

No

Evaluatable

Yes

# Frequency (Hz) — the frequency of the sine wave (for each separately)
Scalar / array of real numbers

Details

Length vector , containing the frequencies (in Hz) of the sinusoidal signals in each of the output channels, or a scalar applied to all channels. The vector must be the same length as the vectors specified in the parameters. Frequency (Hz) and Phase offset (rad). You can specify positive, zero, or negative frequencies.

Default value

100

Program usage name

Frequency

Tunable

No

Evaluatable

Yes

# Phase offset (rad) — phase shift of the sine wave
Scalar / array of real numbers

Details

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

Default value

0

Program usage name

Phase

Tunable

No

Evaluatable

Yes

# Sample mode — countdown mode
Discrete

Details

Only a discrete sampling mode is implemented Discrete. In discrete mode, the unit can generate a discrete-time output signal by directly calculating a trigonometric function or searching a table.

Values

Discrete

Default value

Discrete

Program usage name

SampleMode

Tunable

No

Evaluatable

No

# Output complexity — valid or complex waveform
Real | Complex

Details

Type of signal generated: Real sets a valid sinusoid, Complex defines a complex exponential sinusoid.

Values

Real | Complex

Default value

Real

Program usage name

Outcomplex

Tunable

No

Evaluatable

No

# Computation method — a method for calculating discrete-time sinusoids
Trigonometric fcn | Table lookup

Details

The method by which discrete-time sinusoids are generated: Trigonometric fcn or Table lookup.

To generate fixed-point sinusoids, you need to set Computation method on Table lookup.
Values

Trigonometric fcn | Table lookup

Default value

Trigonometric fcn

Program usage name

CompMethod

Tunable

No

Evaluatable

No

# Optimize table for — optimize for speed
Speed

Details

Optimizes the table of sine values by speed.

When optimizing for speed, the table contains elements, and when optimized in memory, the table contains elements where — the number of input samples in one full period of the sine wave.

Dependencies

To use this parameter, set for the parameter Computation method meaning Table lookup.

Values

Speed

Default value

Speed

Program usage name

OptimizeTable

Tunable

No

Evaluatable

No

# Sample time — the interval between the calculation steps
SampleTime (real number / vector of two real numbers)

Details

Sampling period of the sinusoidal signal, . The period of the block’s output frame is , where — parameter value Samples per frame.

Default value

1/1000

Program usage name

SampleTime

Tunable

No

Evaluatable

Yes

# Samples per frame — counts per frame
Int64 integer

Details

Number of consecutive counts from each sine wave to buffer into the output frame.

The output of the block is a matrix on with frame period , where — parameter value Sample time.

Default value

1

Program usage name

SamplesPerFrame

Tunable

No

Evaluatable

Yes

# Resetting states when re-enabled — behavior of the state inside the enabled subsystems
Restart at time zero

Details

This parameter determines the behavior of the block. DSP Sine Wave when the enabled subsystem is re-enabled. It is reset to the initial state.

Dependencies

This parameter is applied only when the block DSP Sine Wave located inside Enabled Subsystem, and for the parameter States the block Enable the value is set reset.

Values

Restart at time zero

Default value

Restart at time zero

Program usage name

ResetState

Tunable

No

Evaluatable

No

Parameters

# Output data type — type of output data
Float64 | Float32 | Fixed-point

Details

Specify the type of output data.

Values

Float64 | Float32 | Fixed-point

Default value

Float64

Program usage name

OutDataTypeStr

Tunable

No

Evaluatable

No

# Output fixed-point type — the type of fixed-point output
Data type

Details

Specify the type of fixed-point output.

Dependencies

To use this parameter, set for the parameter Output data type meaning Fixed-point.

Default value

fixdt(1, 16, 0)

Program usage name

OutDataTypeStrFixed

Tunable

No

Evaluatable

Yes