06-19-2013 07:47 PM
I am a reseacher working on recodring neural signal using a DAQ system. I am essentaily stiumulating one area of the brain and recording an evoked potential from another area. I want to average sweeps of the signal as they are aquired. Does anybody have a good example (Labview code) of how to do signal avergaing or sweep techniques for neurophysiology applications.
I found this example belown but am not sure how this program works, when I implemnet a DAQ assistant instead of the simulated sine wave im getting a large error and I think it is based of my sampling rate and the intial array size set in this example program
http://zone.ni.com/devzone/cda/epd/p/id/32
Solved! Go to Solution.
06-20-2013 03:03 PM
Do you have a DAQ device that supports hardware triggering? If so, you can configure your DAQ Assistant VI to acquire a finite number of samples at a predetermined sample rate each time a trigger is received. Use the Trigger tab on the channel configuration dialog to pick a trigger type and source. Ideally, your stimulus source can generate a trigger output to time the start of the acquisition - this can be used as a digital trigger to the DAQ device.
Once you have the acquisition triggering properly and you can acquire and display "sweeps" properly, all you have to do is setup a For Loop to acquire a number of sweeps and sum them together as they are acquired. Once your pre-defined number of sweeps is acquired, divide the summed array by the number of sweeps and you'll have your averaged array.
Here is a similar VI without the hardware acquisition (uses simulated noisy sine waves). Choose the "synchronous" averaging in this example to get the effect you are looking for. This example continously averages by summing each sweep and dividng by the number of sweeps, but you could easily change it to acquire a preset number of sweeps before averaging.
06-20-2013 03:10 PM
So I got the first part of your answering with my DAQ device but how exaclty would you send "sweeps into a given For loop. Then in the four low how would you sum them together. I can set sweep count to be user defined but im assuming I would be putting my sweep data into and array.
06-21-2013 02:50 PM
You will run the data acquisition VI inside the For Loop so that each time the For Loop executes, it acquires a block of data (as configured by the settings of the VI). The output of this VI is an array of values corresponding to the values for each sample point. One way to sum them is to create a shift register at the right side of the For Loop. This shift register will keep the data for the next iteration of the For Loop so that you can sum the next interation of the data with it. In this way, the shift register becomes an accumulator. You can see more about how to do this here: http://www.ni.com/academic/students/learn-labview/execution-structures/ - you can also find out more about working with arrays here: http://www.ni.com/academic/students/learn-labview/data-types/