LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Assistance Needed: Averaging N Amount of Waveforms

Solved!
Go to solution

Oh and this is what my data file used to look like, as you can see - each I(t) is saved (first 2 columns) and then you get the PSD after 25 I(t) (last 2 columns).

0 Kudos
Message 21 of 40
(669 Views)

Your raw measurement needs to be added to the Merge Signals before going into the queue.  The Merge Signals can be expanded to allow as many signals to be merged as you want/need.


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 22 of 40
(661 Views)

If I do this wont it just give out the unaveraged data like before?

0 Kudos
Message 23 of 40
(656 Views)

@AT12 wrote:

If I do this wont it just give out the unaveraged data like before?


Isn't that what you wanted?  That's your I(t), isn't it?

 

Ok, that data plot is after a divider.  This signal is what you want to add to the Merge Signals.


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 24 of 40
(652 Views)

@crossrulz wrote:

@AT12 wrote:

If I do this wont it just give out the unaveraged data like before?


Isn't that what you wanted?  That's your I(t), isn't it?

 

Ok, that data plot is after a divider.  This signal is what you want to add to the Merge Signals.


Hi Crossrulz,

 

No. I was recording the unaveraged I(t) data before, what I wanted to do was to average these signals and produce the averaged signal and record that. I took it that this is what you were doing with the case structure you developed?

 

The PSD spectrum is produced after averaging these I(t) signals (Spectral Measurements does all this for me) - I want to average these I(t) signals myself and record them. This will stop me recording lots of individual I(t) signals thus making my data file huge (which is very inconvenient to analyse in OriginLab and takes a lot of memory)!

 

So to clarify the I(t) signal is what comes out of the DAQ Assistant and the PSD is calculated form an average of these signals. I want to record the average I(t) signal to the data file.

 

For some reason I'm not getting any data out of your case structure?

 

Thanks for your patience on this. If there is anything you want me to do just let me know (in an idiot proof way!) and I will supply it to you.

 

Thanks again,

 

AT12.

0 Kudos
Message 25 of 40
(644 Views)

Using your data it appears that there is very little information in the mostly random signal.  Averaging the 28 data sets in that file does produce one interesting result in the low frequency portion of the data.

 

In the non-averaged data sets there are large peaks at 25 and 50 Hz while in the averaged set those peaks are relatively low and peaks at 20 and 30 Hz are higher.  In all cases the amplitude of the averaged peaks are lower than in the non-averaged data sets. ( I checked a few data sets, not all).

 

This makes me think that your sampling may not have been synchronized with the signals, certainly not the 25 and 50 Hz signals.

 

The images show the fourth data set (index 12056 to 16055) and the average.

 

Spectrum of averages.png  This is the full spectrum

 

Low frequency part.png  This is the low frequency part of the spectrum.

 

Not that all the spectral graphs start at 1 because I did not remove the DC component.

 

Lynn

 

Message 26 of 40
(638 Views)

The data I'm getting out is what I want - there is no issue with that.

 

My question is how do I average these waveforms?

0 Kudos
Message 27 of 40
(627 Views)

Here is the way I did it. The code is rather crudely done because I adapted it from a quick test VI I had written for another file analysis check.

 

1. I read the file as a tab-delimited spreadsheet format text file.

2. In the upper loop (which contains much of the legacy code) the Start and Stop controls select the indexes within the file for the numeric segment to extract.  For the data file you posted Start = 23 and Stop = 4022 gets the first segment. Channel 1 (second column) is the data I used.

3. In the lower loop the string array is searched for "X_Value" followed by an empty string in the first column.  For each segment the numeric values are in the second column between the row indexes found in the searches.  The searching is not very robust and may fail on other files.

4. The first segment is placed in the shift register. Subsequent segments are added to the value in the shift register and the sum is placed in the shift register. After the loop completes the sum is divided by the number of segments to get the average. This method can be a problem if the sum can overflow, but that is not an issue with your dataset.

5. The program is implemented as a special purpose state machine with the two working states being searchX where it searches for "X_Value" and searchEnd where it searches for the empty string.

6. This program does not do it, but I would probably chose to subtract the mean before doing the FFT to eliminate most of the DC component.

 

Lynn

Message 28 of 40
(623 Views)

Brilliant, sounds good.

 

I'll let you know how I get on with it.

 

AT12.

0 Kudos
Message 29 of 40
(614 Views)

Unfortunately, I don't think this will be much use Lynn:

 

1) I want it to average as I'm sampling.

2) Often the number of samples that I obtain changes.

0 Kudos
Message 30 of 40
(613 Views)