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.
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:
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).