-
Notifications
You must be signed in to change notification settings - Fork 2
/
calculate_matrixMtheta.m
executable file
·21 lines (20 loc) · 4.7 KB
/
calculate_matrixMtheta.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function f=calculate_matrixMtheta(theta)
theta1=theta(1);
theta2=theta(2);
theta3=theta(3);
theta4=theta(4);
theta5=theta(5);
theta6=theta(6);
theta7=theta(7);
theta8=theta(8);
global m l J
Mr1=[ m*((7*cos(theta1)^2)/8 + (7*sin(theta1)^2)/8)*l^2 + J, l^2*m*((13*cos(theta1)*cos(theta2))/8 + (13*sin(theta1)*sin(theta2))/8), l^2*m*((11*cos(theta1)*cos(theta3))/8 + (11*sin(theta1)*sin(theta3))/8), l^2*m*((9*cos(theta1)*cos(theta4))/8 + (9*sin(theta1)*sin(theta4))/8), l^2*m*((7*cos(theta1)*cos(theta5))/8 + (7*sin(theta1)*sin(theta5))/8), l^2*m*((5*cos(theta1)*cos(theta6))/8 + (5*sin(theta1)*sin(theta6))/8), l^2*m*((3*cos(theta1)*cos(theta7))/8 + (3*sin(theta1)*sin(theta7))/8), l^2*m*((cos(theta1)*cos(theta8))/8 + (sin(theta1)*sin(theta8))/8)];
Mr2=[ l^2*m*((13*cos(theta1)*cos(theta2))/8 + (13*sin(theta1)*sin(theta2))/8), m*((31*cos(theta2)^2)/8 + (31*sin(theta2)^2)/8)*l^2 + J, l^2*m*((33*cos(theta2)*cos(theta3))/8 + (33*sin(theta2)*sin(theta3))/8), l^2*m*((27*cos(theta2)*cos(theta4))/8 + (27*sin(theta2)*sin(theta4))/8), l^2*m*((21*cos(theta2)*cos(theta5))/8 + (21*sin(theta2)*sin(theta5))/8), l^2*m*((15*cos(theta2)*cos(theta6))/8 + (15*sin(theta2)*sin(theta6))/8), l^2*m*((9*cos(theta2)*cos(theta7))/8 + (9*sin(theta2)*sin(theta7))/8), l^2*m*((3*cos(theta2)*cos(theta8))/8 + (3*sin(theta2)*sin(theta8))/8)];
Mr3=[ l^2*m*((11*cos(theta1)*cos(theta3))/8 + (11*sin(theta1)*sin(theta3))/8), l^2*m*((33*cos(theta2)*cos(theta3))/8 + (33*sin(theta2)*sin(theta3))/8), m*((47*cos(theta3)^2)/8 + (47*sin(theta3)^2)/8)*l^2 + J, l^2*m*((45*cos(theta3)*cos(theta4))/8 + (45*sin(theta3)*sin(theta4))/8), l^2*m*((35*cos(theta3)*cos(theta5))/8 + (35*sin(theta3)*sin(theta5))/8), l^2*m*((25*cos(theta3)*cos(theta6))/8 + (25*sin(theta3)*sin(theta6))/8), l^2*m*((15*cos(theta3)*cos(theta7))/8 + (15*sin(theta3)*sin(theta7))/8), l^2*m*((5*cos(theta3)*cos(theta8))/8 + (5*sin(theta3)*sin(theta8))/8)];
Mr4=[ l^2*m*((9*cos(theta1)*cos(theta4))/8 + (9*sin(theta1)*sin(theta4))/8), l^2*m*((27*cos(theta2)*cos(theta4))/8 + (27*sin(theta2)*sin(theta4))/8), l^2*m*((45*cos(theta3)*cos(theta4))/8 + (45*sin(theta3)*sin(theta4))/8), m*((55*cos(theta4)^2)/8 + (55*sin(theta4)^2)/8)*l^2 + J, l^2*m*((49*cos(theta4)*cos(theta5))/8 + (49*sin(theta4)*sin(theta5))/8), l^2*m*((35*cos(theta4)*cos(theta6))/8 + (35*sin(theta4)*sin(theta6))/8), l^2*m*((21*cos(theta4)*cos(theta7))/8 + (21*sin(theta4)*sin(theta7))/8), l^2*m*((7*cos(theta4)*cos(theta8))/8 + (7*sin(theta4)*sin(theta8))/8)];
Mr5=[ l^2*m*((7*cos(theta1)*cos(theta5))/8 + (7*sin(theta1)*sin(theta5))/8), l^2*m*((21*cos(theta2)*cos(theta5))/8 + (21*sin(theta2)*sin(theta5))/8), l^2*m*((35*cos(theta3)*cos(theta5))/8 + (35*sin(theta3)*sin(theta5))/8), l^2*m*((49*cos(theta4)*cos(theta5))/8 + (49*sin(theta4)*sin(theta5))/8), m*((55*cos(theta5)^2)/8 + (55*sin(theta5)^2)/8)*l^2 + J, l^2*m*((45*cos(theta5)*cos(theta6))/8 + (45*sin(theta5)*sin(theta6))/8), l^2*m*((27*cos(theta5)*cos(theta7))/8 + (27*sin(theta5)*sin(theta7))/8), l^2*m*((9*cos(theta5)*cos(theta8))/8 + (9*sin(theta5)*sin(theta8))/8)];
Mr6=[ l^2*m*((5*cos(theta1)*cos(theta6))/8 + (5*sin(theta1)*sin(theta6))/8), l^2*m*((15*cos(theta2)*cos(theta6))/8 + (15*sin(theta2)*sin(theta6))/8), l^2*m*((25*cos(theta3)*cos(theta6))/8 + (25*sin(theta3)*sin(theta6))/8), l^2*m*((35*cos(theta4)*cos(theta6))/8 + (35*sin(theta4)*sin(theta6))/8), l^2*m*((45*cos(theta5)*cos(theta6))/8 + (45*sin(theta5)*sin(theta6))/8), m*((47*cos(theta6)^2)/8 + (47*sin(theta6)^2)/8)*l^2 + J, l^2*m*((33*cos(theta6)*cos(theta7))/8 + (33*sin(theta6)*sin(theta7))/8), l^2*m*((11*cos(theta6)*cos(theta8))/8 + (11*sin(theta6)*sin(theta8))/8)];
Mr7=[ l^2*m*((3*cos(theta1)*cos(theta7))/8 + (3*sin(theta1)*sin(theta7))/8), l^2*m*((9*cos(theta2)*cos(theta7))/8 + (9*sin(theta2)*sin(theta7))/8), l^2*m*((15*cos(theta3)*cos(theta7))/8 + (15*sin(theta3)*sin(theta7))/8), l^2*m*((21*cos(theta4)*cos(theta7))/8 + (21*sin(theta4)*sin(theta7))/8), l^2*m*((27*cos(theta5)*cos(theta7))/8 + (27*sin(theta5)*sin(theta7))/8), l^2*m*((33*cos(theta6)*cos(theta7))/8 + (33*sin(theta6)*sin(theta7))/8), m*((31*cos(theta7)^2)/8 + (31*sin(theta7)^2)/8)*l^2 + J, l^2*m*((13*cos(theta7)*cos(theta8))/8 + (13*sin(theta7)*sin(theta8))/8)];
Mr8=[ l^2*m*((cos(theta1)*cos(theta8))/8 + (sin(theta1)*sin(theta8))/8), l^2*m*((3*cos(theta2)*cos(theta8))/8 + (3*sin(theta2)*sin(theta8))/8), l^2*m*((5*cos(theta3)*cos(theta8))/8 + (5*sin(theta3)*sin(theta8))/8), l^2*m*((7*cos(theta4)*cos(theta8))/8 + (7*sin(theta4)*sin(theta8))/8), l^2*m*((9*cos(theta5)*cos(theta8))/8 + (9*sin(theta5)*sin(theta8))/8), l^2*m*((11*cos(theta6)*cos(theta8))/8 + (11*sin(theta6)*sin(theta8))/8), l^2*m*((13*cos(theta7)*cos(theta8))/8 + (13*sin(theta7)*sin(theta8))/8), m*((7*cos(theta8)^2)/8 + (7*sin(theta8)^2)/8)*l^2 + J];
matM=[Mr1;Mr2;Mr3;Mr4;Mr5;Mr6;Mr7;Mr8];
f=matM;