12-02-2013 01:56 PM
Hi,
I have to build an application wherein I continuosly get a values stored in an array of a fixed size 10. For every new time interval the last value is deleted and new value is added to the array.At a time 10 values are read and average is calculated. once I get the mean value , I have to compare with the min and max deviation from the mean. If the value of each array of a set is within the range then I have to provide a count which shows number of values in the array set of 10 else show the count as number of values outside the range.
A set is of 10 values for each time interval.....
as
t0-t9 - 10 values....
t1-10- 10 values...
t2-t11 - 10 values..
and so on...
for all set i have to provide indication whether the set is valid or not....
Thanking you,
KHS
12-02-2013 04:03 PM
Did you do the search that you were supposed to before you asked your question? I typed in "moving average" and the search engine immediately found 100 message threads, and would probably have found more if I had given it time. Many on the first page looked like exactly what you are asking about.
Cameron
12-03-2013 12:53 AM
I did that already, but don't seem to get a proper solution...
I am sorry but I am new to labview and working for the academic project which I have to submit within few days from now...
I appreciate your help... and I will try to cover up for me through many other posts...
Thanks !!!
12-03-2013 03:50 AM
Hello,
You just want to know if your method is valid right?
It is when the array is full (10).
Had nothing to do so i changed your vi a bit, removed the for-loop and case structure.
Koen
12-03-2013 04:07 AM
hi,
I appreciate your help....!!
What I am actually looking is that, once
> I get the first 10 ( at time interval t0-t9 and values as a0-a9 ) values in the array I should start processing the mean and not until the 10 arrays have been filled with the values......after first 10 values are filled, i will check for the deviation for each array value from a0-a9, If in range it should indicate yes or else no.( this i already have ).
> once this is processed I should take the data set fom t1-t10, values as a1-a10......this will be my new set. Again I will follow the procedure for the mean check..
> This goes on continuously.....
In the earlier vi of mine and in the later one of yours, in both the case the mean is calculated from the first value itself...which is not needed for my case....
It should only process once all 10 values are entered.. later for all set it should continuously process the mean....(since for lateral time i will always have 10 values in the array)...
I tried searching for this querry but could not find any proper solution...
I would really appreciate if I can be helped !!
Thanks in advance...!!
12-03-2013 04:14 AM
12-03-2013 04:19 AM
I don't really get your point.
You want a moving average from 10 points, this is what you already implemented.
But you don't want to average it untill you have your full 10 points?
If this is what you want there are two options.
1. you create a for-loop infront of the while loops which iterates 9 times your random generator, then connect it to the array shif register.
2. start with an empty array and let the mean calculate from less then 10 points till the array is full, this one is attached.
Koen
12-03-2013 07:17 AM
The simplest way, based on your current VI, is to put a case structure around your mean and only calculate it when i (the iteration index) is greater or equal to 9 (the 10th iteration).