how to calculate direction in rotated coordinate system

조회 수: 10 (최근 30일)
UWM
UWM 2020년 1월 11일
댓글: UWM 2020년 3월 4일
I have a direction defined by azimuth and evation (e.g. Azi, Elev).
I would like to calculate values of these Azi i Elev after coordinate system
rotation: first around Z axis (angle e.g.: Zrot) and then around rotated (in first rotation
around Z axis) Y axis (angle e.g.: Yrot).
So: I rotate coordinate system around Z axis, then around "rotated" Y axis and I would like to
calculate Azi and Elev in rotated coordinate system.
How can be it done?

채택된 답변

David Goodmanson
David Goodmanson 2020년 1월 12일
편집: David Goodmanson 2020년 1월 12일
Hi UWM,
Assuming the correct rotation has already been made, then calling the resulting vector u, and making sure it is normalized by using u/norm(u), suppose the three components of u are given in the order (north,east, up) in an appropriate coordinate system. Assuming elevation is measured up from the horizon and azimuth is measured clockwise from north (as with a compass rose), u has the form
cos(el)*cos(az)
cos(el)*sin(az)
sin(el)
then you can divide the second expression by the first to arrive at
el = asin(u(3))
az = atan2(u(2)/u(1)
There are a lot of variations on this theme depending on how the vector components and the angles are defined, but the basic idea will be the same.
  댓글 수: 3
David Goodmanson
David Goodmanson 2020년 1월 15일
Hi UWM,
Although there is more than one convention for how to do this, I am guessing that you are doing an active rotation, i.e. there is an overall fixed coordinate system S and you are rotating a vector object within that system. After a series of rotations, the final result is expressed as coordinates in S.
You are expressing the vector as a row vector and multiplying by rotation matrices on the right. If you have not done so already, it's a good idea to run some test cases on rotz,roty and also rotx at, say, 45 degrees to verify that they are doing what you think.
Now you wish to first rotate about the z axis, which rotates the object and also rotates the y and x axes to xnew and ynew. That's followed by a rotation about ynew.
Abbreviating rotz as Rz etc, a rotation of v about the z axis followed by a rotation about the old y axis would have been
vrot = v*Rz*Ry [1]
the matrix Rynew, a rotation about ynew, is related to the original Ry by
Rynew = Rz^(-1)*Ry*Rz
and so
vrot = v*Rz*Rz^(-1)*Ry*Rz = v*Ry*Rz
This uses rotations involving the original coordinate system, only with the order reversed compared to [1]. Hope this helps.
UWM
UWM 2020년 1월 15일
Thanks, now it works :)

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

추가 답변 (1개)

Matt J
Matt J 2020년 1월 14일
편집: Matt J 2020년 1월 14일
Using AxelRot (Download), and assuming all angles are given in radians,
[x,y,z] = sph2cart(Azi_Old,Elev_Old,1);
P=AxelRot( [x,y,z;0,1,0].' , Zrot*180/pi, [0,0,1], []);
Q=AxelRot( P(:,1), Yrot*180/pi, P(:,2), []);
[Azi_New,Elev_New]=cart2sph( Q(1),Q(2),Q(3) );
  댓글 수: 2
UWM
UWM 2020년 1월 15일
Thank you for help, I checek also your approach and it also works very well:)
UWM
UWM 2020년 3월 4일
Hi Matt,
I have still some problem with this issue. It seems that in both approaches after first rotation (around Z axis) we get new position in Old Coordinate System (POZo turns into POZn) and this new position (POZn) is then rotated around Yn axis.
But my goal is a bit different: I would like rotate XoYoZo system around Zo axis, get POZo in New Coordinate System (POZo in XnYnZn) and finally rotate XnYnZn system around Yn axis and obtain POZo after this rotation.
Maybe you can help me
Best regards

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

카테고리

Help CenterFile Exchange에서 Geographic Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by