coordinate system rotation and then calculate position in new (rotated) system

2 views (last 30 days)
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.
I try
vrot = v*Rz*Ry
with
Rz = [ cosd(Azi) -sind(Azi) 0;
sind(Azi) cosd(Azi) 0;
0 0 1];
Ry = [ cosd(Elev) 0 sind(Elev);
0 1 0;
-sind(Elev) 0 cosd(Elev)];
But it seems that in this approach after first rotation (around Zo 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.
If it can be done somehow in matlab?

Answers (1)

darova
darova on 16 Mar 2020
Here is the solution
v1 = Rz*v(:);
[az1,el1] = cart2sph(v1(1),v1(2),v1(3));
v2 = Ry*v1(:);
[az2,el2] = cart2sph(v2(1),v2(2),v2(3));

Community Treasure Hunt

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

Start Hunting!