09-28-2012 03:59 AM
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).
09-28-2012 07:22 AM - edited 09-28-2012 07:23 AM
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.
09-28-2012 11:11 AM
If I do this wont it just give out the unaveraged data like before?
09-28-2012 11:26 AM
@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.
09-29-2012 05:13 AM
@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.
09-29-2012 11:48 AM
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.
This is the full spectrum
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
09-30-2012 02:39 PM
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?
09-30-2012 03:05 PM
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
10-01-2012 02:20 AM
Brilliant, sounds good.
I'll let you know how I get on with it.
AT12.
10-01-2012 03:15 AM
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.