How to calculate the middle weighted average ?
alcarar
Dear all,
I'm trying to calculate the center (or middle weighted average) of a curve (see joint file)
Actually, is really difficult for me essentially because I have negative energy values
Do you know what kind of function or procedure I can use?
Thank you
Best regards,
It is not really clear to me what you are trying to do. Are you looking for the 'center of mass' of the whole curve? Our what do you mean by center? In any case, the energy values should not be of concern. I think you could also just use the wave points directly and then convert back to scaled energy values in a second step.
July 27, 2021 at 09:22 am - Permalink
What is your analysis goal here? What sort of weighting do you envision? Are you trying to find the area under individual peaks in your data? I have attached a modified version of your file containing a fit using our Multipeak Fit package. I used Igor 9 beta to do the fit, and that means I used an updated version of the Multipeak Fit, meaning that you might not be able to open it using Igor 8.
July 27, 2021 at 09:22 am - Permalink
Forgot the file!
July 27, 2021 at 09:22 am - Permalink
OK, here's the same thing done with Igor 8.
July 27, 2021 at 09:24 am - Permalink
In reply to It is not really clear to me… by chozo
Thank you
effectively is the “center of mass” of the whole curve
Do you know an Igor function to calculate this?
Best regards
July 27, 2021 at 11:08 am - Permalink
I guess the following works, if I understand the center of mass correctly (i.e., x_center = integral(x*f(x)) / integral(f(x)) ):
OP_weight *=x
print area(OP_weight)/area(OP)
This gives -2.75592.
July 27, 2021 at 11:48 am - Permalink
Thank you!
July 27, 2021 at 12:14 pm - Permalink