[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how to compute the surface defined by a given contour?
From: |
Ben Abbott |
Subject: |
Re: how to compute the surface defined by a given contour? |
Date: |
Sat, 11 Dec 2010 11:58:46 -0500 |
On Dec 11, 2010, at 4:18 AM, Christophe Trophime wrote:
>
> On Dec 11, 2010, at 2:17 AM, Ben Abbott wrote:
>
>> On Dec 10, 2010, at 9:29 AM, trophime wrote:
>>
>>> Hi,
>>> I am a newbie to octave.
>>> I have X Y Z data. I have manage to plot contour of Z as a function of
>>> X,Y using something like :
>>>
>>> x = linspace(0, 0.1197, 101);
>>> y = linspace(0.113258, 0.377527, 101);
>>> Z = load("data");
>>>
>>> [X,Y] = meshgrid(x, y);
>>> surf(X,Y,Z)
>>> contour (X, Y, Z)
>>>
>>> Then I have selected a given contour :
>>>
>>> VN = [0.5, 0.5];
>>> contour (Z, VN);
>>> [C, LEV] = contourc (X, Y, Z, VN);
>>>
>>> Now I would like to get the surface (in the (X,Y) plane) defined by this
>>> contour?
>>> Is it possible to compute the gravity point of the contour?
>>>
>>> Thanks for your helps
>>
>> If I understand what you'd like to do, an approximation to the center of
>> gravity can be calculated as ...
>>
>> center = sum (((X+1i*Y).*Z)(:)) / sum (Z(:))
>> x_center = real (center)
>> y_center = imag (center)
>
> Yes but I want the center of gravity of the surface defined by a given
> contour?
> I other words I want to extract X and Y from C provided by "contourc" for a
> given value to define a surface,
> compute its area and its center of gravity.
>
> Thanks
> C.
You'd like to treat the distributed mass as proportional to the surface's area?
Do I understand correctly?
Ben