This example is designed to show how it may be possible to remove higher-frequency noise from a waveform without explicit use of a filter.
The code uses two different methods of averaging that allow waveforms to be cleaned and smoothed out. The first method demonstrates the the use of point-by-point averaging to slightly reduce the noise present in a waveform. It does this by taking a set number of points and averaging them together to create one new point in their place. It does this for each point on the waveform and results in a much smoother curve if enough points are used. Increasing the number of points produces a smoother curve, but as the number increases the phase will slowly begin to shift relative to the input waveform and the amplitude of the waveform will decrease. However, it can be very useful in situations where a perfectly clean signal is not required.
The second method produces a much nicer output, but is designed for repeating signals that remain in phase from one iteration to the next. This method adds the previous instances of the waveforms to the new one, creating a "total", and then divides by the number of waveforms added together to acheive an "average" waveform. This example does not limit the number of waveforms that are added together, but an acutal implementation may want to limit this number to prevent overflow errors.
LabVIEW 2010 or compatible
Steps to Implement or Execute Code
Download and run the attached VI.
Change the values of the different controls to get an understanding of how some of the averaging code behaves.
Additional Information or References
Screenshot of the front panel while the code is in action:
And a screenshot of the block diagram:
**This document has been updated to meet the current required format for the NI Code Exchange.**
Ryan P. National Instruments | Systems Engineer | CLA