User`s guide
Sine Wave
5-401
Table Lookup. The table look-up method precomputes the unique samples of
every output sinusoid at the start of the simulation, and recalls the samples
from memory as needed. Because a table of finite length can only be
constructed if all output sequences repeat, the method requires that the period
of every sinusoid in the output be evenly divisible by the sample period. That
is, 1/(f
i
T
s
)=k
i
must be an integer value for every channel i = 1, 2, ..., N. When
the
Optimize table for parameter is set to Speed, the table constructed for
each channel contains k
i
elements. When the Optimize table for parameter is
set to
Memory, the table constructed for each channel contains k
i
/4 elements.
For long output sequences, the table look-up method requires far fewer
floating-point operations than any of the other methods, but may demand
considerably more memory, especially for high sample rates (long tables). This
is the recommended method for models that are intended to emulate or
generate code for DSP hardware, and that therefore need to be optimized for
execution speed.
Differential. The differential method uses an incremental (differential)
algorithm rather than one based on absolute time. The algorithm computes the
output samples based on the output values computed at the previous sample
time (and precomputed update terms) by making use of the following
identities.
The update equations for the sinusoid in the ith channel, y
i
, can therefore be
written in matrix form (for real output) as
where T
s
is specified by the Sample time parameter. Since T
s
is constant, the
right-hand matrix is a constant and can be computed once at the start of the
simulation. The value of A
i
sin[2πf
i
(t+T
s
)+φ
i
] is then computed from the values
of sin(2πf
i
t+φ
i
) and cos(2πf
i
t+φ
i
) by a simple matrix multiplication at each time
step.
tT
s
+()sin t() T
s
()cossin t()cos T
s
()sin+=
tT
s
+()cos t() T
s
()coscos t() T
s
()sinsin–=
2πf
i
tT
s
+()φ
i
+{}sin
2πf
i
tT
s
+()φ
i
+{}cos
2πf
i
T
s
()cos 2πf
i
T
s
()sin
2πf
i
T
s
()sin– 2πf
i
T
s
()cos
2πf
i
t φ
i
+()sin
2πf
i
t φ
i
+()cos
=