Create multidimensional rotation matrix
조회 수: 3 (최근 30일)
이전 댓글 표시
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)];
댓글 수: 0
채택된 답변
Matt J
2023년 3월 24일
편집: Matt J
2023년 3월 24일
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!