Function File: [axes l moments] = principalaxes (shape)
Calculates the principal axes of a shape.
Returns a matrix axes where each row corresponds to one of the principal axes of the shape. l is the second moment of area around the correspoding principal axis. axes is order from lower to higher l.
shape can be defined by a polygon or by a piece-wise smooth shape.
See also: inertiamoment masscenter
The following code
t = linspace(0,2*pi,64).'; shape = [cos(t)-0.3*cos(3*t) sin(t)](1:end-1,:); shapeR = shape*rotv([0 0 1],pi/4)(1:2,1:2); [PAr l] = principalaxes(shapeR); [PA l] = principalaxes(shape); figure (1) clf plot(shape(:,1),shape(:,2),'-k'); line([0 PA(1,1)],[0 PA(1,2)],'color','r'); line([0 PA(2,1)],[0 PA(2,2)],'color','b'); hold on plot(shapeR(:,1)+3,shapeR(:,2),'-k'); line([3 PAr(1,1)+3],[0 PAr(1,2)],'color','r'); line([3 PAr(2,1)+3],[0 PAr(2,2)],'color','b'); axis equal axis square
Produces the following figure
Figure 1 |
---|