Result discrepancies with "polygonCentroid"

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view

Result discrepancies with "polygonCentroid"

Hi Guys

I have attached my code below.

So I have a situation whereby I am calculating the centroid of the reaction
forces from a beam that's on an elastic foundation.

The first part of the code uses the "polygonCentroid" function which yields
a solution of 0.49787 (only considering the x component)

When implementing the mechanics equations to calculate the centroid, I
attain a solution of 0.49362.
I have attached the equation also.

Both these solutions differ slightly, although I would like some insight as
to why? I assume that there may be some limitations on the "polygonCentroid"
function causing this issue.

>> R(1) = translation(1)*ss1
R = -21345.31066
>> R(2) = translation(2)*ss1
R =

  -21345.31066  -20807.18804

>> points = [0 0;0 R(1);l1 R(2);l1 0;0 0]
points =

       0.00000       0.00000
       0.00000  -21345.31066
       1.00000  -20807.18804
       1.00000       0.00000
       0.00000       0.00000

>> polygonCentroid(points)
ans =

       0.49787  -10538.69715

>>     x = [0 l1];
>>     coefficients = polyfit([x(1) x(2)],[R(1) R(2)],1);
>>     R_l1_static = trapz(x,R)
R_l1_static = -21076.24935
>>     R = [coefficients(1)*x(1)^2+coefficients(2)*x(1)
>> coefficients(1)*x(2)^2+coefficients(2)*x(2)];
>>     top = trapz(x,R);

Sent from:

Reply | Threaded
Open this post in threaded view

Re: Result discrepancies with "polygonCentroid"

Juan Pablo Carbajal-2
You code is not reproducible, so it really doesn't help much.
However it seems that your mechanics calculation is the actual
integral over the shape of the beam.
This is not what polygonCentroid do. For this function there is only
vertices (mass points at the nodes if you want).
So if you beam if deformed and the polygon representing it is not very
fine (lots of vertices) it is expected that the two calculations will

Most functions on polygons treat them as naturally discrete objects
with all the info given by the vertices. Any calculation that uses
path information will give different results whenever the path is not
a straight segment connecting the vertices, or when functions along
the path depend on the path coordinates.