"rocky99 Therminator" <ronenk@mail.com> wrote in message <gmq041$2g2$1@fred.mathworks.com>...
> I'd like to find the center of gravity of a discrete graph. I have the vector (1x200) of the values of the xaxis and the vector (1x200) of the values of the yaxis. (Y is a spectrum and X is a frequency). I need the frequency (xvalue) of the center of gravity of this graph.
> Any help would be highly appreciated. Thanks
What do you mean here by the "center of gravity"? If each point is considered to have a weight of one, then the graph's center of gravity would have an xvalue of mean(x), which is totally independent of the yvalues. Perhaps you mean to have the "center of gravity" of the xvalues weighted by the corresponding yvalues. Then it would be mean(x.*y)/mean(y). It all depends on what meaning you have in mind for a "center of gravity."
Roger Stafford
