Generating an Analog Signal with the Correct Frequency

Updated Mar 30, 2023

Environment

Software

  • LabVIEW

Driver

  • NI-DAQmx

  • I tried to generate a signal, but it's frequency does not match the the waveform I used
  • I don't know how to generate a periodic signal with the specific frequency that I want

To generate a desired output frequency from a given waveform:
 
  1. Count the number of samples per period of your waveform
  2. Calculate the necessary update rate of your device based on this formula:
Update Rate = Output Frequency * # of Samples per Period
Note:  If the required update rate is above your device's specification, we will need to modify the waveform, use a faster device, or choose a lower frequency signal to generate.

To generate a desired output frequency with a given update rate:
  1. Calculate the number of samples for each period based on this formula:

    # of Samples per Period = Update Rate / Output Frequency
     
  2. Create a waveform of the desired signal with the correct number of samples per period
Note: You need to have more than 2 samples per period based on Nyquist Theorem.
 

Additional Information

In general, this is the formula for calculating the frequency of the analog signal being output:


Output Frequency = Update Rate / # of Samples per Period
Note: Based on Nyquist Theorem , the quality of the signal is significantly improved by having at least 10 samples per period