|
"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 x-axis and the vector (1x200) of the values of the y-axis. (Y is a spectrum and X is a frequency). I need the frequency (x-value) 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 x-value of mean(x), which is totally independent of the y-values. Perhaps you mean to have the "center of gravity" of the x-values weighted by the corresponding y-values. 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
|