 292 pág.

# Statics with MATLAB Dan B. Marghitu Mihai Dupac Nels H. Madsen

DisciplinaMatlab499 materiais2.122 seguidores
Pré-visualização47 páginas
lines were added with the command
grid on. The command hold on locks up the plot and the axis properties and
the next graphical commands add to the existing plot. The vectors are introduces
with quiver(x,y,u,v) that represents the vectors as arrows with components
u,v at the points x,y:
for i = 1:3
quiver(0,0,vx(i),vy(i),...
\u2019Color\u2019,\u2019k\u2019,\u2019LineWidth\u2019,1.5)
end
quiver(0,0,v_(1),v_(2),...
\u2019Color\u2019,\u2019r\u2019,\u2019LineWidth\u2019,2)
The labels for the vectors are introduced with:
text(vx(1),vy(1),\u2019v_1\u2019,...
\u2019fontsize\u2019,12,\u2019fontweight\u2019,\u2019b\u2019)
text(vx(2),vy(2),\u2019 v_2\u2019,...
\u2019fontsize\u2019,12,\u2019fontweight\u2019,\u2019b\u2019)
text(vx(3),vy(3),\u2019v_3\u2019,...
\u2019fontsize\u2019,12,\u2019fontweight\u2019,\u2019b\u2019)
text(v_(1),v_(2),\u2019v\u2019,...
20 1 Operation with Vectors
\u22122 \u22121.5 \u22121 \u22120.5 0 0.5 1 1.5 2
\u22122
\u22121.5
\u22121
\u22120.5
0
0.5
1
1.5
2
x
y
v1
v2
v3
v
x
y
Fig. 1.9 Example 1.1: MATLAB graphical representation
\u2019fontsize\u2019,12,\u2019fontweight\u2019,\u2019b\u2019)
The cartesian axes are plotted with:
quiver(0,0,a,0,...
\u2019Color\u2019,\u2019b\u2019,\u2019LineWidth\u2019,1.0)
text(a,0,\u2019x\u2019,...
\u2019fontsize\u2019,12,\u2019fontweight\u2019,\u2019b\u2019)
quiver(0,0,0,a,...
\u2019Color\u2019,\u2019b\u2019,\u2019LineWidth\u2019,1.0)
text(0,a,\u2019y\u2019,...
\u2019fontsize\u2019,12,\u2019fontweight\u2019,\u2019b\u2019)
The MATLAB graphical representations for this example are shown in Fig. 1.9.
Example 1.2
For the Fig. 1.10 find the F = 500 kN force in vector format and then determine
its direction cosines. The point M is in the xy-plane with OM = 50 m. The angle
between OM and the x-axis is \u3b1 = 45\u25e6. The coordinates of the point A are xA = 20 m,
yA = 10 m, and zA = 30 m.
1.12 Examples 21
Fig. 1.10 Example 1.2
j
k
y
z
\u131
x
O
M
A
\u3b1
F
Solution
The input numerical data are introduced in MATLAB with:
F = 500; % kN
OM = 50; % m
xA = 20; % m
yA = 10; % m
zA = 30; % m
alpha = 45; % deg
The position vector of the point A is
rOA = rA = xA \u131 + yA j + zA k,
and in MATLAB:
rA_ = [xA, yA, zA];
The components of the position vector of the point M are
xM = OM cos \u3b1, yM = OM sin \u3b1, zM = 0,
and in MATLAB:
xM = OM*cosd(alpha);
yM = OM*sind(alpha);
zM = 0;
rM_ = [xM, yM, zM];
The position vector rAM can be expressed as
rAM = rM \u2212 rA
= (xM \u131 + yM j + zMk) \u2212 (xA \u131 + yA j + zAk)
= (xM \u2212 xA) \u131 + (yM \u2212 yA) j + (zM \u2212 zA) k,
and in MATLAB:
22 1 Operation with Vectors
rAM_ = rM_-rA_;
The magnitude of the vector rAM is
rAM =
\u221a
(xM \u2212 xA)2 + (yM \u2212 yA)2 + (zM \u2212 zA)2.
The magnitude is computed in MATLAB as:
rAM = norm(rAM_);
The unit vector uF of the force F is calculated with
uF = uAM = rAM
rAM
= (xM \u2212 xA) \u131 + (yM \u2212 yA) j + (zM \u2212 zA) k\u221a
(xM \u2212 xA)2 + (yM \u2212 yA)2 + (zM \u2212 zA)2
= xM \u2212 xA\u221a
(xM \u2212 xA)2 + (yM \u2212 yA)2 + (zM \u2212 zA)2
\u131
+ yM \u2212 yA\u221a
(xM \u2212 xA)2 + (yM \u2212 yA)2 + (zM \u2212 zA)2
j
+ zM \u2212 zA\u221a
(xM \u2212 xA)2 + (yM \u2212 yA)2 + (zM \u2212 zA)2
k.
In MATLAB the unit vector is calculated as:
uAM_ = rAM_/rAM;
One can express the force F, as a magnitude F multiplied by the unit vector uF as
F = F uF = F xM \u2212 xA
rAM
\u131 + F yM \u2212 yA
rAM
j + F zM \u2212 zA
rAM
k.
The force F was calculated and printed in MATLAB using the statement:
F_=F*uAM_;
The direction cosines are calculated in MATLAB with:
thetax = acos(F_(1)/F); % alpha
thetay = acos(F_(2)/F); % beta
thetaz = acos(F_(3)/F); % gamma
The numerical results are obtained in MATLAB as:
rA_=[20.000 10.000 30.000] (m)
rM_=[35.355 35.355 0.000] (m)
1.12 Examples 23
rAM_=[15.355 25.355 -30.000] (m)
uAM_=[ 0.364 0.601 -0.711] (m)
F_=[182.046 300.601 -355.666] (kN)
Next the force F will be plotted using MATLAB. The x-axis, y-axis, and z-axis are
labeled using the commands:
xlabel(\u2019x(m)\u2019), ylabel(\u2019y(m)\u2019), zlabel(\u2019z(m)\u2019)
The origin of the reference frame is identified with the statement:
text(0,0,0,\u2019 O\u2019,\u2019HorizontalAlignment\u2019,\u2019right\u2019)
The statement axis(([xMIN xMAX yMIN yMAX zMIN zMAX]) sets scaling
for the x, y, and z axes on the current plot:
sf=30;
axis([-sf sf -sf sf -sf sf])
The vectors are introduces with quiver3(x,y,z,u,v,w) that represents the
vectors as arrows with components u,v,w at the points x,y,z. The vectors rA_
and rM_ are plotted with:
quiver3(0,0,0, xA,yA,zA,1,...
\u2019Color\u2019,\u2019b\u2019,\u2019LineWidth\u2019,1.5)
quiver3(0,0,0, xM,yM,zM,1,...
\u2019Color\u2019,\u2019k\u2019,\u2019LineWidth\u2019,1.5)
The labels for the points A and M are introduced with:
text(xA,yA,zA,\u2019 A\u2019,...
\u2019fontsize\u2019,12,\u2019fontweight\u2019,\u2019b\u2019)
text(xM,yM,zM,\u2019 M\u2019,...
\u2019fontsize\u2019,12,\u2019fontweight\u2019,\u2019b\u2019)
The vector F_ is plotted at M with:
ff=0.1; % force scale factor
quiver3(xM,yM,zM,...
ff*F_(1),ff*F_(2),ff*F_(3),1,...
\u2019Color\u2019,\u2019r\u2019,\u2019LineWidth\u2019,2)
The force scale factor ff is introduced because the magnitude of the force vector
is greater then the magnitude of the position vectors. The line between A and M are
plotted with:
line([xA xM],[yA yM],[zA zM],\u2019LineStyle\u2019,\u2019--\u2019)
24 1 Operation with Vectors
The cartesian axes with the corresponding labels are represented with:
quiver3(0,0,0,sf,0,0,1,\u2019Color\u2019,\u2019k\u2019,\u2019LineWidth\u2019,1)
quiver3(0,0,0,0,sf,0,1,\u2019Color\u2019,\u2019k\u2019,\u2019LineWidth\u2019,1)
quiver3(0,0,0,0,0,sf,1,\u2019Color\u2019,\u2019k\u2019,\u2019LineWidth\u2019,1)
text(sf,0,0,\u2019 x\u2019,\u2019fontsize\u2019,12,\u2019fontweight\u2019,\u2019b\u2019)
text(0,sf,0,\u2019 y\u2019,\u2019fontsize\u2019,12,\u2019fontweight\u2019,\u2019b\u2019)
text(0,0,sf,\u2019 z\u2019,\u2019fontsize\u2019,12,\u2019fontweight\u2019,\u2019b\u2019)
The graphical representation for the vectors is given by: The MATLAB plots are
shown in Fig. 1.11.
Example 1.3
The vector \u2212\u2192OA = rA has the magnitude a and makes the angle \u3b8x, \u3b8y, and \u3b8z with
the cartesian axes as shown in the Fig. 1.12. The vector \u2212\u2192OB = rB has the magnitude
b and its projection on the xy-plane is the vector \u2212\u2192OC. The angle between the vectors\u2212\u2192OB and \u2212\u2192OC is \u3bb and the angle between \u2212\u2192OC and the x-axis is \u3bd. Find: (a) the resultant\u2212\u2192
R = \u2212\u2192OA + \u2212\u2192OB, its magnitude, and the direction angles of \u2212\u2192R ; (b) the cross product
rA × rB and the angle between rA and rB; (c) the projection of the vector rA on the
vector rB; (d) the scalar triple product rC · (rB × rA).
\u221220
0
20
40
60
\u221210 0 10 20 30 40 50 60 70
\u221240
\u221230
\u221220
\u221210
0
10
20
30
x(m)
F
y(m)
y
M
A
O
z
x
z(m
)
Fig. 1.11 Example 1.2: MATLAB graphical representation
1.12 Examples 25
0
50
100
150
200
250
300
0 50
100 150
0
50
100
150
200
250
\u3bb
\u3bd
\u131
j
k
\u3b8x
\u3b8y
\u3b8z
O
x
y
z
A
B
C
rArB
Fig. 1.12 Example 1.3
For the numerical application use: a =150 m, b =200 m, \u3b8x = 30\u25e6, \u3b8y = 60\u25e6,
\u3b8z = 60\u25e6, \u3bb = 45\u25e6, and \u3bd = 15\u25e6.
Solution
The unit vectors of the cartesian reference frame are [\u131, j, k]. The vector rA is
rA = rAx \u131 + rAy j + rAz k = rA
(
cos \u3b8x \u131 + cos \u3b8y j + cos \u3b8z k
)
= a (cos \u3b8x \u131 + cos \u3b8y j + cos \u3b8z k
)
.
The vector rB is
rB = rBx \u131 + rBy j + rBz k.
The z-component of the vector rB is
rBz = rB sin \u3bb = b sin \u3bb.
The x and y components of the vector rB are
rBx = rB cos \u3bb cos \u3bd = b cos \u3bb cos \u3bd,
rBy = \u2212rB cos \u3bb sin \u3bd = \u2212b cos \u3bb sin \u3bd.
26 1 Operation with Vectors
First the MATLAB command sym constructs the symbolic variables:
a = sym(\u2019a\u2019,\u2019real\u2019);
b = sym(\u2019b\u2019,\u2019real\u2019);
thetax = sym(\u2019thetax\u2019,\u2019real\u2019);
thetay = sym(\u2019thetay\u2019,\u2019real\u2019);
thetaz = sym(\u2019thetaz\u2019,\u2019real\u2019);
lambda = sym(\u2019lambda\u2019,\u2019real\u2019);
nu = sym(\u2019nu\u2019,\u2019real\u2019);
The command sym(\u2019a\u2019,\u2019real\u2019) also assume that a is a real number. The short-
cut for constructing symbolic objects is
syms a b thetax thetay thetaz lambda nu
The position vectors rA_ and rB_ are can be written as:
rAx=a*cos(thetax); % x-component
rAy=a*cos(thetay); % y-component
rAz=a*cos(thetaz); % z-component
rA_=[rAx, rAy, rAz]; % rA_ vector
rBz=b*sin(lambda);
rBx=b*cos(lambda)*cos(nu);
rBy=-b*cos(lambda)*sin(nu);
rB_=[rBx, rBy, rBz]; % rB_ vector
The projection of the vector rB_ on the xy-plane is the vector:
rC_=[rBx, rBy, 0]; % rC_ vector
(a) The resultant vector R is
R
Arthur fez um comentário
Muito bom! achei que nunca ia achar um pdf desse livro, fazia tempo que estava procurando! muito obrigado!!!
0 aprovações
Carregar mais