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

조회 수: 1 (최근 30일)
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

답변 (1개)

David Goodmanson
David Goodmanson 2020년 8월 14일
편집: David Goodmanson 2020년 8월 14일
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.

카테고리

Help CenterFile Exchange에서 Number Theory에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by