LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sliding window operation using formula

Greetings,

 I have a 1D array of 1000 values in Labview. Using those samples, I've to implement an algorithm. There I'm stuck in one of the steps, which's formula is, 

 

feller97_0-1645456995579.png

 

Where wl= 500

l=1,2,3,4,....1000

 

Can anybody help implement this formula?

Thanks in advance.

0 Kudos
Message 1 of 6
(892 Views)

As we used to write on our Physics Finals "blue books", "Answer Analysis reveals that the Question is Wrong".  Substitute "Formula" for "Question".

 

Your formula is close to a "Box-Car Moving Averager", with 2*wl being the width of the Window (note that "wl" cannot be odd because your indices, which involve the quantity "wl/2", need to be an integer).  Your averager introduces a phase-shift, since you average more points "to the left" of the center point than you do "to the right".  You also haven't considered how you initialize and terminate this "moving average".  You might also consider the values of "i", the index of summation, when (lower-case L) is 1 ...

 

Bob Schor

 

 

0 Kudos
Message 2 of 6
(872 Views)

@feller97 wrote:

Greetings,

 I have a 1D array of 1000 values in Labview. Using those samples, I've to implement an algorithm. There I'm stuck in one of the steps, which's formula is, 

 

feller97_0-1645456995579.png

 

Where wl= 500

l=1,2,3,4,....1000

 

Can anybody help implement this formula?


Which part is giving you problems? Where is the rest of the formula? (e.g. the array or array elements are not even mentioned!)

 

Get a FOR loop, an "array subset", an "add array elements", some wires, controls for Array, w, and l, each in a useful datatype (e.g. is w and l guaranteed to be integer?). Add some numeric operations, some based on [i], l, etc., and an array indicator and see if you can assemble it into something useful. Also remember that you cannot have negative indices or indices above 999 so you need to decide what to do there.

 

See how far you get. Show us what you come up with and we'll help you improve. 😄

0 Kudos
Message 3 of 6
(863 Views)

Thank you for your ideas👍

 

Let me explain this theoretically, so it might make you where I'm stuck up.

 

When i substitute wl = 500 and l= 1,2,3....1000

 

Initially, the summation starts from -249 to 250, -248 to 251, -247 to 252...

 

so my question is, can we take the negative value from the loop (it can be considered as zero) because it is known that iteration starts from 0. But I've to the negative value which can be considered as zero. 

 

Thanks

0 Kudos
Message 4 of 6
(841 Views)

You can derive any other value from [i] by applying a mathematical transform.

 

0 Kudos
Message 5 of 6
(828 Views)

@Bob_Schor wrote:

 

Your formula is close to a "Box-Car Moving Averager", with 2*wl being the width of the Window (note that "wl" cannot be odd because your indices, which involve the quantity "wl/2", need to be an integer).  Your averager introduces a phase-shift, since you average more points "to the left" of the center point than you do "to the right".  You also haven't considered how you initialize and terminate this "moving average".  You might also consider the values of "i", the index of summation, when (lower-case L) is 1 ...

 

Bob Schor

 

 


reminds me of that point-by-point vi....

 

rolling average.png

 

 

https://forums.ni.com/t5/LabVIEW/Voltage-Boxcar-Moving-Average-Filter/m-p/3659359#M1028206

0 Kudos
Message 6 of 6
(792 Views)