# LabVIEW

cancel
Showing results for
Did you mean:

## How does one find the average waveform out of N waveforms?

Hello fellow engineers,

I would like some help from all of you. I need to find the average waveform of N waveforms.
For example, if I have 5 sample waveforms of the disturbance behaviour of a certain variable, I would lke to find an average disturbance behaviour waveform. I await useful ideas and insights from all of you,
Thanking you,
With warm regards,
Aparna.

Message 1 of 10
(10,463 Views)

## Re: How does one find the average waveform out of N waveforms?

Hi Aparna,

if all your waveforms have the same dt, you can run through a for loop with indexing the array of waveforms. See the attached example. I hope this helps.

Mike

Message 2 of 10
(10,447 Views)

## Re: How does one find the average waveform out of N waveforms?

Mike,

I think you had problems with your averaging functions, you were averaging each waveform with the the running average.  So waveform 0 had the least weight,  the last waveform had the weight of 1/2.

The attached should work better.

Message Edited by Ravens Fan on 04-02-2008 10:59 PM
Message 3 of 10
(10,427 Views)

## Re: How does one find the average waveform out of N waveforms?

Hi Ravens,

i understand my code in this way:

• initialize the shift register with the first waveform
• sum up the shift register (the first waveform) with the first waveform and devide it by 2, so that the result is the first waveform,
• and now sum up each other waveform with the last saved (the actual average).

i think this should work.

Mike

Message 4 of 10
(10,415 Views)

## Re: How does one find the average waveform out of N waveforms?

Hi Ravens,

yes you are right. Excuse me please.

Mike

Message 5 of 10
(10,405 Views)

## Re: How does one find the average waveform out of N waveforms?

Mike,

the math for each point in your average goes like this.  Lets call x the first point in the sweep.  x1 is the first point from the first waveform.  x2 is the first point from the second waveform.  First time through (x1+x1)/2 = x1.  Good.  Second time through (x1 + x2)/2 = average you want for 2 points.  Good.  third time through ((x1+x2)/2 + x3)/2 = does not equal an evenly weighted average.  x3 is weighted more heavily than x1 and x2.  You algorithm does an average of sorts but weights some waveforms more than others.  The other commenter had it right where you add all the waveforms together and divide by the N of the for loop.

Message 6 of 10
(8,302 Views)

## Re: How does one find the average waveform out of N waveforms?

Sorry I thought Ravens was admitting Mike was right on this chain.  Ravens is right.

Message 7 of 10
(8,300 Views)

## Re: How does one find the average waveform out of N waveforms?

Hi,

I had a question. If I have let's say 10 waveforms, can't I store it in an array and then find the mean of it. I dont really understand the use of registers.

Message 8 of 10
(7,522 Views)

## Re: How does one find the average waveform out of N waveforms?

@robotica

If I understand right, you're suggesting dumping ALL the waveform data together into a single array, then taking the mean.

This would essentially produce the average value of any given individual point in all the waveforms. In other words, you stick in a ton of waveforms and get out a single scalar value - say, 5.3 or whatever.

What the original question asked was how to get the average point at each timestamp, or the "average WAVEFORM" not the "average VALUE."

Let me know if that clears things up or if you were suggesting a different solution.

Message 9 of 10
(7,516 Views)

## Re: How does one find the average waveform out of N waveforms?

No... I wanted to find the average waveform.. sorry for the misunderstanding......

i was asking if it is possible to make an array of the waveforms and then find the average of those waveforms.

Since the method suggested earlier was a bit lengthy and I couldn't figure out how it was being solved using the method suggested earlier...

Message 10 of 10
(7,509 Views)