필터 지우기
필터 지우기

y coordinates of center of buoyancy

조회 수: 3 (최근 30일)
Lila
Lila 2021년 3월 29일
답변: Are Mjaavatten 2021년 3월 29일
Hello,
I have plotted a ship that is partially immersed in water.
With the following code, I calculated the area of the ship :
ship=polyshape(x,y)
figure(1)
hold on
plot(ship)
axis equal
plot(0,0,'*')
[xc,yc]=centroid(ship)
plot(centroid(ship),'x','Color','k')
rectangle=polyshape([-12 -12 12 12],[-6 6 6 -6])
plot(rectangle)
area(intersect(rectangle,coque_bateau))
Now, I need to find the y coordinate of the centroid of the immersed volume
I only know the total value of the immersed volume is Vim = 34,14 m^3
How can I find the centroid ? I am guessing I need to use again the intersect method, but I don't see how
I hope my question is clear enough, thank you in advance

답변 (1개)

Are Mjaavatten
Are Mjaavatten 2021년 3월 29일
Is this what you want?
x = [-8,-8,-6,0,6,8,8,-8];
y = [10,5,1,0,1,5,10,10];
ship=polyshape(x,y);
figure(1)
clf
hold on
plot(ship)
axis equal
[xc,yc]=centroid(ship);
plot(xc,yc,'xk')
rectangle=polyshape([-12 -12 12 12],[-6 6 6 -6]);
plot(rectangle)
submerged = intersect(rectangle,ship);
[xs,ys] = centroid(submerged);
A = area(submerged);
plot(xs,ys,'ok')
fprintf('Area = %.2f\n',A);
fprintf('Centroid y = %.2f\n',ys)

카테고리

Help CenterFile Exchange에서 Elementary Polygons에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by