LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

moving average filter

I have a problem that I will describe:

I am receiving a continous stream of data,  in the form of an array.

however I want to do some processing on a smaller subset of the array, and obtain similar results to as if i was using the whole array.

the processing is:

1) recevie data: 10 points

2) take mean of these 10 points

3) divide array/mean

 

and more processing which is not important.

 

the original array can have up to thousands of points. I know I can use a moving average, which i have done. so the average of the points 1:10 and 11:20 is the same as points 1:20.

however the problem is the third step, dividing each data by the mean.

 

in the end i want to plot the subset outputs, and i want it to be similar to processing the enitre data set.

Im not an expert in filters and all, but is there a good way to do this?

because the result i am getting now is quite choppy and unsmooth.

 

 

thanks!

 

0 Kudos
Message 1 of 19
(2,661 Views)

You could calculate on 1:10 then 2:11 then 3:12, etc....  This may result in "smoother" data (a bit more processing), but I'm no mathematician.

0 Kudos
Message 2 of 19
(2,657 Views)

If you are averaging data, and it is choppy, there are likely multiple things wrong.  The data is only going to be as good as the the sensor can measure.  And if you are getting crappy data at the sensor, then software should not be the one to fix it.  Fix the environment so the sensor gets the best data it can before software has to be involved.

 

That being said some times software filtering is needed and that's okay.  Try to post what an example of your code.  It is hard to understand what you are trying to do.  Do you want a moving window of data to average?  Or are you trying to understample where 10 values are now 1?

0 Kudos
Message 3 of 19
(2,653 Views)

try the mean ptbypt function in a FOR loop with a useful sample lenght, then autoindex your array into it.


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 4 of 19
(2,650 Views)

the data is good.what i meant by choppy was the results of the subarray processing compared to the whole-array processing.

basically i want to perform the 3 steps for a whole data set(thousands of points) and for subarrays(7-10 points) and be able to get similar results.

right now the results arent very similar, it gets better if i increase the size of my subset array (obviously!). but the problem is since i only receive the data in small subsets(7-10) points, i want to process them right away, and not have to wait to get more points.

 

I have the whole array in advance, but just as a reference. the real problem is  assuming i only have access to the smaller subset of data points.

 

 

thanks a lot!!

 

0 Kudos
Message 5 of 19
(2,646 Views)

Im not sure how this solves the problem...i;ve attached a vi that uses pt by pt mean.

0 Kudos
Message 6 of 19
(2,631 Views)

Your VI contains no data in the array control.


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 7 of 19
(2,607 Views)
Oh sorry, but u can assume any input array, lets assume 1:10.
0 Kudos
Message 8 of 19
(2,573 Views)

So why do you think it does not work? What result do you expect instead?


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 9 of 19
(2,560 Views)

ok lets say A = [1  2 3 4 5 6 7 8 9 10];

but I actually recevie it as B1 = [ 1 2 3 4 5] and B2 = [ 6 7 8 9 10]

the mean of B1 :3

mean of B2: 8

 

so the ouptuts would be C1 = B1/ meanB1 =  [ 1/3 2/3 3/3 4/3 5/3]

and C2 =  B2/ meanB2= [6/8 7/8 8/8 9/8 10/8]

 

the origianl array A would be: C3 =  A/meanA = [1/5.5, 2/5.5 ,3/5.5, 4/5.5, 5/5.5, 6/5.5 ,7/5.5,  8/5.5 , 9/5.5,  10/5.5]

 

so obviously plotting C1 and C2 (one after another) is not  the same as C3.

my goal is to make C1 and C2 as similar as possible to C3.

 

I hope this is more clear!

0 Kudos
Message 10 of 19
(2,552 Views)