LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Moving Average and Keep indexing

Solved!
Go to solution

Hi all,

Many members share so nice VI's for performing moving average. But if the measurement deliver (NaN) it will be a problem in this case, specially. when 

the processing of data is in a real time mode. So please can some one help me to manage that.

Here I try to do that, Its working well, but when I insert it to the real time acquisition and processing it make to much problems.

Thank you.

0 Kudos
Message 1 of 6
(3,060 Views)

First some questions:

How do you want the NaNs to be treated?  How should they be ignored or replaced? Last value, last average of n , last average of n-1 , mean/median of pre- and post (i) values or ??

What  should happen if you get a series of NaNs covering the avaraging time?

Post the vi instead of a png. If we have the data we can play with it ( I 'm still running LV2012, so maybe not everyone 😉 )

 

The other question is: Why do you have NaNs in your Data?? 

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 2 of 6
(3,034 Views)

Thanks for response,

Here is the VI, in which I collect the data of one minute in an array and then process it,

I want to do the same in real time acquisition, but I beleive I made some mistake which I couldn't figure out.

I want to set a moving average of  25 size window, within this window if NaN value exist, then it should be ignored, and continue from the previuos value.

At last , becaust this data is time dependant, in the chart the values of NaN should exists as an empty space beside the moving average values.

Thanks again.

0 Kudos
Message 3 of 6
(3,019 Views)

Here is my solution:

Try both replacements 😉

 

 lastmean.png

lastvalue.png

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 4 of 6
(3,006 Views)
Solution
Accepted by topic author M.Ali

some more methods ...

what are you measuring? Just curious 😉

different methods remove NaN in average.png

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


Message 5 of 6
(2,963 Views)

Dear 

Actually I try to process data acquired from non contact temperature measurement probe, in which the temperature of some object is calculated

based on the intensity of the thermal radiation from the object . And the absolute intensity of the signal depends basically on the temperature of

the object, so if the temperature is very low or the thermal radiance from the object is blocked for any reason the probe will detect nothing and the

out put will be NaN.

I hope my explanation is clear,,

Thanks again.

Message 6 of 6
(2,931 Views)