Archived:Configure Waveform Graph to Display Output of Spectral Measurements Express VI in Hertz

Updated Feb 5, 2018

National Instruments does not actively maintain this document.

This content provides support for older products and technology, so you may notice outdated links or obsolete information about operating systems or other relevant products.

Reported In

Software

  • LabVIEW

Issue Details

I am using the LabVIEW DSP Module to acquire a signal and convert it to the frequency domain using the Spectral Measurements Express VI or the EMB Real FFT VI. How do I configure the x-axis of my graph to display the units in hertz?

Solution

You can use a scaling factor to convert the x-axis so that it appears in hertz (Hz). The scaling factor depends on the sampling rate and framesize you select. 

When you configure the Analog Input Elemental I/O Node on your DSP target to acquire data from the codec, you must specify a sampling rate and a framesize. For example, you can specify the default sampling rate of 8,000 Hz and a framesize of 128 samples. Using the EMB Real FFT VI or the Spectral Measurements Express VI to transform the input signal from the time domain to the frequency domain.

By default, the waveform graph distributes points on the x-axis based on the framesize you select. In this example, the waveform graph evenly distributes points from 0–127 along the x-axis, as shown in the following figure.

The waveform graph plots the data at 128 points, or frequency bins, along the x-axis. To scale these bins to a hertz value specific to the period of the signal, you must apply the following formula to each point on the x-axis:

bin number * sampling rate/framesize

In this example, the sampling rate divided by framesize is 8,000/128 or 62.5, so you must scale the x-axis by 62.5. After scaling the x-axis by 62.5, it looks like the following figure.
 

Scaling the X-axis on a Waveform Graph
Complete the following steps to scale the x-axis.
  1. Right-click the waveform graph indicator and choose Properties from the shortcut menu to open the Waveform Graph Properties dialog box.
  2. Click the Scales tab.
  3. Select Time (X-axis) from the pull-down menu.
  4. Enter 62.5 in the Multiplier text box in the Scaling Factors section.
  5. Enter Frequency (Hz) in the Name text box.
  6. Remove the checkmark from the Autoscale checkbox and enter 4000 in the Maximum text box. According to the Nyquist sampling theorem (linked below), data in frequency bins greater than half of the sampling rate is aliased and not valid. In this example, 4,000 is half of the sampling rate of 8,000 Hz.
  7. Click the OK button to close the Waveform Graph Properties dialog box and run the DSP VI.
The following figure shows the waveform graph property changes described above.

WAS THIS ARTICLE HELPFUL?

Not Helpful