azimuth, elevation to x y z rotation

101 vues (au cours des 30 derniers jours)
Henning Wilhelm
Henning Wilhelm le 25 Mai 2022
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.

Réponses (1)

Benjamin Thompson
Benjamin Thompson le 25 Mai 2022
Modifié(e) : Benjamin Thompson le 25 Mai 2022
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 commentaire
Tobias Wrammerfors
Tobias Wrammerfors le 4 Mai 2023
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?

Connectez-vous pour commenter.

Catégories

En savoir plus sur Earth, Ocean, and Atmospheric Sciences dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by