LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Averaging array contents

Hi,

I'm doing a project wherein I'm recording waveforms via the soundcard's line level input. I need to record, say, 1000 waveforms, store them in an array and average them out as they are being stored. I can't seem to figure out how to do this. Even if the averaging were to be done off-line (averaging after all the recordings are completed) how should I go about it? Is there something obvious that I'm missing?

Thanks in advance
Keshav
0 Kudos
Message 1 of 26
(4,530 Views)
to give you an idea...
0 Kudos
Message 2 of 26
(4,519 Views)
You can autoindex the 2D array consisting of all your 1000 waveforms & average them one-by-one using the Mean function in the Probability & Statistics Palette.
- Partha ( CLD until Oct 2027 🙂 )
0 Kudos
Message 3 of 26
(4,517 Views)
Hi Pnt,

Sorry to sound silly but what is the Block on the extreme left, outside the while loop? I can't seem to find it in the functions palette. 😞

Thanks
0 Kudos
Message 4 of 26
(4,463 Views)
Hi keshav,

 it's an array constant!
In the array functions palette you find the array constant. In the next step you put a numeric constant into the array constant (drag&drop!) and set the representation...
Or you right-click the left shift register and select create->constantSmiley Wink
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 26
(4,458 Views)
Thanks so much, GerdW 🙂 Another question though, if you don't mind - I don't seem to have the "1D numeric integration" function available to me, so is there another way I can get around this?

Thanks
0 Kudos
Message 6 of 26
(4,452 Views)
Hi keshav,

this function is not included in base package (snippet from LabView help):
*****
Numeric Integration (Not in Base Package)
Performs numeric integration on the Input Array using one of four popular numeric integration methods.
The data type you wire to the Input Array input determines the polymorphic instance to use.
*****

This vi adapts to the datatype, the real name is underlined above... It's found in Mathematics -> Integ&Diff - but only when you don't use the base package. It's using a call library node, so there is no code for copy&paste available Smiley Wink But you may look for some numeric integration algorithms (trapezoidal, simpsons, bode are used in this function) and make your own vi based on them - a great way to learn coding in LabView Smiley Very Happy
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 26
(4,440 Views)
Thanks a lot GerdW. What I don't understand though, is why numeric integration is required at all? Pardon me for sounding silly, my theoretical basics aren't the best in this field. 😞 Also, suppose I take the Continuous Sound Input template and use that to acquire the data from the mic in, how should I combine the two block diagrams? I'm assuming the output from the Clear vi is wired directly to the array?

Thanks for your patience! 🙂
Keshav
0 Kudos
Message 8 of 26
(4,424 Views)
Hi keshav,

is this still related to "array averaging"?

Can you attach a vi demonstrating what you're doing now? Sound input, integrating, averaging, "clear.vi"???
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 26
(4,422 Views)
Hi GerdW, I'll try to be as clear as I can.. here's what I'm trying to achieve.

What I want to do is obtain, say, 1000 waveforms from my computer's soundcard. Each of the waveforms are in the frequency range of 100-1500 Hz, so the sampling rate would be 3 KHz.. and so each recording should have 30,000 samples. Now I want to store these 1000 waveforms in an array, and average them out to get a single, noise-free waveform. That's all. 🙂

Ideally I'd be averaging the waveforms as they're being recorded (on-line), but that would take up a lot of cpu resources and my laptop doesn't have the specs to handle it. I'm not quite sure what to do.

Thanks
0 Kudos
Message 10 of 26
(4,392 Views)