NCO
Generate real or complex sinusoidal signals
 Library:
DSP System Toolbox / Signal Operations
DSP System Toolbox / Sources
Description
The NCO block generates a multichannel real or complex sinusoidal
signal, with independent frequency and phase in each output channel. The amplitude of
the created signal is always 1
. The NCO block supports
real inputs only. All outputs are real except for the output signal in
Complex exponential
mode. For more information on how the
block computes the output, see Algorithms.
To produce a multichannel output, specify a vector quantity for the Phase increment and Phase offset parameters. Both parameters must have the same length, which defines the number of output channels. Each element of each vector is applied to a different output channel.
Ports
Input
Output
Parameters
Block Characteristics
Data Types 

Direct Feedthrough 

Multidimensional Signals 

VariableSize Signals 

ZeroCrossing Detection 

Algorithms
The block implements the algorithm as shown in the following diagram:
The implementation of a numerically controlled oscillator (NCO) has two distinct parts. First, a phase accumulator accumulates the phase increment and adds in the phase offset. In this stage, an optional internal dither signal can also be added. The NCO output is then calculated by quantizing the results of the phase accumulator section and using them to select values from a lookup table. Since the lookup table contains a finite set of entries, in its normal mode of operation, the NCO block allows the adder’s numeric values to overflow and wrap around. The FixedPoint infrastructure then causes overflow warnings to appear on the command line. This overflow is of no consequence.
Given a desired output frequency F_{0}, calculate the value of the Phase increment block parameter with
$$phaseincrement=(\frac{{F}_{0}\cdot {2}^{N}}{{F}_{s}})$$
where N is the accumulator word length and
$${F}_{s}=\frac{1}{{T}_{s}}=\frac{1}{sampletime}$$
The frequency resolution of an NCO is defined by
$$\Delta f=\frac{1}{{T}_{s}\cdot {2}^{N}}\text{Hz}$$
Given a desired phase offset (in radians), calculate the Phase offset block parameter with
$$phaseoffset=\frac{{2}^{N}\cdot desiredphaseoffset}{2\pi}$$
The spurious free dynamic range (SFDR) is estimated as follows for a lookup table with $${2}^{P}$$ entries, where P is the number of quantized accumulator bits:
$$\begin{array}{l}SFDR=\left(6P\right)\text{dBwithoutdither}\\ SFDR=\left(6P+12\right)\text{dBwithdither}\end{array}$$
The NCO block uses a quarterwave lookup table technique that stores table values from 0 to π/2. The block calculates other values on demand using the accumulator data type, then casts them into the output data type. This can lead to quantization effects at the range limits of a given data type. For example, consider a case where you would expect the value of the sine wave to be –1 at π. Because the lookup table value at that point must be calculated, the block might not yield exactly –1, depending on the precision of the accumulator and output data types.
Extended Capabilities
Version History
Introduced before R2006a
See Also
Blocks
 PN Sequence Generator (Communications Toolbox)  Sine Wave  Digital DownConverter  Digital UpConverter