Problem 61118. Center-of-Mass Index of a Vector
Given a numeric vector x, treat each element x(i) as a mass located at index i.
Compute the center-of-mass index
idx = sum(i * abs(x(i))) / sum(abs(x(i)))
If all elements are zero, return NaN.
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers1
Suggested Problems
-
Center-of-Mass Index of a Vector
1 Solvers
More from this Author4
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!