Skip navigation


Currently Being Moderated

Calculate Frequency of Signal Displayed on Waveform Graph

VERSION 4  Click to view document history
Created on: Sep 23, 2009 10:34 AM by John_P1 - Last Modified:  Jun 16, 2016 11:09 AM by example_scrub


This function will output the frequency of a signal displayed on a waveform graph.  If the user is zoomed into a specific portion of the signal, the function will only take into account the visible portion of the signal.



The function looks at all zero crossings in the visible region of the waveform graph.  It calculates the average distance between zero crossings (rising and falling) to obtain the average semi-period of the signal.  It then multiplies this number by two (average period) and inverts to obtain the frequency of the signal.



LabVIEW 7.1 (or compatible)


Steps to Implement or Execute Code

The attached VI is meant to be used as a subVI. A sample use case is pictured below.


Example Use Case:




In the above use case, we acquire a finite amount of data into a waveform graph.  The loop in the end allows the Meas Freq of Visible Waveform sub-vi to continuously compute frequency based on the region of the graph that we are zoomed in on:


Use Case FP.png


To obtain a reference to a waveform graph, simply right-click on the Waveform Graph icon (from the block diagram) then select Create >> Reference.  The waveform graph should have accurate timestamp information (waveform input) for the function to be able to calculate frequency.  The sub-VI will only work on a single waveform (an Array of Waveforms will cause an error within the sub VI).




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

Comments (6)