[R] Centre of gravity of a mountain

Peter Langfelder peter.langfelder at gmail.com
Wed Nov 10 00:49:08 CET 2010


On Tue, Nov 9, 2010 at 3:40 PM, Barry Rowlingson
<b.rowlingson at lancaster.ac.uk> wrote:
> On Mon, Nov 8, 2010 at 5:15 PM, Peter Langfelder
> <peter.langfelder at gmail.com> wrote:
>
>> If you also need the z coordinate, it simply the mean of the matrix Z.
>>
>> zCenter = mean(Z)
>
>  How can that be right? Suppose your mountain is very flat, so that
> your mountain is effectively a cube. The Z values are all the same,
> and so their mean is the same. However the centre of mass is, by
> symmetry, clearly at height/2.
>
>  Similarly suppose your mountain matrix is one large cell value and
> all the rest are near zero - the mean Z will be close to zero but the
> centre of mass will be almost half way up the single cell value,
> because all the near-zeros contribute nothing to the centre of mass
> position.

Yup, the z coordinate is wrong. Only the x and y are right.

Peter



More information about the R-help mailing list