LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

ensemble averaging

Hello,

I have a data file that I want to perform an "ensemble" averaging and would like to get suggestions on how to proceed. Here is what I need to be able to do: I have 2 channels of data and I want to use one channel as my trigger channel in order to "trigger" averaging on the second data channel. That is each time a trigger condition is met on the trigger channel I want to perform an average of the data channel over a time window of 100 mSec (i want to be able to play around with different time window size). I also want to do this for the entire data file.

Thanks in advance for your help

Lancer
0 Kudos
Message 1 of 3
(3,212 Views)
There is a peak detector function which will provide you with the index value of each peak in your trigger value. Use this array of indices and a for-next loop to pull out a subset of your other channel starting at some point relative to each index (i.e. index-10 or index-20). Maintain a running sum of the subsets and this should be your ensemble average.
Randall Pursley
0 Kudos
Message 2 of 3
(3,199 Views)
Hello.

Perhaps the attached VI can give you some idea of how to achieve what you need. The VI is a modified version of the Continuous Acquisition with internal clock example that ships with LabVIEW.

You have to enter the channels from which you want to acquire. For example, if you want to acquire from channels 0 and 1, you must enter "Dev1/ai0,Dev1/ai1".

The sampling rate is set to 1000 samples per second, and the number of samples to read is set to 100 samples, which means that the loop will iterate every 100ms, and each time it executes, you will get 100 samples from each channel.

The first channel is analised to get the maximum value of those 100 samples, and compared against a trigger level. If the channel contained a measurement higher than the trigger level, then the average of 100 samples from the second channel is obtained, and the front panel indicator updated.

You must be aware that the 100 samples averaged correspond to the same time period as the 100 samples that contained the high voltage that triggered the averaging. If you require the average to be of the subsequent 100 samples, or of the previous 100 samples, then the VI must be slightly modified.

Hope this helps. Good luck.

Alejandro
0 Kudos
Message 3 of 3
(3,184 Views)