iriszhaoyu Posted April 29, 2009 Report Share Posted April 29, 2009 plz see the attachment ,I use a graph to describe my question. I want to caculate the average value of ten data,and only show the average value in the table. can someone help me? thanks Quote Link to comment
Antoine Chalons Posted April 29, 2009 Report Share Posted April 29, 2009 Hi, An easy way is to use the Pt by Pt mean.vi, see below : You just place it in your while loop and it sould work fine. Hope this helps Quote Link to comment
mross Posted April 29, 2009 Report Share Posted April 29, 2009 QUOTE (iriszhaoyu @ Apr 28 2009, 07:31 AM) plz see the attachment ,I use a graph to describe my question. I want to caculate the average value of ten data,and only show the average value in the table.can someone help me? thanks A simple way to do this: You can perform the basic math functions on arrays - add two arrays and they are added cellwise, New Array (0,0) = Array1 (0,0) times Array2 (0,0),...New Array (m,n) = Array1 (m,n) times Array2 (m,n). Also subtraction, multiplication and division. By creating a set of arrays like you have described in your image, you can then add them and divide the result by the scalar number of arrays added. You can create the new arrays by simply using delete array element to eliminate the first element of the original array, then the 1st element of the new array, and so on. Add them together and the first element of the first array is added to the second element of the second array, is added to the third element of the third array. Divide that buy the number of arrays and you have the average of the first n elements. I will give you an example that does this for an average of 5 elements, and I have included a VI that compares the effects of various filters in LabVIEW - Butterworth, Chebyshev, etc. This is very useful for selecting the best filter and finding (by trial and error) a set of coefficients that suits the needs of the anaysis. You can apply the filters overlaid upon the original data to intuitively examine phase shift, and so on. Mike Quote Link to comment
hooovahh Posted April 29, 2009 Report Share Posted April 29, 2009 I think what you are looking for is a running average. I think I found this piece of code on NIs website some time ago and I have found it handy when needing to do a simple quick filter. In the zip is the running average VI, and an example which just shows how to use it. Run the example then move the slider up and down and you'll see the running average on the slider next to it, and in a graph. By default is does a running average of the last 10 values but this can be changed. BTW it is saved in 8.0 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.