필터 지우기
필터 지우기

Create multidimensional rotation matrix

조회 수: 3 (최근 30일)
Dominick
Dominick 2023년 3월 24일
댓글: Dominick 2023년 3월 24일
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)];

채택된 답변

Matt J
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
Name Size Bytes Class Attributes Rm 3x3x541 38952 double
  댓글 수: 1
Dominick
Dominick 2023년 3월 24일
Thanks! Exactly what I was looking for

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by