DSPLIB - Signal generation

All the signal generation functions currently supported by the DSP library.

• Periodic
• Non-periodic

# Sinusoidal This function generates a sinusoidal signal with a specified frequency, sampling frequency and phase.

Note
The amplitude of the signal fits in the range [-1; 1].
The phase is scaled to fit in the range [-1; 1], where -1 corresponds to -pi and 1 to pi.

Relative functions:

# Cosinusoidal This function generates a cosinusoidal signal with a specified frequency, sampling frequency and phase.

Note
The amplitude of the signal fits in the range [-1; 1].
The phase is scaled to fit in the range [-1; 1], where -1 corresponds to -pi and 1 to pi.

Relative functions:

# Noise This function generates a noise with a specified amplitude.

Note
The amplitude of the signal fits in the range [-1; 1].

Relative functions:

# Rectangular This function generates a rectangular signal.

Note
The amplitude of the signal fits in the range [-1; 1].

Relative functions:

# Square This function generates a square signal.

Note
The amplitude of the signal fits in the range [-1; 1].

Relative functions:

# Saw tooth This function generates a saw tooth signal.

Note
The amplitude of the signal fits in the range [-1; 1].

Relative functions:

# Dirac comb This function generates a dirac comb signal.

Note
The amplitude of the signal fits in the range [0; 1].

Relative functions:

# Ramp This function generates a ramp.

Note
The amplitude of the signal fits in the range [0; 1].

Relative functions:

# Step This function generates a step.

Relative functions:

# Dirac This function generates a dirac.

Note
The amplitude of the signal fits in the range [0; 1].

Relative functions:

## Functions

dsp16_t dsp16_gen_cos (dsp16_t *vect1, int size, int f, int fs, dsp16_t phase)
16-bit fixed point version of the cosinusoidal signal generation. More...

void dsp16_gen_dcomb (dsp16_t *vect1, int size, int f, int fs, dsp16_t delay)
16-bit fixed point version of the dirac comb signal generation. More...

void dsp16_gen_dirac (dsp16_t *vect1, int size, int dirac_index)
16-bit fixed point version of the dirac comb signal generation. More...

void dsp16_gen_noise (dsp16_t *vect1, int size, dsp16_t amp)
16-bit fixed point version of the noise generation. More...

void dsp16_gen_ramp (dsp16_t *vect1, int size, dsp16_t increment)
16-bit fixed point version of the ramp signal generation. More...

void dsp16_gen_rect (dsp16_t *vect1, int size, int f, int fs, dsp16_t duty, dsp16_t delay)
16-bit fixed point version of the rectangular signal generation. More...

dsp16_t dsp16_gen_saw (dsp16_t *vect1, int size, int f, int fs, dsp16_t duty, dsp16_t delay)
16-bit fixed point version of the saw tooth signal generation. More...

dsp16_t dsp16_gen_sin (dsp16_t *vect1, int size, int f, int fs, dsp16_t phase)
16-bit fixed point version of the sinusoidal signal generation. More...

static void dsp16_gen_sqr (dsp16_t *vect1, int size, int f, int fs, dsp16_t delay)
16-bit fixed point version of the square signal generation. More...

void dsp16_gen_step (dsp16_t *vect1, int size, dsp16_t intial_value, dsp16_t final_value, int step_index)
16-bit fixed point version of the dirac comb signal generation. More...

dsp32_t dsp32_gen_cos (dsp32_t *vect1, int size, int f, int fs, dsp32_t phase)
32-bit fixed point version of the cosinusoidal signal generation. More...

void dsp32_gen_dcomb (dsp32_t *vect1, int size, int f, int fs, dsp32_t delay)
32-bit fixed point version of the dirac comb signal generation. More...

void dsp32_gen_dirac (dsp32_t *vect1, int size, int dirac_index)
32-bit fixed point version of the dirac comb signal generation. More...

void dsp32_gen_noise (dsp32_t *vect1, int size, dsp32_t amp)
32-bit fixed point version of the noise generation. More...

void dsp32_gen_ramp (dsp32_t *vect1, int size, dsp32_t increment)
32-bit fixed point version of the ramp signal generation. More...

void dsp32_gen_rect (dsp32_t *vect1, int size, int f, int fs, dsp32_t duty, dsp32_t delay)
32-bit fixed point version of the rectangular signal generation. More...

dsp32_t dsp32_gen_saw (dsp32_t *vect1, int size, int f, int fs, dsp32_t duty, dsp32_t delay)
32-bit fixed point version of the saw tooth signal generation. More...

dsp32_t dsp32_gen_sin (dsp32_t *vect1, int size, int f, int fs, dsp32_t phase)
32-bit fixed point version of the sinusoidal signal generation. More...

static void dsp32_gen_sqr (dsp32_t *vect1, int size, int f, int fs, dsp32_t delay)
32-bit fixed point version of the square signal generation. More...

void dsp32_gen_step (dsp32_t *vect1, int size, dsp32_t intial_value, dsp32_t final_value, int step_index)
32-bit fixed point version of the dirac comb signal generation. More...

 dsp16_t dsp16_gen_cos ( dsp16_t * vect1, int size, int f, int fs, dsp16_t phase )

16-bit fixed point version of the cosinusoidal signal generation.

Parameters
 vect1 A pointer on a 16-bit vector which is the output buffer of this function. size The number of elements of the output vector. f The frequency of the output signal. fs The sampling frequency of the output signal. phase The phase of the output signal.
Returns
The phase of the signal generated.

References dsp16_op_cos(), and DSP16_QB.

 void dsp16_gen_dcomb ( dsp16_t * vect1, int size, int f, int fs, dsp16_t delay )

16-bit fixed point version of the dirac comb signal generation.

Parameters
 vect1 A pointer on a 16-bit vector which is the output buffer of this function. size The number of elements of the output vector. f The frequency of the output signal. fs The sampling frequency of the output signal. delay The delay of the periodic waveform. The delay must feet in the range [0; 1] where 1 to T.

References DSP16_Q, DSP16_QB, i, and MIN.

 void dsp16_gen_dirac ( dsp16_t * vect1, int size, int dirac_index )

16-bit fixed point version of the dirac comb signal generation.

Parameters
 vect1 A pointer on a 16-bit vector which is the output buffer of this function. size The number of elements of the output vector. dirac_index The index in the buffer, where the dirac appears.

 void dsp16_gen_noise ( dsp16_t * vect1, int size, dsp16_t amp )

16-bit fixed point version of the noise generation.

Parameters
 vect1 A pointer on a 16-bit vector which is the output buffer of this function. size The number of elements of the output vector. amp The amplitude of the signal.

References dsp16_op_rand(), DSP16_Q, and DSP16_QB.

 void dsp16_gen_ramp ( dsp16_t * vect1, int size, dsp16_t increment )

16-bit fixed point version of the ramp signal generation.

Parameters
 vect1 A pointer on a 16-bit vector which is the output buffer of this function. size The number of elements of the output vector. increment The incrementation of the signal per vector's element.

References DSP16_Q, and i.

 void dsp16_gen_rect ( dsp16_t * vect1, int size, int f, int fs, dsp16_t duty, dsp16_t delay )

16-bit fixed point version of the rectangular signal generation.

Parameters
 vect1 A pointer on a 16-bit vector which is the output buffer of this function. size The number of elements of the output vector. f The frequency of the output signal. fs The sampling frequency of the output signal. duty The duty cycle of the output signal. The duty cycle is a number in the range ]0; 1] which is the ratio between the pulse duration and the period of the waveform. delay The delay of the periodic waveform. The delay must feet in the range [0; 1] where 1 to T.

References DSP16_Q, DSP16_QB, i, and MIN.

Referenced by dsp16_gen_sqr().

 dsp16_t dsp16_gen_saw ( dsp16_t * vect1, int size, int f, int fs, dsp16_t duty, dsp16_t delay )

16-bit fixed point version of the saw tooth signal generation.

Parameters
 vect1 A pointer on a 16-bit vector which is the output buffer of this function. size The number of elements of the output vector. f The frequency of the output signal. fs The sampling frequency of the output signal. duty The duty cycle of the output signal. The duty cycle is a number in the range ]0; 1] which is the ratio between the pulse duration and the period of the waveform. delay The delay of the periodic waveform. The delay must feet in the range [0; 1] where 1 to T.
Returns
The phase of the signal generated.

References DSP16_Q, DSP16_QB, i, j, Max, and Min.

 dsp16_t dsp16_gen_sin ( dsp16_t * vect1, int size, int f, int fs, dsp16_t phase )

16-bit fixed point version of the sinusoidal signal generation.

Parameters
 vect1 A pointer on a 16-bit vector which is the output buffer of this function. size The number of elements of the output vector. f The frequency of the output signal. fs The sampling frequency of the output signal. phase The phase of the output signal.
Returns
The phase of the signal generated.

References dsp16_op_sin(), and DSP16_QB.

Referenced by generate_input_signal().

 static void dsp16_gen_sqr ( dsp16_t * vect1, int size, int f, int fs, dsp16_t delay )
inlinestatic

16-bit fixed point version of the square signal generation.

Parameters
 vect1 A pointer on a 16-bit vector which is the output buffer of this function. size The number of elements of the output vector. f The frequency of the output signal. fs The sampling frequency of the output signal. delay The delay of the periodic waveform. The delay must feet in the range [0; 1] where 1 to T.

References dsp16_gen_rect(), and DSP16_Q.

 void dsp16_gen_step ( dsp16_t * vect1, int size, dsp16_t intial_value, dsp16_t final_value, int step_index )

16-bit fixed point version of the dirac comb signal generation.

Parameters
 vect1 A pointer on a 16-bit vector which is the output buffer of this function. size The number of elements of the output vector. intial_value The initial value of the signal. final_value The final value of the signal. step_index The index in the buffer, where the step appears.

References i.

 dsp32_t dsp32_gen_cos ( dsp32_t * vect1, int size, int f, int fs, dsp32_t phase )

32-bit fixed point version of the cosinusoidal signal generation.

Parameters
 vect1 A pointer on a 32-bit vector which is the output buffer of this function. size The number of elements of the output vector. f The frequency of the output signal. fs The sampling frequency of the output signal. phase The phase of the output signal.
Returns
The phase of the signal generated.

References dsp32_op_cos(), and DSP32_QB.

 void dsp32_gen_dcomb ( dsp32_t * vect1, int size, int f, int fs, dsp32_t delay )

32-bit fixed point version of the dirac comb signal generation.

Parameters
 vect1 A pointer on a 32-bit vector which is the output buffer of this function. size The number of elements of the output vector. f The frequency of the output signal. fs The sampling frequency of the output signal. delay The delay of the periodic waveform. The delay must feet in the range [0; 1] where 1 to T.

References DSP32_Q, DSP32_QB, i, and MIN.

 void dsp32_gen_dirac ( dsp32_t * vect1, int size, int dirac_index )

32-bit fixed point version of the dirac comb signal generation.

Parameters
 vect1 A pointer on a 32-bit vector which is the output buffer of this function. size The number of elements of the output vector. dirac_index The index in the buffer, where the dirac appears.

 void dsp32_gen_noise ( dsp32_t * vect1, int size, dsp32_t amp )

32-bit fixed point version of the noise generation.

Parameters
 vect1 A pointer on a 32-bit vector which is the output buffer of this function. size The number of elements of the output vector. amp The amplitude of the signal.

References dsp32_op_rand(), DSP32_Q, and DSP32_QB.

 void dsp32_gen_ramp ( dsp32_t * vect1, int size, dsp32_t increment )

32-bit fixed point version of the ramp signal generation.

Parameters
 vect1 A pointer on a 32-bit vector which is the output buffer of this function. size The number of elements of the output vector. increment The incrementation of the signal per vector's element.

References DSP32_Q, and i.

 void dsp32_gen_rect ( dsp32_t * vect1, int size, int f, int fs, dsp32_t duty, dsp32_t delay )

32-bit fixed point version of the rectangular signal generation.

Parameters
 vect1 A pointer on a 32-bit vector which is the output buffer of this function. size The number of elements of the output vector. f The frequency of the output signal. fs The sampling frequency of the output signal. duty The duty cycle of the output signal. The duty cycle is a number in the range ]0; 1] which is the ratio between the pulse duration and the period of the waveform. delay The delay of the periodic waveform. The delay must feet in the range [0; 1] where 1 to T.

References DSP32_Q, DSP32_QB, i, and MIN.

Referenced by dsp32_gen_sqr().

 dsp32_t dsp32_gen_saw ( dsp32_t * vect1, int size, int f, int fs, dsp32_t duty, dsp32_t delay )

32-bit fixed point version of the saw tooth signal generation.

Parameters
 vect1 A pointer on a 32-bit vector which is the output buffer of this function. size The number of elements of the output vector. f The frequency of the output signal. fs The sampling frequency of the output signal. duty The duty cycle of the output signal. The duty cycle is a number in the range ]0; 1] which is the ratio between the pulse duration and the period of the waveform. delay The delay of the periodic waveform. The delay must feet in the range [0; 1] where 1 to T.
Returns
The phase of the signal generated.

References DSP32_Q, DSP32_QB, i, j, Max, and Min.

 dsp32_t dsp32_gen_sin ( dsp32_t * vect1, int size, int f, int fs, dsp32_t phase )

32-bit fixed point version of the sinusoidal signal generation.

Parameters
 vect1 A pointer on a 32-bit vector which is the output buffer of this function. size The number of elements of the output vector. f The frequency of the output signal. fs The sampling frequency of the output signal. phase The phase of the output signal.
Returns
The phase of the signal generated.

References dsp32_op_sin(), and DSP32_QB.

 static void dsp32_gen_sqr ( dsp32_t * vect1, int size, int f, int fs, dsp32_t delay )
inlinestatic

32-bit fixed point version of the square signal generation.

Parameters
 vect1 A pointer on a 32-bit vector which is the output buffer of this function. size The number of elements of the output vector. f The frequency of the output signal. fs The sampling frequency of the output signal. delay The delay of the periodic waveform. The delay must feet in the range [0; 1] where 1 to T.

References dsp32_gen_rect(), and DSP32_Q.

 void dsp32_gen_step ( dsp32_t * vect1, int size, dsp32_t intial_value, dsp32_t final_value, int step_index )

32-bit fixed point version of the dirac comb signal generation.

Parameters
 vect1 A pointer on a 32-bit vector which is the output buffer of this function. size The number of elements of the output vector. intial_value The initial value of the signal. final_value The final value of the signal. step_index The index in the buffer, where the step appears.

References i.