Example Code

Determine if Signal is a Sine Wave in LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Hardware

  • Data Acquisition (DAQ)

    Software

  • LabVIEW

    Driver

  • NI DAQmx

Code and Documents

Attachment

Overview
This example VI demonstrates how to check if an arbitrary waveform is a sinewave.


Description
In LabVIEW you are able to find the FFT of a signal and subsequently verify that, if there is only one peak in the signal converted to frequency domain, the waveform must be a sinusoidal. In this example the signal is simulated with an Express VI and analyzed using native LabVIEW APIs that allow to filter and process the signal. Based on the number of peaks found, the program determines if the waveform analyzed is a sine wave.


Requirements

  • LabVIEW 2012 (or compatible)


Steps to Implement or Execute Code

  1. Download the attached files to your computer
  2. Open the VI "Sine Wave Detector LV2012 NI Verified.vi"
  3. Modify the type of waveform, the frequency and the threshold of the signal 
  4. Run the VI
  5. Observe the LED turning on or off after the VI finished running

Additional Information or References

VI Block Diagram

Sine Wave Detector LV2012 NI Verified.png

 

**This document has been updated to meet the current required format for the NI Code Exchange.**

Bryan H.

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.