You are on page 1of 1

function T = computeTransformationMatrix(theta1, theta2, theta3)

% Define DH parameters
L1 = 4;
L2 = 3;
L3 = 2;

% Define DH parameters (alpha, a, d, theta)


alpha = [0, pi/2, 0];
a = [0, L2, L3];
d = [0, 0, 0];
theta = [theta1, theta2, theta3];

% Initialize identity matrix for transformation


T = eye(4);

% Compute transformation matrix using DH parameters


for i = 1:3
A = [cos(theta(i)), -sin(theta(i))*cos(alpha(i)),
sin(theta(i))*sin(alpha(i)), a(i)*cos(theta(i));
sin(theta(i)), cos(theta(i))*cos(alpha(i)), -
cos(theta(i))*sin(alpha(i)), a(i)*sin(theta(i));
0, sin(alpha(i)), cos(alpha(i)), d(i);
0, 0, 0, 1];
T = T * A;
end
end

You might also like