Wave weighting averaging

Hi

I'm curious about the Average Waves Panel. Is there a way of doing a weighted averaging ?
I just took a quick at the procedure file for the Average Waves panel and it looks like it would have to be modified to add weighting. As an alternative, could you apply the desired weighting to your input waves? How did you want to weight the waves?
Suppose that wList is a string list that contains the waves to average, nPoints is the number of points in each wave, and aValues is a wave of equal length to wList that contains the weighting values (also in the same sequence as wList). Unless I misunderstand, this loop should do what you want. The return weighted average is in theAverage wave.

variable ic, npts
string theOne
npts = numpnts(aValues)
make/O/N=(nPoints) theAverage
theAverage = 0
for (ic=0;ic<npts;ic+=1)
    theOne = StringFromList(ic,wList)
    wave tAdd = $theOne
    theAverage += aValues[ic]*tAdd
endfor


--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
Thanks for your input, but what if the different waves to average are plotted against their own non linear xwave?

I was just curious to see if weighted averaging was available in the Average Waves tools
millot1 wrote:
Thanks for your input, but what if the different waves to average are plotted against their own non linear xwave? ...


Is that xwave the same for each ywave? If so, the answer I gave will still work.

Otherwise, to average ywaves with different xwaves, you will need to convert each ywave to a ywaveNEW that uses the same xwaveNEW scaling throughout. The conversion is done via interpolation. After that, averaging will work.

--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAH