| Using Simulink | Search  Help Desk |
| Sine Wave |
Library
SourcesDescription
0 (the default) causes the block to operate in continuous mode.
>0 causes the block to operate in discrete mode.
-1 causes the block to operate in the same mode as the block receiving the signal.
Using the Sine Wave Block in Discrete Mode
A Sample time parameter value greater than zero causes the block to behave as if it were driving a Zero-Order Hold block whose sample time is set to that value. Using the Sine Wave block in this way allows you to build models with sine wave sources that are purely discrete, rather than models that are hybrid continuous/discrete systems. Hybrid systems are inherently more complex and, as a result, take longer to simulate. The Sine Wave block in discrete mode uses an incremental algorithm rather than one based on absolute time. As a result, the block can be useful in models intended to run for an indefinite length of time, such as in vibration or fatigue testing. The incremental algorithm computes the sine based on the value computed at the previous sample time. This method makes use of the following identities:
Since
![]()
t is constant, the following expression is a constant.
Therefore the problem becomes one of a matrix multiply of the value of sin(t) by a constant matrix to obtain sin(t+
![]()
t). This algorithm may also be faster on computers that do not have hardware floating-point support for trigonometric functions.
Using the Sine Wave Block in Continuous Mode
A Sample time parameter value of zero causes the block to behave in continuous mode. When operating in continuous mode, the Sine Wave block can become inaccurate due to loss of precision as time becomes very large.Data Type Support
A Sine Wave block accepts and outputs real signals of typedouble.
Parameters and Dialog Box

1.1 rad/sec.0 radians.0.Characteristics
| Sample Time |
Continuous, discrete, or inherited |
| Scalar Expansion |
Of parameters |
| Vectorized |
Yes |
| Zero Crossing |
No |