Help with matrix manipulation

7 visualizaciones (últimos 30 días)
Ian Phillips
Ian Phillips el 10 de Dic. de 2012
I'm trying to do 2D rotations using matrices but don't know how to format it to return a 2x3 matrix.
%%Rotation Matrix for platform
% angle in degrees
THETA = 90;
% Matrix
R = [ cosd(THETA), -sind(THETA);
sind(THETA), cosd(THETA) ];
for i=1:3
rotated{i} = R * [ x(i); y(i) ];
end
The result I get is an array:
rotated =
[2x1 double] [2x1 double] [2x1 double]
However my desired result is the matrix =
rotated =
[x1] [x2] [x3]
[y1] [y2] [y3]
Can any shed some light on this problem for me please?

Respuesta aceptada

Sean de Wolski
Sean de Wolski el 10 de Dic. de 2012
cell2mat(rotated)
?
  1 comentario
Ian Phillips
Ian Phillips el 10 de Dic. de 2012
rotated = cell2mat(rotated);
This worked, thanks.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Creating and Concatenating Matrices 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!

Translated by