LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Making average of an analogic signal in LAbview

Hello guys,  I have some problems with  making   average of   value of an analogic signal and calculating percentage of variation from a default  value. This is my   VI,  can somebody tell me what i am doing wrong?

0 Kudos
Message 1 of 10
(3,862 Views)

Hi wlladdd,

 

what's the point in adding the very same value several times and divide the sum by the number of addition operations?

And why do you have that "wait for next" in your adder loops? Why do you want to wait for 10s - for a rube-goldberg operation?

THINK DATAFLOW!

 

- You have to keep values from previous iterations in a shift register to create some averaging.

- You can have shift registers in the main while loop…

- You could use the PtByPtMean function as a very easy starting point…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 10
(3,844 Views)

check this , i make a sinewave outside the while loop and add some noise in it. the sampling rate for both sine and noise is 3000 Hz sampling freq and 10000 samples. i then give it to a display and also to a std dev and varinace calc. i put the while loop only to keep the vi running otherwise there is no need as when it tum single time the calc will already be made.anlg std dev.JPG

0 Kudos
Message 3 of 10
(3,828 Views)
Please stop posting VIs with greedy loops. You've been told this before and also about providing examplesb that teach bad practices.
0 Kudos
Message 4 of 10
(3,820 Views)

you have told me before for the flat structure usage and i understand that thing please check your post. furthermore i have already mentioned in my post that this loop is nothing to concern with the vi, so there is nothing like motivating some one to use while loops. please read it carefully.

0 Kudos
Message 5 of 10
(3,811 Views)
I did read it carefully. Since there is absolutely no reason for the loop, there was no reason to have it. Since you did have it, there was no reason not to use it properly.

Check your other posts where I responded for where I already mentioned your use of s while loop with no wait - a greedy loop and very bad practice.
0 Kudos
Message 6 of 10
(3,800 Views)

Hi wladdd,

 

using PtByPtMean is as easy like this:

check.png

 

@Tirmizi,


What's the point in showing greedy loops?

What's the point in showing VIs with an unneeded (and therefore Rube-Goldberg) loop?

And additionally: when you show code you should use the autocleanup tool before posting. Nobody likes code examples not following the LabVIEW StyleGuide… (Well, I could have added some comments too! 🙂 )

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 7 of 10
(3,772 Views)

Hello guys, thanks for the answer but  don't know to  integrate   the last  exemple in my project. somebody help me?

0 Kudos
Message 8 of 10
(3,754 Views)

Hi wlladdd,

 

in my snippet above you need to replace the RandomNumber by your DAQ code…

 

Is it that hard to put a simple PtByPtMean in the wire of your measurement value?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 9 of 10
(3,737 Views)

@GerdW wrote:

 

Is it that hard to put a simple PtByPtMean in the wire of your measurement value?


<Standard reply about free training>

 

3 Hour Introduction http://www.ni.com/white-paper/5243/en/

6 Hour Introduction http://www.ni.com/white-paper/5241/en/

LabVEW Basics http://www.ni.com/gettingstarted/labviewbasics/

Self Paced training for students http://www.ni.com/academic/students/learn/

Self Paced training beginner to advanced, SSP Required http://sine.ni.com/myni/self-paced-training/app/main.xhtml

LabVIEW Wiki on Training http://labviewwiki.org/LabVIEW_tutorial#External_Links

0 Kudos
Message 10 of 10
(3,718 Views)