Example Code

Count Peaks of a Square Signal Using 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.

    Software

  • LabVIEW

Code and Documents

Attachment

Overview

This VI takes an array of values (square signal) and a user-input threshold value and returns the number of peaks in the signal.

 

Description

A square signal is input as an array and shown graphically on the front panel.  Based on the value of the user-input peak threshold, the VI will return the number of peaks in the signal.  Peaks will only be counted if they are above the threshold.

 

Requirements

  • LabVIEW 2012 (or compatible)

 

Steps to Implement or Execute Code

  1. Download the VI.
  2. Replace the Sample data with your own data
  3. Set the peak threshold value
  4. Run the VI, and the number of peaks will be returned

Additional Information or References

VI Block Diagram

count peaks.PNG

 

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

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