Professional Documents
Culture Documents
DYNAMICS OF MACHINERY
HOMEWORK 1
Contents
The Problem No.1..............................................................................2
The Solution.......................................................................................5
1.Position solution..................................................................6
2.Kinematic coefficient..........................................................7
3.Velocity................................................................................ 8
4.Acceleration.........................................................................8
5.Motion of points..................................................................9
Conclusion and suggestion................................................................ 15
References..........................................................................................16
Appendix A1 The result with theta2 = 2*pi/3................................... 16
Appendix A2 The result with theta2 = 2*pi/3 + 5*pi/180.................19
Appendix A3 The result with theta2 = 2*pi/3 + 2*5*pi/180.............23
Appendix A4 The result with theta2 = 2*pi/3 + 3*5*pi/180.............26
Appendix A5 The result with theta2 = 2*pi/3 + 4*5*pi/180.............30
Appendix C1 Program for the first case, theta2 = 2*pi/3..................34
2
Kinematic Analysis of the Stephenson III Six-bar Linkage with a Spring and a Damper
Please develop programs on a PC and using the package for the kinematic analysis of the Stephenson III
six-bar linkage with a spring and a damper, whose skeleton is shown in Fig. 1 and the dimensions are
given in Table 1. Regarding the dimensions of the spring, the stiffness K 20 N mm , the initial
length L0 91.52 mm, and X s 50 mm, Ys 40 mm. The damping coefficient, dc, of the
damper is 220 N.s/mm, and X d 50 mm, Yd 0 mm. Please use the analytical method for the
displacement analysis. Link 2 is driven with constant speeds of 10, 30, 60, 90, and 120 rad/sec,
respectively. The results, with 5o interval, of displacement, velocity and acceleration of each moving
link and its mass center are required; furthermore the spring length and the rate of change of the
damper length are also needed. Please check the results, by choosing 2 (not particular) positions, with
graphical methods. Please investigate the relations between the input velocity and the maximum
magnitudes of the velocity and acceleration, respectively, of the mass center of link 5. (Hints: The
derivation and programs should be able to analyze the cases with non-zero input acceleration, and
kinematic coefficients should be gotten before the velocity and acceleration analysis.)
項目 配分 得分
結果與討論 40%
結論與建議 10%
報告寫作 40%
報告美觀 10%
總得分 100%
3
I ( X d , Yd )
rd
H
J ( X s , Ys ) m5
F 6
r5 5
l6
5
l5 6 m6
rs C 4
r5
5
l4 r6
E
m3 4
m4
r3 l3 3 r3 G
3 r4
3
B D r7
m2 r2 1
2 2
A 1 r1
l2 X
r1 r7
Introduction
The main objective of this report is to provide the students with the opportunity to learn and improve
their programming skills using the Matlab environment to solve the problem in Kinematic analysis, of
course including do the Kinematic Analysis. With this basic Matlab in Kinematic analysis problem
solving, the report provides opportunities to explore the application of Matlab in Mechanical
Engineering. The problem we want to solve is kinematic analysis of the Stephenson III sex-bar linkage
with a Spring and a Damper. Talk specifically to the problem, given the state of motion (position,
velocity and acceleration) of one link (in this case is link 2, the “input” link), determine the state of
motion (position, velocity, and acceleration) of all other links and particular points of interest (mass
centers). Before using Matlab to solve the problem, we need to choose a method first to do the kinematic
analysis; the used method is the vector loop that is briefed in the content. The report is a practice for
everyone to learn about Kinematic Analysis, programming, and the application of Matlab in Mechanical
Engineering. This is the first time I do, so I hope that it is useful.
5
The Solution
I would like to develop a program on PC by using Matlab software for the kinematic analysis of the
Stephenson III six-bar linkage with a Spring and a Damper as shown in Fig. 1. The data is provided in
Table 1.
To understand clearly and deeply the solving, the vector loop approach is briefed first. Briefly, the vector
loop approach consists of the following steps.
1. Attach to the links of the mechanism vectors forming a closed loop (or loops).
2. The vectors should be chosen and defined such that the variables (vector lengths or angles) are
variables of interest in the mechanism.
3. Write the vector loop equation. This is simply the statement that the sum of the vectors in the loop
is zero.
4. Choose an X, Y coordinate system. Break the vector loop position equation into two scalar
component equations. Solve these for the position unknowns.
5. Differentiate the position equation with respect to time. Solve these for the velocity unknowns.
6. Differentiate again with respect to time. Solve for the acceleration unknowns.
We use the vector loop approach to solve this problem. All of vectors are chosen and defined as shown in
Fig. 1. Take a look the Fig. 1, there have two vector loops and we have two vector loop position
equations are:
The input link is link 2, and we have position and state of motion: θ2 , θ˙2 , θ¨2 . The given constants is in the
table 1 below,
Ii
ri ri mi li i i i
i (kg- m
2
(mm) (mm) (kg) (mm) (deg) (deg) (deg)
)
1 87.01 15.01 --- --- --- --- 0.00 ---
2 30.43 --- 37.49 25.12 0.00 0.0307 --- ---
3 78.61 51.62 62.78 38.81 12.32 1.0941 --- 30.75
4 55.92 --- 50.89 40.33 -8.78 0.6700 --- ---
5 88.45 44.91 21.19 37.71 10.25 0.4420 --- 30.82
6 98.91 --- 32.90 52.62 5.42 1.1271 --- ---
7 130.03 45.01 --- --- --- --- 0.00 ---
6
And the others are in the problem paragraph. We choose the coordinates X, Y, and A is origin
coordinates, AX is parallel to r1. For writing easier in Matlab we use var 'i=var ii.
1. Position solution
XE = r2*cos(theta2)+r33*cos(theta3+theta33)
YE = r2*sin(theta2)+r33*sin(theta3+theta33)
XH = r2*cos(theta2)+r33*cos(theta3+theta33)+ r55*cos(theta5+theta55)
YH = r2*cos(theta2)+r33*cos(theta3+theta33)+ r55*cos(theta5+theta55)
And rs = sqrt((XE-Xs).^2+(YE-Ys).^2)
rd = sqrt((Xd-XH).^2+(Yd-YH).^2)
thetas = atan((YE-Ys)/(XE-Xs))
thetad = atan((YH-Yd)/(XH-Xd))
After calculate, the result is below,
rs = 126.4040 thetas = 1.0497 rd = 80.1821 thetad = 0.3288.
2. Kinematic coefficient
-r2*cos(theta2)-r3*cos(theta3)*h3*h3-r3*sin(theta3)*h33-r4*cos(theta4)*h4*h4 -r4*sin(theta4)*h44 = 0
-r2*sin(theta2)-r3*sin(theta3)*h3*h3+r3*cos(theta3)*h33 -r4*sin(theta4)*h4*h4 + r4*cos(theta4)*h44 =
0
After calculate, the result is below,
h33 = 0.1137 h44 = 0.0253.
For h55 and h66:
Write the scalar component equations for calculating h5 and h6 again:
-r2*sin(theta2)-r33*sin(theta3+theta33)*h3-r5*sin(theta5)*h5-r6*sin(theta6)*h6 = 0.
r2*cos(theta2)+ r33*cos(theta3+theta33)*h3+r5*cos(theta5)*h5+r6*cos(theta6)*h6 = 0
After differentiating with respect to the input variable theta2, we have
-r2*cos(theta2)-r33*cos(theta3+theta33)*h3*h3-r33*sin(theta3+theta33)*h33-r5*cos(theta5)*h5*h5 -
r5*sin(theta5)*h55-r6*cos(theta6)*h6*h6-r6*sin(theta6)*h66 = 0
-r2*sin(theta2)-r33*sin(theta3+theta33)*h3*h3+r33*cos(theta3+theta33)*h33-r5*sin(theta5)*h5*h5 +
r5*cos(theta5)*h55-r6*sin(theta6)*h6*h6 +r6*cos(theta6)*h66
After calculate, the result is below,
h55 = 0.1780 h66 = 0.0673
3. Velocity
4. Acceleration
The acceleration of link 2, aa2 is equal to 0 due to this link is driven with constant angular speed.
After calculating kinematic coefficients, h33, h44, h55, h66, we have
aak = hkk * (omega2)2, ( k = 3, 4, 5, 6)
Hence, the result is shown below,
aa2 aa3 aa4 aa5 aa6
0 0.0114 0.0025 0.0178 0.0067
0 0.1024 0.0228 0.1602 0.0606
1.0e+003 * 0 0.4094 0.0912 0.6408 0.2423
0 0.9212 0.2051 1.4417 0.5452
9
5. Motion of points
Link 3, we have,
Xg3 = r2*cos(theta2)+l3*cos(theta3+phi3);
Xg33 = -r2*sin(theta2)*omega2 - l3*sin(theta3+phi3)*h3*omega2;
Xg333 = -r2*cos(theta2)*omega2.*omega2 - l3*cos(theta3+phi3)*h3 ...
*h3*omega2.*omega2 - l3*sin(theta3+phi3)*h33*omega2;
Yg3 = r2*sin(theta2)+l3*sin(theta3+phi3);
Yg33 = r2*cos(theta2)*omega2 + l3*cos(theta3+phi3)*h3*omega2;
Yg333 = - r2*sin(theta2)*omega2.*omega2 - l3*sin(theta3+phi3)*h3*h3 ...
*omega2.*omega2 + l3*cos(theta3+phi3)*h33*omega2;
magvg3 = sqrt(Xg33.^2 + Yg33.^2);
magag3 = sqrt(Xg333.^2 + Yg333.^2);
After calculate, we have
Xg3 Yg3 Xg33 Yg33 magvg3 Xg333 Yg333 magag3
Link 5, we have,
Xg5 = r2*cos(theta2) + r33*cos(theta3+theta33) + l5*cos(theta5+phi5);
Xg55 = -r2*sin(theta2)*omega2 - r33*sin(theta3+theta33)*h3*omega2-
l5*sin(theta5+phi5)*h5*omega2;
Xg555 = - r2*sin(theta2)*omega2.*omega2 - r33*cos(theta3+theta33)*h3*h3*omega2.*omega2 -
r33*sin(theta3+theta33)*h33*omega2- l5*cos(theta5+phi5)*h5*h5*omega2.*omega2 -
l5*sin(theta5+phi5)*h55*omega2;
Yg5 = r2*sin(theta2) + r33*sin(theta3+theta33) + l5*sin(theta5+phi5);
Yg55 = r2*cos(theta2)*omega2 + r33*cos(theta3+theta33)*h3*omega2+
l5*cos(theta5+phi5)*h5*omega2;
Yg555 = - r2*sin(theta2)*omega2.*omega2 - r33*sin(theta3+theta33)*h3*h3*omega2.*omega2 +
l3*cos(theta3+theta33)*h33*omega2- l5*sin(theta5+phi5)*h5*h5*omega2.*omega2+
l5*cos(theta5+phi5)*h55*omega2;
magvg5 = sqrt(Xg55.^2 + Yg55.^2);
magag5 = sqrt(Xg555.^2 + Yg555.^2);
11
Link 6, we have,
Xg6 = r2*cos(theta2) + r33*cos(theta3+theta33) + r5*cos(theta5) +l6*cos(theta6+phi6);
Xg66 = -r2*sin(theta2)*omega2 - r33*sin(theta3+theta33)*h3*omega2 - r5*sin(theta5)*h5*omega2 -
l6*sin(theta6+phi6)*h6*omega2 ;
Xg666 = - r2*sin(theta2)*omega2.*omega2 - r33*cos(theta3+theta33)*h3*h3*omega2.*omega2 -
r33*sin(theta3+theta33)*h33*omega2- r5*cos(theta5)*h5*h5*omega2.*omega2-
r5*sin(theta5)*h55*omega2 - l6*cos(theta6+phi6)*h6*h6 *omega2.*omega2 -
l6*sin(theta6+phi6)*h66*omega2;
Yg6 = r2*sin(theta2) + r33*sin(theta3+theta33) + r5*sin(theta5)+l6*sin(theta6+phi6);
Yg66 = r2*cos(theta2)*omega2 + r33*cos(theta3+theta33)*h3*omega2 + r5*cos(theta5)*h5*omega2 +
+l6*cos(theta6+phi6);
Yg666 = -r2*sin(theta2)*omega2.*omega2 - r33*sin(theta3+theta33)*h3*h3*omega2.*omega2 +
l3*cos(theta3+theta33)*h33*omega2 -r5*sin(theta5)*h5*h5*omega2.*omega2
+r5*cos(theta5)*h55*omega2 -r6*sin(theta6+phi6)*h6*h6*omega2.*omega2+r6*cos(theta6+phi6)
*h66*omega2;
magvg6 = sqrt(Xg66.^2 + Yg66.^2);
magag6 = sqrt(Xg666.^2 + Yg666.^2);
After calculate, we have
Xg6 Yg6 Xg66 Yg66 magvg6 Xg666 Yg666 magag6
As you know, in the introduction, I said that this is the first time I do. I have never used the Matlab
software before and I understand a little about mechanical, so it is not ease for me to give a conclusion
and suggestion. Tell you the truth, I had to try very hard with my best. I hope to receipt many responses
and contribution.
16
References
1. Allen S. Hall, Jr., 1986, Notes on mechanism analysis, Waveland Press, Prospect Heights,
Illinois, USA.
2. Norton, Robert L., 1999, Design of machinery: an introduction to the synthesis and analysis
of mechanisms and machines, 2nd ed, McGraw-Hill, Boston, New York, USA.
3. Otto, S. R. (Stephen Robert)/Denier, J. P./Springer, 2005, An introduction to programming
and numerical methods in MATLAB, Springer, London.
4. Rao V. Dukkipati, 2009, MATLAB for mechanical engineers, Tunbridge Wells, Kent TN1
1YS, UK
5. Roger F. Gans, 1991, Analytical kinematics :analysis and synthesis of planar mechanisms,
Butterworth-Heinemann, USA
Appendix A1 The result with theta2 = 2*pi/3
k theta3(k) theta4(k) f1 f2
-----------------------------------------------------------------------------------------------------------------------------
k theta5(k) theta6(k) f1 f2
----------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------
h3 = 0.0626 h4 = -0.6193
----------------------------------------------------------------------------------------------------------------------------
h5 = -0.0432 h6 = 0.3143
----------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------
1.0e+003 *
----------------------------------------------------------------------------------------------------------------------------
1.0e+005 *
----------------------------------------------------------------------------------------------------------------------------
1.0e+005 *
----------------------------------------------------------------------------------------------------------------------------
1.0e+005 *
----------------------------------------------------------------------------------------------------------------------------
1.0e+005 *
----------------------------------------------------------------------------------------------------------------------------
1.0e+005 *
k theta3(k) theta4(k) f1 f2
----------------------------------------------------------------------------------------------------------------------------
k theta5(k) theta6(k) f1 f2
----------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------
h3 = 0.0343 h4 = -0.5868
----------------------------------------------------------------------------------------------------------------------------
h5 = -0.0070 h6 = 0.3137
----------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------
1.0e+003 *
----------------------------------------------------------------------------------------------------------------------------
1.0e+005 *
----------------------------------------------------------------------------------------------------------------------------
1.0e+005 *
----------------------------------------------------------------------------------------------------------------------------
1.0e+005 *
----------------------------------------------------------------------------------------------------------------------------
1.0e+005 *
----------------------------------------------------------------------------------------------------------------------------
1.0e+005 *
k theta3(k) theta4(k) f1 f2
23
----------------------------------------------------------------------------------------------------------------------------
k theta5(k) theta6(k) f1 f2
----------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------
h3 = 0.0001 h4 = -0.5443
----------------------------------------------------------------------------------------------------------------------------
h5 = 0.0324 h6 = 0.3103
----------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------
1.0e+003 *
----------------------------------------------------------------------------------------------------------------------------
1.0e+005 *
----------------------------------------------------------------------------------------------------------------------------
1.0e+005 *
----------------------------------------------------------------------------------------------------------------------------
1.0e+005 *
----------------------------------------------------------------------------------------------------------------------------
1.0e+005 *
----------------------------------------------------------------------------------------------------------------------------
1.0e+005 *
k theta3(k) theta4(k) f1 f2
----------------------------------------------------------------------------------------------------------------------------
k theta5(k) theta6(k) f1 f2
----------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------
h3 = -0.0427 h4 = -0.4877
----------------------------------------------------------------------------------------------------------------------------
h5 = 0.0765 h6 = 0.3040
----------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------
1.0e+003 *
----------------------------------------------------------------------------------------------------------------------------
1.0e+005 *
----------------------------------------------------------------------------------------------------------------------------
1.0e+005 *
----------------------------------------------------------------------------------------------------------------------------
1.0e+005 *
----------------------------------------------------------------------------------------------------------------------------
1.0e+005 *
----------------------------------------------------------------------------------------------------------------------------
1.0e+005 *
k theta3(k) theta4(k) f1 f2
----------------------------------------------------------------------------------------------------------------------------
k theta5(k) theta6(k) f1 f2
----------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------
h3 = -0.0989 h4 = -0.4105
----------------------------------------------------------------------------------------------------------------------------
h5 = 0.1280 h6 = 0.2942
----------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------
1.0e+003 *
----------------------------------------------------------------------------------------------------------------------------
1.0e+005 *
----------------------------------------------------------------------------------------------------------------------------
1.0e+005 *
----------------------------------------------------------------------------------------------------------------------------
1.0e+005 *
----------------------------------------------------------------------------------------------------------------------------
1.0e+005 *
----------------------------------------------------------------------------------------------------------------------------
33
1.0e+005 *
theta3 = v(1);
theta4 = v(2);
fv1 = eval(f1);
fv2 = eval(f2);
fxo = [fv1;fv2];
f1pv = eval(gradf1);
f2pv = eval(gradf2);
fpxo =[f1pv;f2pv];
if det(fpxo)==0
disp('Err: determinant of Jacobian is zero, try another initial point ')
else
iter = 0;
s1 = sprintf('%3.0f %- 10.4f %- 10.4f',iter,v(1),v(2));
s2 = sprintf(' %- 10.4f %- 10.4f',fv1,fv2);
disp([s1 s2])
while (norm(fxo)>tol) & (det(fpxo)~=0) & (iter<nitermax)
iter = iter + 1;
vn = v - inv(fpxo)*fxo;
v = vn;
theta3 = v(1);
theta4 = v(2);
fv1 = eval(f1);
fv2 = eval(f2);
fxo = [fv1;fv2];
f1pv = eval(gradf1);
f2pv = eval(gradf2);
fpxo =[f1pv;f2pv];
if det(fpxo)==0
35
disp('Err:determinant of Jacobian is zero,try another initial point ')
end
s1 = sprintf('%3.0f %- 10.4f %- 10.4f',iter,v(1),v(2));
s2 = sprintf(' %- 10.4f %- 10.4f',fv1,fv2);
disp([s1 s2])
end
root = v;
disp(sprintf('\n The Root is: theta3 = %- 8.4f, theta4 = %- 8.4f',v(1),v(2)))
end;
disp('
--------------------------------------------------------------------------------')
% calculate theta5 and theta6.
theta5 = v(1);
theta6 = v(2);
fv1 = eval(f1);
fv2 = eval(f2);
fxo = [fv1;fv2];
f1pv = eval(gradf1);
f2pv = eval(gradf2);
fpxo =[f1pv;f2pv];
if det(fpxo)==0
disp('Err: determinant of Jacobian is zero, try another initial point ')
else
iter = 0;
s1 = sprintf('%3.0f %- 10.4f %- 10.4f',iter,v(1),v(2));
s2 = sprintf(' %- 10.4f %- 10.4f',fv1,fv2);
disp([s1 s2])
while (norm(fxo)>tol) & (det(fpxo)~=0) & (iter<nitermax)
iter = iter + 1;
vn = v - inv(fpxo)*fxo;
v = vn;
theta5 = v(1);
theta6 = v(2);
fv1 = eval(f1);
fv2 = eval(f2);
fxo = [fv1;fv2];
f1pv = eval(gradf1);
f2pv = eval(gradf2);
fpxo =[f1pv;f2pv];
if det(fpxo)==0
disp('Err:determinant of Jacobian is zero, try another initial point ')
end
s1 = sprintf('%3.0f %- 10.4f %- 10.4f',iter,v(1),v(2));
s2 = sprintf(' %- 10.4f %- 10.4f',fv1,fv2);
36
disp([s1 s2])
end
root = v;
disp(sprintf('\n The Root is: theta5 = %- 8.4f, theta6 = %- 8.4f',v(1),v(2)))
end;
disp('
--------------------------------------------------------------------------------');
% calculate rs, thetas and rd, thetad
% to calculate rs and rd, we have to caculate coordinate of point E and
% point H (these point are shown in Fig. 1);
Xs = -50; Ys = -40;
Xd = -50; Yd = 0;
XE = r2*cos(theta2)+r33*cos(theta3+theta33);
YE = r2*sin(theta2)+r33*sin(theta3+theta33);
XH = r2*cos(theta2)+r33*cos(theta3+theta33)+ r55*cos(theta5+theta55);
YH = r2*cos(theta2)+r33*cos(theta3+theta33)+ r55*cos(theta5+theta55);
rs = sqrt((XE-Xs).^2+(YE-Ys).^2);
rd = sqrt((Xd-XH).^2+(Yd-YH).^2);
thetas = atan((YE-Ys)/(XE-Xs));
thetad = atan((YH-Yd)/(XH-Xd));
disp('');
fprintf('rs = %8.4f thetas = %8.4f rd = %8.4f thetad = %8.4f\n', rs,...
thetas, rd, thetad);
disp('
--------------------------------------------------------------------------------');
% calculate kinematic coefficients;
f1 = r2*cos(theta2)+r3*cos(theta3)+r4*cos(theta4)-r1;
f11theta2 = -r2*sin(theta2)-r3*sin(theta3)*h3-r4*sin(theta4)*h4;
f2 = r2*sin(theta2)+r3*sin(theta3)+r4*sin(theta4)-r11;
f22theta2 = r2*cos(theta2)+r3*cos(theta3)*h3+r4*cos(theta4)*h4;
g2 = r2*sin(theta2)+r33*cos(theta3+theta33)+ r5*sin(theta5)...
+r6*sin(theta6)-r77;
g22theta2 = r2*cos(theta2)+ r33*cos(theta3+theta33)*h3...
+r5*cos(theta5)*h5+r6*cos(theta6)*h6;
f111theta2 = -r2*cos(theta2)-r3*cos(theta3)*h3*h3-r3*sin(theta3)*h33...
-r4*cos(theta4)*h4*h4-r4*sin(theta4)*h44;
f222theta2 = -r2*sin(theta2)-r3*sin(theta3)*h3*h3+r3*cos(theta3)*h33...
-r4*sin(theta4)*h4*h4+r4*cos(theta4)*h44;
g111theta2 = -r2*cos(theta2)-r33*cos(theta3+theta33)*h3*h3...
-r33*sin(theta3+theta33)*h33-r5*cos(theta5)*h5*h5...
-r5*sin(theta5)*h55-r6*cos(theta6)*h6*h6...
-r6*sin(theta6)*h66;
g222theta2 = -r2*sin(theta2)-r33*sin(theta3+theta33)*h3*h3...
+r33*cos(theta3+theta33)*h33-r5*sin(theta5)*h5*h5...
+r5*cos(theta5)*h55-r6*sin(theta6)*h6*h6...
+r6*cos(theta6)*h66;
aa3 = h33*omega2.*omega2;
aa4 = h44*omega2.*omega2;
aa5 = h55*omega2.*omega2;
aa6 = h66*omega2.*omega2;
disp(' aa2 aa3 aa4 aa5 aa6');
aa = [aa2; aa3; aa4; aa5; aa6];
aaa = aa';
disp(aaa);
38
disp('
--------------------------------------------------------------------------------')
% calculate for mass center of each link;
% link 2;
Xg2 = l2*cos(theta2);
Xg22 = -l2*sin(theta2)*omega2;
Xg222 = -l2*cos(theta2)*omega2.*omega2;
Yg2 = l2*sin(theta2);
Yg22 = l2*cos(theta2)*omega2;
Yg222 = -l2*sin(theta2)*omega2.*omega2;
magvg2 = sqrt(Xg22.^2 + Yg22.^2);
magag2 = sqrt(Xg222.^2 + Yg222.^2);
Xg2 = [Xg2 Xg2 Xg2 Xg2 Xg2];
Yg2 = [Yg2 Yg2 Yg2 Yg2 Yg2];
disp(' Xg2 Yg2 Xg22 Yg22 magvg2 Xg222 Yg222
magag2');
G2 = [Xg2; Yg2; Xg22; Yg22; magvg2; Xg222; Yg222; magag2];
G22 = G2';
disp(G22);
disp('
--------------------------------------------------------------------------------');
% link 3;
Xg3 = r2*cos(theta2)+l3*cos(theta3+phi3);
Xg33 = -r2*sin(theta2)*omega2 - l3*sin(theta3+phi3)*h3*omega2;
Xg333 = -r2*cos(theta2)*omega2.*omega2 - l3*cos(theta3+phi3)*h3 ...
*h3*omega2.*omega2 - l3*sin(theta3+phi3)*h33*omega2;
Yg3 = r2*sin(theta2)+l3*sin(theta3+phi3);
Yg33 = r2*cos(theta2)*omega2 + l3*cos(theta3+phi3)*h3*omega2;
Yg333 = - r2*sin(theta2)*omega2.*omega2 - l3*sin(theta3+phi3)*h3*h3 ...
*omega2.*omega2 + l3*cos(theta3+phi3)*h33*omega2;
magvg3 = sqrt(Xg33.^2 + Yg33.^2);
magag3 = sqrt(Xg333.^2 + Yg333.^2);
Xg3 = [Xg3 Xg3 Xg3 Xg3 Xg3];
Yg3 = [Yg3 Yg3 Yg3 Yg3 Yg3];
disp(' Xg3 Yg3 Xg33 Yg33 magvg3 Xg333 Yg333
magag3');
G3 = [Xg3; Yg3; Xg33; Yg33; magvg3; Xg333; Yg333; magag3];
G33 = G3';
disp(G33);
disp('
--------------------------------------------------------------------------------');
% link 4;
Xg4 = r2*cos(theta2) + r3*cos(theta3) + l4*cos(theta4+phi4);
Xg44 = -r2*sin(theta2)*omega2 - r3*sin(theta3)*h3*omega2 ...
- l4*sin(theta4+phi4)*h4*omega2;
Xg444 = - r2*sin(theta2)*omega2.*omega2 - r3*cos(theta3)*h3 ...
*h3*omega2.*omega2 - r3*sin(theta3)*h33*omega2 ...
- l4*cos(theta4+phi4)*h4*h4*omega2.*omega2 ...
- l4*sin(theta4+phi4)*h44*omega2;
Yg4 = r2*sin(theta2) + r3*sin(theta3) + l4*sin(theta4+phi4);
Yg44 = r2*cos(theta2)*omega2 + r3*cos(theta3)*h3*omega2 ...
+ l4*cos(theta4+phi4)*h4*omega2;
Yg444 = - r2*sin(theta2)*omega2.*omega2 - r3*sin(theta3)*h3*h3 ...
*omega2.*omega2 + l3*cos(theta3)*h33*omega2 ...
- l4*sin(theta4+phi4)*h4*h4*omega2.*omega2 ...
+ l4*cos(theta4+phi4)*h44*omega2;
magvg4 = sqrt(Xg44.^2 + Yg44.^2);
magag4 = sqrt(Xg444.^2 + Yg444.^2);
Xg4 = [Xg4 Xg4 Xg4 Xg4 Xg4];
Yg4 = [Yg4 Yg4 Yg4 Yg4 Yg4];
disp(' Xg4 Yg4 Xg44 Yg44 magvg4 Xg444 Yg444
magag4');
G4 = [Xg4; Yg4; Xg44; Yg44; magvg4; Xg444; Yg444; magag4];
G44 = G4';
39
disp(G44);
disp('
--------------------------------------------------------------------------------');
% link 5;
Xg5 = r2*cos(theta2) + r33*cos(theta3+theta33) + l5*cos(theta5+phi5);
Xg55 = -r2*sin(theta2)*omega2 - r33*sin(theta3+theta33)*h3*omega2 ...
- l5*sin(theta5+phi5)*h5*omega2;
Xg555 = - r2*sin(theta2)*omega2.*omega2 - r33*cos(theta3+theta33)*h3 ...
*h3*omega2.*omega2 - r33*sin(theta3+theta33)*h33*omega2 ...
- l5*cos(theta5+phi5)*h5*h5*omega2.*omega2 ...
- l5*sin(theta5+phi5)*h55*omega2;
Yg5 = r2*sin(theta2) + r33*sin(theta3+theta33) + l5*sin(theta5+phi5);
Yg55 = r2*cos(theta2)*omega2 + r33*cos(theta3+theta33)*h3*omega2 ...
+ l5*cos(theta5+phi5)*h5*omega2;
Yg555 = - r2*sin(theta2)*omega2.*omega2 - r33*sin(theta3+theta33)*h3*h3 ...
*omega2.*omega2 + l3*cos(theta3+theta33)*h33*omega2 ...
- l5*sin(theta5+phi5)*h5*h5*omega2.*omega2 ...
+ l5*cos(theta5+phi5)*h55*omega2;
magvg5 = sqrt(Xg55.^2 + Yg55.^2);
magag5 = sqrt(Xg555.^2 + Yg555.^2);
Xg5 = [Xg5 Xg5 Xg5 Xg5 Xg5];
Yg5 = [Yg5 Yg5 Yg5 Yg5 Yg5];
disp(' Xg5 Yg5 Xg55 Yg55 magvg5 Xg555 Yg555
magag5');
G5 = [Xg5; Yg5; Xg55; Yg55; magvg5; Xg555; Yg555; magag5];
G55 = G5';
disp(G55);
% The relation between omega2 and magvg5: magvg5 = abs(k*omega2),(k is a real
% number. Hence, magvg5 = magvg5max when omega2 = omega2max. And we have:
% magag5 = abs(k*omega2.^2),(k is a real number. Hence, magag5 = magag5max
% when omega2 = omega2max;
disp('
--------------------------------------------------------------------------------');
% link 6;
Xg6 = r2*cos(theta2) + r33*cos(theta3+theta33) + r5*cos(theta5) ...
+l6*cos(theta6+phi6);
Xg66 = -r2*sin(theta2)*omega2 - r33*sin(theta3+theta33)*h3*omega2 ...
- r5*sin(theta5)*h5*omega2 - l6*sin(theta6+phi6)*h6*omega2 ;
Xg666 = - r2*sin(theta2)*omega2.*omega2 - r33*cos(theta3+theta33)*h3 ...
*h3*omega2.*omega2 - r33*sin(theta3+theta33)*h33*omega2 ...
- r5*cos(theta5)*h5*h5*omega2.*omega2 ...
- r5*sin(theta5)*h55*omega2 - l6*cos(theta6+phi6)*h6*h6 ...
*omega2.*omega2 - l6*sin(theta6+phi6)*h66*omega2;
Yg6 = r2*sin(theta2) + r33*sin(theta3+theta33) + r5*sin(theta5) ...
+l6*sin(theta6+phi6);
Yg66 = r2*cos(theta2)*omega2 + r33*cos(theta3+theta33)*h3*omega2 ...
+ r5*cos(theta5)*h5*omega2 + +l6*cos(theta6+phi6);
Yg666 = -r2*sin(theta2)*omega2.*omega2 - r33*sin(theta3+theta33)*h3*h3 ...
*omega2.*omega2 + l3*cos(theta3+theta33)*h33*omega2 ...
-r5*sin(theta5)*h5*h5*omega2.*omega2+r5*cos(theta5)*h55*omega2 ...
-r6*sin(theta6+phi6)*h6*h6*omega2.*omega2+r6*cos(theta6+phi6) ...
*h66*omega2;
magvg6 = sqrt(Xg66.^2 + Yg66.^2);
magag6 = sqrt(Xg666.^2 + Yg666.^2);
Xg6 = [Xg6 Xg6 Xg6 Xg6 Xg6];
Yg6 = [Yg6 Yg6 Yg6 Yg6 Yg6];
disp(' Xg6 Yg6 Xg66 Yg66 magvg6 Xg666 Yg666
magag6');
G6 = [Xg6; Yg6; Xg66; Yg66; magvg6; Xg666; Yg666; magag6];
G66 = G6';
disp(G66);
disp('
--------------------------------------------------------------------------------');
theta = [theta2;theta3;theta4;theta5;theta6];
40
table2 = [theta omega aa];
disp(' Table 2 the result with theta2 = 2*pi/3');
disp(' theta(i) omega(i)
aa(i)');
disp(table2);
end;