Vertcat error when Im not using vertcat
22 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am working on a rotational robot homogeneous transformation matricies but I keep getting a vertcat error when Im only multiplying mtrices of the same size. This code was working two weeks ago but all of sudden, its getting a vertcat error. Here is my code:
function H = H(theta1, theta2, theta3) %creating homogeneous function
%--------------------------
%--------------------------
H = (Rx(-90)*Rz(theta1)*Tz(0.25))*(Rz(theta2)*Tx(0.4))*(Rz(theta3)*Tx(0.4));
%there are other parts of this function that simply plot parts of H that I don't belevie are necessary here
end
%basic transformation functions
%Rotational martices
function [Rx] = Rx(a) %creating functoin Rx
Rx = [1 0 0 0; %defining function Rx
0 cosd(a) -sind(a) 0;
0 sind(a) cosd(a) 0;
0 0 0 1];
end
function [Ry] = Ry(b) %creating functoin Ry
Ry = [cosd(b) 0 sind(b) 0; %defining function Ry
0 1 0 0;
-sind(b) 0 cosd(b) 0;
0 0 0 1];
end
function [Rz] = Rz(g) %creating functoin Rz
Rz = [cosd(g) -sind(g) 0 0; %defining function Rz
sind(g) cosd(g) 0 0;
0 0 1 0;
0 0 0 1];
end
%Tranlational matrices
function [Tx] = Tx(a) %creating functoin Tx
Tx = [1 0 0 a; %defining function Tx
0 1 0 0;
0 0 1 0;
0 0 0 1];
end
function [Ty] = Ty(b) %creating functoin Ty
Ty = [1 0 0 0; %defining function Ty
0 1 0 b;
0 0 1 0;
0 0 0 1];
end
function [Tz] = Tz(c) %creating functoin Tz
Tz = [1 0 0 0; %defining function Tz
0 1 0 0;
0 0 1 c;
0 0 0 1];
end
3 comentarios
Stephen23
el 24 de Feb. de 2020
"Vertcat error when Im not using vertcat"
Actually indirectly you are. This shorthand syntax using square brackets:
[A;B]
calls vertcat to actually perform the concatenation.
As Jacob Wood asked about, the error most likely occurs because some of the arrays you are trying to concatenate are not scalar.
Respuestas (0)
Ver también
Categorías
Más información sobre Dates and Time en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!