Sawtooth wave

float uz_wavegen_sawtooth(float amplitude, float frequency_Hz)

Returns one sample of a sawtooth wave.

Parameters:
  • amplitude – Amplitude for the sawtooth wave

  • frequency_Hz – Frequency for the sawtooth wave in Hz. Only positive values are permitted

Returns:

Returns one sample for current system time

Example

Listing 121 Example function call to sawtooth wave generator
1#include "uz_wavegen.h"
2int main(void) {
3   float amplitude = 10.0f;
4   float frequency_Hz = 5.0f;
5   float output = uz_wavegen_sawtooth(amplitude, frequency_Hz);
6}

Description

This function calculates a sawtooth based on the global system time.

Figure made with TikZ

Fig. 85 sawtooth wave