キャンセル
次の結果を表示 
次の代わりに検索 
もしかして: 

sample average

Hi,
i must be missing something really obvious here, but i can't seem to average my sample.
I have a noisy waveform (1000 points per cycle), and I want to average multiple cycles to create an averaged trace as a scope would normally do.
I have tried looking at all the labview examples and such and i cant figure out to do it. The only way i can think of is to store all the data into an array and then to separate it out into N x arrays each 100 points long and then add them all up (not that i can figure out that bit 😞 )

any suggestions?
Yvo
0 件の賞賛
メッセージ1/29
5,137件の閲覧回数
Hi Yvo,

well, there's a 'Mean.vi' in mathematics/statistics palette.

To do the average on your own: avg = sum(elements)/number_of(elements). There's a sum function in the numerics palette and a 'array size' function is also easy to find.

To average multiple waveforms: just add them and divide by the number of waveforms. LabView can also do math on arrays 🙂
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 件の賞賛
メッセージ2/29
5,123件の閲覧回数
The mean.vi is no use as it gives a single value of the average per cycle, thus for a noisy sine wave the mean is around 0.
what i want is the averaged wavform of several cycles, thus a noisy sine wave should become a cleaner sine wave. (surely there must be a .vi that does this, that i just can't find ?)

I still dont understand where array size comes into any of the vis as all it returns is a numeric of how long the array is.
Yvo
0 件の賞賛
メッセージ3/29
5,104件の閲覧回数
Hi Yvo,

I made an example. Have a look at this.

It's standard averaging: sum up elements and divide by number of elements.
You have 10 waveforms: add them up and divide by 10...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
メッセージ4/29
5,092件の閲覧回数
Look at the attached picture. It creates a new array where each element is the sum of element n in each of the input arrays. It then uses the array size to divide the sum to calculate the average.
0 件の賞賛
メッセージ5/29
5,086件の閲覧回数
If you just want to clean up a sine wave, try using a low pass filter. Signal Processing -> Filters -> Butterworth filter should do the trick. Read the help about it if you're unfamiliar with filters. If you still need some help I can write up an example.
0 件の賞賛
メッセージ6/29
5,077件の閲覧回数

Hi GerdW..

I am also stuck similar average problem that u suggest some solution here.  I tried modify ur solution in order to apply my problem but i couldnt. Could you please advise me some solution. I am completely stuck, and without this averaging i can not measure reliable data

thanks..

P.S: using LV7.0

0 件の賞賛
メッセージ7/29
4,947件の閲覧回数
Hi looser,

would be nice to have an example or some detailed explanation of your problem スマイリー ウインク
Or give a link to your actual thread describing this problem!

Message Edited by GerdW on 04-12-2007 11:26 AM

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 件の賞賛
メッセージ8/29
4,946件の閲覧回数
Sorry for inconvience ..The attached vi imitates what i m trying to do.
 I am acquiring scalar data  from a voltmeter and power supply and i m converting each of them to an array which is fed by register shift so that i can draw a xy graph with history.
there s a sweeping machine which sweeps my current values between 2 defined values. for each of current value i gain a y value from multimeter. So i start sweeping current from 0 ,+4,-4 and 0 again with equan increments.  When I reach 0 the collected data called spectrum1. Iteration goes on and i have spectrum 2 like first one, but the problem is that y values are different than that of first one.
i want to plot averaged spectrum every time when i get new a spectrum.
 
to be more clear lets assume process below. i ll get  following for each iteration of my main loop that controls the data acqyisation.
 

i (iteration)        Current value             corresponding multimeter value(y)           array of x                array of y

     0                         0                                              y0                                            [0]                               [y0]

     1                         1                                               y1                                           [1,0]                            [y1,y0]

     2                         2                                               y2                                           [2,1,0]                         [y2,y1,y0]

     :                          :                                                 :                                                :                                   :

12(new sweep)      0                                                y12                                [0,-1,-2...0...2..0]                [y12,y11.....y0]

13                           1                                                y13                                [1,0,-1,2..0...2..0]                [y13,y12,y11...y0]

:                               :                                                   :                                               :                                          :

now what i dont understand is that how to command vi so that it will add y13 with y0 ,y14 with y1 and so on giving averaged array with each corresponding element. My iteration keeps going continously till I see that averaged spectrum seems ok. So i can not set at the beginning how many iteartion will be performed. Besides, I might change the sweeping rate and the limits are not fixed that might be changed for each measurement. Regarding those conditions how i can set the index number performing the average process above?

And when the number of sweepings increases than it ll be more comlicated than i have the set the index number for lets say 7th average. Then the first elemtn of averaged array elements will be summation of (y0+y13+y26+y39...)/7
it s hardddd..
and i want to plot that averaged array with current values.
please help me.
0 件の賞賛
メッセージ9/29
4,939件の閲覧回数
Hi looser,

there's a Quotient&Remainder function in the math palette... Only one condition: your number of steps per sweep has to be constant!

So indexing should be like this:
 arrayindex = iteration Q&R num_of_sweep-steps

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 件の賞賛
メッセージ10/29
4,935件の閲覧回数