How do I plot the cross sectional area and centroid of an I-Beam using pgon ?
Show older comments
How do I plot the cross sectional area and centroid of an I-Beam using pgon ? My code, below did not work.

% assuming the x-y plane origin is (0,0)
x = [ 0 0 1 1 2 2 3 3 4 4 5 5]; % x coords
y = [ 9 10 0 1 1 9 1 9 0 1 9 10]; % y coords ];
pgon = polyshape(x,y);
A = area(pgon)
[Cx Cy] = centroid(pgon);
h = plot(pgon)
hold on
plot(Cx,Cy,'r*', 'markerSize', 10)
grid minor
h(1).FaceColor = [0 0 1];
disp('centroid at (x,y) coords:'), disp([Cx Cy])
Accepted Answer
More Answers (0)
Categories
Find more on Beamforming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!