help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Result discrepancies with "polygonCentroid"


From: Mishal0488
Subject: Result discrepancies with "polygonCentroid"
Date: Fri, 8 May 2020 03:52:56 -0500 (CDT)

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: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html



reply via email to

[Prev in Thread] Current Thread [Next in Thread]