필터 지우기
필터 지우기

azimuth, elevation to x y z rotation

조회 수: 92 (최근 30일)
Henning Wilhelm
Henning Wilhelm 2022년 5월 25일
댓글: Tobias Wrammerfors 2023년 5월 4일
Hello,
input for my rotation is azimuth and elevation. I want to have the rotation for x y and z from this to rotate my 3D data.
example:
gm = multicuboid(0.3,0.3,0.3); %create cube 30cm*30cm*30cm
cube_coordinates = gm.Vertices; %copy coordinates from cube
az = 45; %azimuth angle = 45°
el = 0; %elevation angle = 0°
%[x,y,z] = azel2xyz(az,el);
%rotMat = rotx(x) * roty(y) * rotz(z); %create rotation matrix with azimuth angle of 45°
rotMat = rotx(0) * roty(0) * rotz(45); %create rotation matrix with azimuth angle of 45°
cube_coordinates_rot = rotMat*cube_coordinates'; % apply rotation matrix
cube_coordinates_rot = cube_coordinates_rot';
figure
subplot(1,2,1)
scatter3(cube_coordinates(:,1),cube_coordinates(:,2),cube_coordinates(:,3));
title('unrotated');
subplot(1,2,2)
scatter3(cube_coordinates_rot(:,1),cube_coordinates_rot(:,2),cube_coordinates_rot(:,3));
title('rotated');
I'm looking for a solution for the function [x,y,z] = azel2xyz(az,el);
I tried sph2cart without any success.
Thanks for your help.

답변 (1개)

Benjamin Thompson
Benjamin Thompson 2022년 5월 25일
편집: Benjamin Thompson 2022년 5월 25일
Your question is incomplete. Azimuth and elevation are two angles and there is no single point solution [x, y, z] that satisfies the equation [x,y,z] = azel2xyz(az,el) unless you add a third parameter for range.
For some background information google "Discrete Cosine Transform" and if you have access to the aerospace toolbox look over the documentation for the angle2dcm function. Also google "Euler Angles".
Then if you do something like:
dcm = angle2dcm(45*pi/180, 20*pi/180, 0, 'ZYX');
p2 = dcm*[range 0 0]';
Then this would convert a point [range 0 0] in the initial "1" coordinate frame to point p2 in the "2" coordinate frame where "2" is rotated counter clockwise 45 degrees in Z and then counter clockwise 20 degrees in Y compared to "1" following right hand rule coordinate conventions and Euler's definition of orientation angles.
  댓글 수: 1
Tobias Wrammerfors
Tobias Wrammerfors 2023년 5월 4일
Sorry for reviving an old thread here - but I have an opposite issue from the OP, namely I am trying to convert from a [x,y,z] (roll, pitch, yaw) set of angles (as output by the regionprops3 function) into azimuth and elevation.
As far as I understand it, the roll would be applied first, then pitch would be applied to an already rolled frame, making pitch not equivalent to elevation. Is there a simple way to compute the elevation angle from the roll, pitch, yaw angles?

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

카테고리

Help CenterFile Exchange에서 Earth, Ocean, and Atmospheric Sciences에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by