Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

A.Suchi

Member

04-02-2008 12:06 PM

Options

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report to a Moderator

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.

MikeS81

Proven Zealot

04-02-2008 01:35 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report to a Moderator

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

RavensFan

Knight of NI

04-02-2008 09:58 PM - edited 04-02-2008 09:59 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report to a Moderator

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

Download All

Virus scan in progress. Please wait to download attachments.

MikeS81

Proven Zealot

04-02-2008 11:43 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report to a Moderator

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

MikeS81

Proven Zealot

04-03-2008 01:07 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report to a Moderator

Hi Ravens,

yes you are right. Excuse me please.

Mike

jreid2704

Member

08-24-2011 08:08 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report to a Moderator

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.

jreid2704

Member

08-24-2011 08:09 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report to a Moderator

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

robotica

Member

06-28-2012 06:42 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report to a Moderator

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.

Mike_Le

Member

06-28-2012 09:13 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report to a Moderator

@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.

robotica

Member

06-28-2012 11:18 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report to a Moderator

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...