LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

mean value

Solved!
Go to solution

Hello everybody!

I have got a small problem. I need the mean value of a signal. For example the mean value of a signal in 10 seconds or in 5 seconds. So I set the sample length f.e. 10 put my stuff in an if loop, set a waiting time of 1000ms. But at the end I get all the 10 values and I only need the last one (in this case the tenth). Is it the wrong way to solve that problem? Is there another oppurtunity?

 

I woluld say thank you for every help moving me forward,

 

Thomas

0 Kudos
Message 1 of 8
(9,989 Views)

Hi Thomas,

 

Do you want the last value or the mean value?

To get the last value, simply right-click the terminal of the for loop and disable auto-indexing.

If you want the mean value you could use a shift register to sum up the values in the loop and divide by the number of samples after the loop. Or you can use the array of values that you get now (with auto-indexing enabled) and use the mean function.

 

Hope this helps,

Daniel

 

0 Kudos
Message 2 of 8
(9,987 Views)

Thank you for your answer, but I think I asked my question wrongly.

So I need the mean value of a signal. For example the mean value of every five seconds of this signal. If I use the mean function it will give so many values out at the output, how many I gave in at the input. But I only need the mean value of the 5 seconds and it gives me a mean value in every seconds (if I have a waiting time of 1000ms in my while loop). So I meant from these mean values the last one.

 

Thank you for helping me, 

Thomas

0 Kudos
Message 3 of 8
(9,975 Views)

Sorry, I still don't understand what you want. You sample your data at 1s. Do you want the mean value over 5 samples (=5 seconds)? Or just the last of the 5 samples?

Can you post what you have so far?

 

0 Kudos
Message 4 of 8
(9,969 Views)

So this is my vi. It looks really easy. The input signal is an elapsed time signal to make it easily followable. If you run it, you will have mean values. At the input of the mean function 0, 1, 2, 3, 4, 5 aso. will come

at the same time at the output:

0,5 - (mean value of: 0,1);

1 - (mean v of 0,1,2);

2 - (mean v of 1,2,3);

3 - (mean v of 2,3,4);

4  - (mean v of 3,4,5) aso. because the sample length is 3.

But I need only the mean value of (0,1,2) and (3,4,5). Can I get only these values somehow?

0 Kudos
Message 5 of 8
(9,952 Views)
Solution
Accepted by topic author raditomi

Hi raditomi,

the attached picture shows one solution.

 

There is one other case "default", it's empty.

 

Mike

Message 6 of 8
(9,945 Views)

mean PtbyPt.vi

 

see help and don't forget to init ONCE you set the sample lenght

 

 

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 7 of 8
(9,944 Views)

Hello Mike,

 

your picture was a great help for me. I solved the problem with the help of it.

I think I could not discribe what exactly my problem was.

Thanks a lot for helping me,

Thomas

0 Kudos
Message 8 of 8
(9,901 Views)