dot multiplication of the matrices is not the same when you feed the matrix and concatenate the matrix

1 vue (au cours des 30 derniers jours)
I try to constact two matrix from anther matrix by concatnate the matrix in row and clumme as you can see in the code. But the anw is not the same. I do the culcuation by hand the correct anw is the one I feed it by hard code it . What I do wrong?
clc ,clear
syms theta1 theta2 a1 a2 a3 a4
R0_0 = eye(3)
R0_1 = [cos(theta1) -sin(theta1) 0 ; sin(theta1) cos(theta1) 0;0 0 1 ];
R1_2 = [cos(theta2) -sin(theta2) 0 ; sin(theta2) cos(theta2) 0;0 0 1];
d0_1 = [a2*cos(theta1);a2*sin(theta1);a1]
d1_2 = [a4*cos(theta2);a4*sin(theta2);a3]
% constraction the matrix
H0_1 = [[R0_1,d0_1];h] % concatnate the matrix
H1_2 = [[R1_2,d1_2];h] % concatnate the matrix
% hard code the matrix
% H0_1h is R0_1 concatnate with d0_1 in colume and concatnate with [0 0 0 1]
% in row
H0_1h = [cos(theta1) -sin(theta1) 0 a2*cos(theta1) ; sin(theta1) cos(theta1) 0 a2*sin(theta1) ; 0 0 1 a1 ; 0 0 0 1]
% H0_1h is R0_1 concatnate with d0_1 in colume and concatnate with [0 0 0 1]
% in row
H1_2h = [cos(theta2) -sin(theta2) 0 a3*cos(theta2) ; sin(theta2) cos(theta2) 0 a3*sin(theta2) ; 0 0 1 a4 ; 0 0 0 1]
% dot product of the matrix
% This is the dot product from the concatnate matrix
% It wrong by my culclation
H0_2 = H0_1 * H1_2
%This is the dot proudct from hard-code the matrxi
H0_2h = H0_1h * H1_2h

Réponses (1)

David Goodmanson
David Goodmanson le 14 Août 2020
Modifié(e) : David Goodmanson le 14 Août 2020
Hi mohammed,
For H1_2 you have switched a3 and a4 between the first calculation and the hand calculation. So you get two different results.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by