From 2 PM Friday, Jan 20 - 10:00 PM CST Monday, Jan 23, ni.com will be undergoing system upgrades that may result in temporary service interruption. We appreciate your patience as we improve our online experience.

Calculating Moving Average

Publish Date: Sep 06, 2006 | 0 Ratings | 0.00 out of 5 | Print | Submit your review
This VI calculates and displays the moving average, using a preselected number.

First, the VI initializes two shift registers. The top shift register is initialized with one element, then continuously adds the previous value with the new value. This shift register keeps the total of the last x measurements. After dividing the results of the add function with the preselected value, the VI calculates the moving average value. The bottom shift register contains an array with the dimension "Average". This shift register keeps all values of the measurement. The replacement function replaces the new value after every loop.

This VI is very efficient and fast because it uses the replace element function inside the while loop, and it initializes the array before it enters the loop.

This VI was created in LabVIEW 6.1.

Back to Top

Bookmark & Share


Downloads

Attachments:

Moving_Average.vi

Requirements


Ratings

Rate this document

Answered Your Question?
Yes No

Submit