LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

multichannel running average

Solved!
Go to solution

Dea all,

I am looking for a multi channel running average function (or VI) that i can adjust to an arbitrary but fixed number of channels.

I attached an example of a 5 channel running average which technically does the job. however, scaling it to bigger numbers of channels (lets say, 50) is surely not good practice. do you have any suggestions?

Thank you!

 

and by the way, what change does this VI need so I could adjust the sample length while running the VI?

multi channel running average.png

0 Kudos
Message 1 of 8
(4,540 Views)

 

hi

 

how about doing like this?

 

running average.png



Thank you & Best regards
syrpimp

=======================================================
“You must continue to gain expertise, but avoid thinking like an expert." -Denis Waitley
0 Kudos
Message 2 of 8
(4,519 Views)
Solution
Accepted by OPCer

Hi syrpimp,

 

putting the PtByPt-Mean in a loop doesn't make it aware of multiple channel data! Infact your example will mix up the values of different channels heavily!

 

@OPCer:

You can look into the PtByPt-Mean function and study it's internal behaviour. After you have done so you can create a similar VI which takes a 1D array (holding the new values for your channels) as input…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 8
(4,511 Views)

@syrpimp: yes, that was the first thing i tried, but as GerdW writes, it mixes the channels, so it does not work at all!

 

0 Kudos
Message 4 of 8
(4,501 Views)

Hey,

please have a look at this Forum post as I think it is exactly what you need:

http://forums.ni.com/t5/LabVIEW/averaging-rows-in-an-array/td-p/507204

 

You simply need to use the AxB function which multiplies an array with a vector which is much more efficient and scalable.

I modified the VI that you can find in the other forum post. Now it calculates mean values for each channel:

Mean_of_channels.JPG

Regards

Christian

 

Christian
CLA, CTA, CLED
0 Kudos
Message 5 of 8
(4,468 Views)

Hey Christian-P,

thanks for the suggestion. i see the point in matrix multiplication. Just like GerdW's answer it will takr me some time to fit it to my real-time apllication.

 

@GerdW:

i think you Idea is the closest what i am trying to do. now, when looking into the Mean PtByPt.vi i find everything except the cases is unclickable. this is qite annoying for investigating this VI - do you know how i could get a copy from it that i can modify? or do i have to rebuild it manually?

0 Kudos
Message 6 of 8
(4,421 Views)

@GerdW

forget my upper post 🙂 i resolved that part.

 

Id like to stress the detail about the real time sample length of the initial post: how can i adjus the sample length when the VI is running? up to now, i have to restart the VI for the new sample length to take effect.

0 Kudos
Message 7 of 8
(4,413 Views)
Solution
Accepted by OPCer

I made my own multi channel running average, based on what i found in the PtByPt mean VI as suggested by GerdW, but with the matrix multiplication. It has not all the functionality as the original PtByPt, but it works like a charmfor an arbitrary number of parallel channels and sample length. I attached also the runAxB.vi that feeds a random input and provides a graph of original and averaged data.

AxB.PNGstill, could i change the sample length while running the VI?

Download All
0 Kudos
Message 8 of 8
(4,371 Views)