Determining Sample Frequency and Size for Analyzing Analog Signals

Updated Sep 23, 2019

Reported In


  • LabVIEW Base
  • LabVIEW Professional
  • LabVIEW Full


  • NI-DAQmx

Issue Details

I have an analog signal that I would like to analyze, and I might want to perform frequency measurements on this signal, such as a Fourier Transform or a Fast Fourier Transform (FFT). How do I choose the sampling rate or frequency of the analog signal? How long should I sample for?


Your choice of sample rate depends upon the type of information you are interested in and the known attributes of your signal such as type and expected frequency.

To accurately measure the frequency of a signal, you need a sample rate of at least twice the highest frequency component in the signal. This concept is known as Nyquist's theorem. 
  • The equation for frequency measurement is found below:
  • where:
    fmax is the maximum resolvable frequency 
    fNyquist is the Nyquist frequency 
    fs is the sampling frequency

To analyze the shape of the signal, you will need a sampling rate of at least ten times higher than the highest frequency component in the signal. In the equation above, you would divide by 10 instead of 2.

See Using a Digitizer for Time-Domain Measurements for an illustrated discussion on this topic. 

Once you have determined your sample rate, acquire at least one full period of the waveform. The number of samples that corresponds to can be shown through frequency resolution:

The  frequency resolution (df) is dictated by the acquisition time: 
T is the period of the signal
N is the number of samples acquired 
fs is the sampling frequency 

For example, a signal with frequency 50 Hz, there will need to be at least 0.02(1/50) seconds of data for a full period of the signal. At a sampling rate of 100 Hz for a frequency measurement, N will be 5000.

Additional Information

The FFT algorithm runs most efficiently when the number of samples is a power of 2.