LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Averaging Waveforms

Hello,

 

I am seeking for suggestion/help with averaging waveforms that I m collecting using an oscilloscope by Picotech. I am a new user of LabVIEW so for most of you my question might seem very fundamental. But I am learning as I am using LabVIEW and any suggestion is going to be extremely helpful.

 

Task:

Attached is the LabVIEW file that I am using to collect waveforms. I need to average them in a very specific order. Imagine collecting 1000 waveforms and averaging the 1st, 11th, 21st.. and so on. Then, averaging the 2nd, 12th, 22nd.. and so on. This routine is repeated until all the waveforms have been averaged and I am left with 10 separate averaged waveforms.

 

I do have a basic understanding of LabVIEW and the logic flow but I don't know where to begin to perform this task. It would be great if I can get some suggestions/tips to proceed with this problem. Also, please let me know if you need more information from my end.

 

Kind regards,

0 Kudos
Message 1 of 6
(1,032 Views)

I wasn't able to make much sense of your attached VI (lots of things were "missing", and it was a bit too "busy" to understand "the forest for the trees".

 

However, what you describe, start with 1000 Waveforms and average WF 1, 11, 21, ..., 991, then 2, 12, ..., 992 until you have 10 averages of 100 Waveforms is basically simple.  What I don't know (and can't tell from your code) is the answer to the following questions:

  • Do you understand what a Waveform is?
  • If you had three Waveforms (of the same size), do you know how to write a little VI to average them?
  • Do you understand the difference between a Waveform and an Array of Dbls?

The key to simplifying the problem of averaging every 10th array is to think about 1D and 2D arrays.  You start with 1000 Waveforms which contain 1000 Arrays.  Consider it as 1000 (Arrays of 1000 numbers).  I'm going to rewrite this as "1000 Arrays of Things".  I want to average Thing 1, Thing 11, Thing   21 ..., then Thing 2, Thing 12, ... and so on.

 

Suppose I took that 1000 Array of Things.  Take the first 10 Things, then the second 10 Things, ... then the 99th 10 Things -- reshape the 1000 Array of Things into a 2D 10 x 100 Array of Things.  What happens when you try to process this 2D Array of Things?  The first time through an indexing For Loop, you get "the first 10 Things", then the second 10, etc.  But this averages 1, 2, 3, and you want to do 1, 11, 21, i.e. you want to average "down the Columns" instead of "across the rows".  Do you know about transposing an Array, which interchanges Rows and Columns?  If you process the Transposed Array, you'll average 1, 11, 21, just what you want.  You'll get 100 Averages, problems solved.

 

Try it.

 

Bob Schor

 

0 Kudos
Message 2 of 6
(958 Views)

Hello Bob,

 

Thank you for your reply and your suggestion. I totally understand the logic that you are suggesting and it does make the problem much clearer.

 

With regards to your questions:

1. Yes, I do know what a waveform is. However, I do get confused about how they are stored in arrays. Mostly, because I visualize an array as a matrix to store individual data points. Since a waveform is built of several data points (50M data points in my case), I find it hard to visualize their storage in an array. But, I think I need to start looking at waveforms based on how you suggest i.e., Thing 1, Thing 2.. and so on.

 

2. I do not know how to average waveforms of same size. However, I am reading about it as we speak.

 

3. I do not know what an Array of Dbls is. Therefore, I do not know the difference between a waveform and an Array of Dbls.

 

The VI attached in my post is an example provided by the company, Picotech, which I modified a bit to add an additional channel.

 

Could you please suggest me some resources or tips to learn about the things I need for solve this problem?

 

Kind regards,

Ketan

0 Kudos
Message 3 of 6
(947 Views)

Do you know about Clusters?  LabVIEW allows you to group items together and give them names.  A Waveform is a special Cluster that LabVIEW provides to provide a way to store "sampled data" acquired at some specific "dt" (delta-time, the time, in seconds, between the samples),  "T0", a TimeStamp (date and time) that the first sample was acquired, and "Y", a fixed-sized 1D Array, usually of Dbl, containing the data.

There is a Palette on the Block Diagram called "Waveforms" that contain the Waveform functions.  When you acquire data with DAQmx, you can choose to save the Data as an Array of Dbl, or as a Waveform.  There are also functions that give you access to the Data Array within the Waveform (or you can extract it yourself once you learn how to use Clusters and the Bundle/UnBundle functions).

 

Bob Schor

0 Kudos
Message 4 of 6
(931 Views)

Hi Bob,

 

Thank you for all the information. They are very helpful. 

 

I have a question. Will the Waveform function work with a third party oscilloscope (my case) in the same way it works with a NI DAQ? 

 

Regards,

Ketan

0 Kudos
Message 5 of 6
(899 Views)

The Waveform is a Data Structure that NI "invented" to add (fairly economically, in space, time, and complexity) "extra" information and structure well-suited to sampled data.  If you gather sampled data from a third-party Digital Oscilloscope, you can use Waveform functions to "bundle" the "Y" data arrays you get from the third-party 'scope with the "dt" that corresponds to the Sampling Interval the 'scope is using, and set T0 to the TimeStamp that LabVIEW can give you when you start Sampling.  Of course, if you use LabVIEW and DAQmx, the DAQmx Read gives you the option of having the Data be returned as either a Waveform or a 1D Array of Dbl, so you are essentially reverse-engineering the process to make your Digital Oscilloscope behave as though it were a DAQmx Input Device.

 

Bob Schor

Message 6 of 6
(876 Views)