## calculating mean

finn
Posts: 36
Joined: 2010-10-13
Location: Germany

I would like to get the mean value of a set of 250 waves in horizontal direction. The „mean“ function does not help me because it is only working in the vertical direction.
a quite time consuming solution would be to make it like this:

meanvalue = (wave0+wave1+...+wave249)/250

and I am sure it is much easier...

thanks,
Finn

Posts: 836
Joined: 2007-06-29
Location: United States

Use the Average Waves package which you can load by selecting Analysis->Packages->Average Waves. The control panel that results has a Help button to bring up documentation, and there is an example experiment. To load the example, select File->Example Experiments->Analysis->Ave, Box Plot, Percentile.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com

finn
Posts: 36
Joined: 2010-10-13
Location: Germany

thanks

vinodmagic
Posts: 6
Joined: 2012-04-20
Location: India

an you please suggest me a way to calculate average of (say 50) waves and automatically enter in a new wave.
I tried Analysis>Wave Average and name template as *. it created one wave in which some average values are there but i am not able to figure out, which row correspond to average value of which wave?

proland
Posts: 121
Joined: 2011-03-14
Location: United States

You could try using WaveList to get the wavenames, then use a for loop and WaveStats to get the average for each wave, placing the value into a wave called Averages (or something like that). I have a similar function for finding the peak location (V_maxloc) in a series of photoluminesence scans and it only takes about 10-20 lines of code.

vinodmagic
Posts: 6
Joined: 2012-04-20
Location: India

can you please send me your function, so that i can get a help in writing mine too.

Posts: 911
Joined: 2007-06-21
Location: United States

The reason why the Average Waves package did not work for you is that it averages rows of a set of waves. You want to get the average of each wave (a column), not average across rows of different waves.

I have created a snippet showing how to do this. Read the comments for an explanation.

In order to use this you need to understand some Igor concepts. If you have not already done it, I recommend that you do the first half of the Guided Tour of Igor. Choose Help->Getting Started.

If you have not already done it, you should read Chapter IV-3, User-Defined Functions, in the Igor manual.

The snippet uses wave reference waves and free waves. Here are the help topics:

```DisplayHelpTopic "Wave Reference Waves"
DisplayHelpTopic "Free Waves"```

If you don't have a solid understanding of wave references. Here is the help topic:

`DisplayHelpTopic "Wave References"`

The GetWaveAverages will do what you want but you must figure out how to create a wave containing the list of wave references for the waves you want to average. The GetWaveAveragesFromTable function shows one way to do this.