LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Question about the vi : Average Last Five Values

Hello,

 

I found the vi to make the average of the last five values here : https://decibel.ni.com/content/docs/DOC-4013

But i think that it is not really the average of the last five values...

 

The problem in my opinion is that the shift register on the left should contain only 4 and not 5 elements.

Can someone check it ?

 

Thanks to answer

0 Kudos
Message 1 of 10
(4,616 Views)

Hi you are correct, looking at that example it does not take the average of the last 5 values. It should have only four shift registers and the top one should be wired up. Then it would average the current data point with the previous four data points. I will update the example to make sure it is correct.

 

Thank you for pointing this out.

 

Regards

 

0 Kudos
Message 2 of 10
(4,613 Views)

As a note, I rewrote that example as a snippet and added the code saved for LabVIEW 2011, 2010 and 8.6.

 

Regards,

 

 

0 Kudos
Message 3 of 10
(4,606 Views)

,

 

if the purpose is to use as a slide mean the first version is good

 event if shift register is 4 elements size when averaging with the current one

 this is the mean of last five values mesured for exemple.

 

am i alone ?

 

Regards

 

Tinnitus

CLAD / Labview 2011, Win Xp
------------------------------------------------------
Mission d'une semaine- à plusieurs mois laissez moi un MP...
RP et Midi-pyrénées .Km+++ si possibilité de télétravail

Kudos always accepted / Les petits clicks jaunes sont toujours appréciés
Don't forget to valid a good answer / pensez à valider une réponse correcte
0 Kudos
Message 4 of 10
(4,594 Views)

The code at the link has been updated with my revised version. The original code looked like this -

original.png

 

Because it uses five shift registers and the top register is not wired up, it is not averaging the current value with the previous four values. It averages the nth value with the n-2,n-3,n-4,and n-5 values but it skips the n-1 value. Am I wrong?

 

Regards,

 

0 Kudos
Message 5 of 10
(4,582 Views)

That looks like the correct fix to me.  The previous version was definitely wrong.

 

I wanted to add a comment to that article in the community zone, but couldn't find a way to do it event though I was logged in.

 

There is a comment that the results are in valid for the first 4 iterations.  The way to fix that is to divide by the number of iteration that have occurred using the In range and coerce function to limit it to 5.

 

Message 6 of 10
(4,576 Views)

ok

CLAD / Labview 2011, Win Xp
------------------------------------------------------
Mission d'une semaine- à plusieurs mois laissez moi un MP...
RP et Midi-pyrénées .Km+++ si possibilité de télétravail

Kudos always accepted / Les petits clicks jaunes sont toujours appréciés
Don't forget to valid a good answer / pensez à valider une réponse correcte
0 Kudos
Message 7 of 10
(4,575 Views)

Isn't this the same thing?

 

Example.png

Tim
GHSP
0 Kudos
Message 8 of 10
(4,557 Views)

@aeastet wrote:

Isn't this the same thing?

 


It is if you have the full development system.

0 Kudos
Message 9 of 10
(4,551 Views)

I tried to attach that modified version to the example but it was temporarily not letting me attach images, so I put in a link to this thread. The Coerce is a nice fix.

0 Kudos
Message 10 of 10
(4,546 Views)