Create multidimensional rotation matrix

3 visualizaciones (últimos 30 días)
Dominick
Dominick el 24 de Mzo. de 2023
Comentada: Dominick el 24 de Mzo. de 2023
I have two 1x541 column vectors: one for latitudes and one for longitudes.I want to create a 3d array rotation matrix where each iteration in the third dimension steps from 1 to 541 from the column vector. It should be a 3x3x541 array.
Here is what I have so far:
"aclon" and "aclat" are the 541x1 column vectors. "howbig" is just the length of the column vectors and used for matching the length of "aclon" and "aclat"
My code currently produces a 1623x3 matrix
Rm = [sin(aclon) cos(aclon) zeros(howbig,1); -sin(aclat).*cos(aclon) sin(aclat).*sin(aclon) cos(aclat); cos(aclat).*cos(aclon) cos(aclat).*sin(aclon) sin(aclat)];

Respuesta aceptada

Matt J
Matt J el 24 de Mzo. de 2023
Editada: Matt J el 24 de Mzo. de 2023
howbig=541;
[aclon,aclat]=deal(rand(howbig,1)); %fake input data
aclon=reshape(aclon,1,1,[]);
aclat=reshape(aclat,1,1,[]);
Rm = [sin(aclon) cos(aclon) 0*aclat;
-sin(aclat).*cos(aclon) sin(aclat).*sin(aclon) cos(aclat);
cos(aclat).*cos(aclon) cos(aclat).*sin(aclon) sin(aclat)];
whos Rm
Name Size Bytes Class Attributes Rm 3x3x541 38952 double

Más respuestas (0)

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Productos


Versión

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by