From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

average waveform data

Solved!
Go to solution

Hello, 

 

I am fairly new to labview and programing. 

 

My goal is to acquire retinal potentials, The signal I obtain is accompanied with noise and is in micro volt range, my goal is to average out the noise so that I can analyze the actual (signal without noise) signal. 

 

The incoming analog signal is continious, but I need  an alternating 25 second time window  to be averaged, which means: average signals from 0-25 sec. do not average from 26-50 seconds, average from 50-75 seconds and so on...

 

To beign with I started out obtaining a signal from a function generator and averaging the complete signal and displaying the averaged signal on a second waveform graph. Though the VI doesnt show any errors I wanted to know if I'm in the right path??

 

If yes, then How do I go about averaging the data at 25 second multiples (for 25 seconds from the start point)???

 

I have also attached a flow diagram of what I'm expecting to see

0 Kudos
Message 1 of 12
(8,405 Views)

In the attached file, the averaged data is logged (with the help of write to measurement VI)

 

Also attached is a flow diagram of what I expect to get. 

 

Thank you

0 Kudos
Message 2 of 12
(8,400 Views)

File for previous comment

Message 3 of 12
(8,398 Views)

I don't see what the point of not averaging is.  Care to explain why?

 

If you want to read 25 seconds worth, you really should read your data more often, just multiple times.  I doubt yoru buffer can hold 25k samples.  Maybe read something like 1000 samples (which would be 1 second worth of data based on your 1kS/s) 25 times, concatinating the waveforms each time (use a FOR loop).  You can then do the average easily enough.

 

Look in the DAQmx->Advanced DAQmx Task Options palette.  There is a nice gem in there called DAQmx Configure Logging.  You use this before starting your task.  What it does is allow you to stream your data straight to a TDMS file.  You don't have to do anything but set it up and start your task.  Set the logging mode to "Log and Read".


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 4 of 12
(8,396 Views)

Purpose of the Average: 

 

I am obtaining retinal potentials that is accompanied with noise and other artifacts, averaging will help me get the waveform I expect to see. 

 

I do not quite understand the second part of the reply??

 

The first 25 seonds of the signal is the legit data, the next 25 seconds is pretty much useless, the 25 seconds after that is legit data again. I want to average the window of data that is legit, 

 

I did implement the DAQ configure logging, I am guessing this will allow me to log the raw data. What do I do inorder to log just the averaged 25 deconds of data (along with a time stamp)??

 

Thanks. 

S

0 Kudos
Message 5 of 12
(8,387 Views)

I changed  the VI, Now the raw data and the averaged data are represented on the same waveform graph in different colors. 

 

Will it work this way as well. 

 

Also as I am including DAQ configure logging, Will I need the write to measurement? As of now the averaged data is being written in a .TDMS file which I can open in excel. 

 

Thank you

 

 

0 Kudos
Message 6 of 12
(8,382 Views)
Solution
Accepted by topic author spatan2

I was thinking something along these lines.

 

You have a limited buffer on your DAQ.  If you don't read it fast enough, you will lose data.  So read smaller amounts more often.  So I suggested reading 1 second worth of data 25 times.

 

Since you need to log the averaged time as well, we might need to rethink the configure logging and just use the TDMS API instead.  Do a search in the example finder (Help->Find Examples) for TDMS Wruite Time Domain.vi.  It is a decent example of what you want to do.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 7 of 12
(8,352 Views)

Dear Crossrulz, 

 

Thank you for the reply

 

reading 1 second worth of data 25 times would give me just that data*25. But I did try and read smaller amounts of data. 

I can go about explaining my issue again: (What I am looking for is shown in the attached image) as well. 

 

I have a square pulse of 1Hz frequency, which means each cycle will take 1000ms to complete - 500ms On and 500ms OFF. this square pulse is triggering an bunch of LEDs to go on and off in a pattern. The eye responds to this pattern and the response signal is what I am measuring. 

It has a different response to the LED being on and the LED being off, 1 single ON and OFF of the LED leads to 1 complete response of 200ms long. 

Suppose I run function generator for 50 transitions I will get 25 Responses. (each of 200ms in length). I would like to:

 

1. Average the signal got at every 500ms, in order to get the 25 averaged responses.

2. Average the 25 responses in order to get 1 single response. which can be analyzed.

 

I have attached the VI with comments. 

Desperately in need of help!!

 

Thanks

Download All
0 Kudos
Message 8 of 12
(8,319 Views)

Sorry I apologize, that was the wrong VI.

 

Attached is the one. 

0 Kudos
Message 9 of 12
(8,315 Views)

Also, is there any way I can make the DAQmx read function, read n samples?? (Can I place just that in a for loop??) 

 

The average I am looking for is the average of consecutive windows (each consisting of 500 points), continously till I stop the programm from running. How do I go about that??

 

Thank You

0 Kudos
Message 10 of 12
(8,309 Views)