DSP Sine Wave
Generates a discrete sinusoid.
blockType: SinDSP
Path in the library:
|
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 |
|
| Complex numbers support |
No |
Parameters
Parameters
#
Amplitude —
the amplitude of the sine wave
Scalar / array of real numbers
Details
Length vector
| Default value |
|
| Program usage name |
|
| Tunable |
No |
| Evaluatable |
Yes |
#
Frequency (Hz) —
the frequency of the sine wave (for each separately)
Scalar / array of real numbers
Details
Length vector
| Default value |
|
| Program usage name |
|
| Tunable |
No |
| Evaluatable |
Yes |
#
Phase offset (rad) —
phase shift of the sine wave
Scalar / array of real numbers
Details
Length vector
| Default value |
|
| Program usage name |
|
| 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 |
|
| Default value |
|
| Program usage name |
|
| 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 |
|
| Default value |
|
| Program usage name |
|
| 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 |
|
| Default value |
|
| Program usage name |
|
| 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
Dependencies
To use this parameter, set for the parameter Computation method meaning Table lookup.
| Values |
|
| Default value |
|
| Program usage name |
|
| 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,
| Default value |
|
| Program usage name |
|
| Tunable |
No |
| Evaluatable |
Yes |
#
Samples per frame —
counts per frame
Int64 integer
Details
Number of consecutive counts
The output of the block is a matrix
| Default value |
|
| Program usage name |
|
| 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 |
|
| Default value |
|
| Program usage name |
|
| Tunable |
No |
| Evaluatable |
No |
Parameters
#
Output data type —
type of output data
Float64 | Float32 | Fixed-point
Details
Specify the type of output data.
| Values |
|
| Default value |
|
| Program usage name |
|
| 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 |
|
| Program usage name |
|
| Tunable |
No |
| Evaluatable |
Yes |