What is the calculation for the angle formed by the rotated x-axis in a 3D plot?

  • Thread starter Thread starter irishetalon00
  • Start date Start date
  • Tags Tags
    Rotation
Click For Summary
SUMMARY

The calculation for the angle formed by the rotated x-axis in a 3D plot using MATLAB involves understanding rotation matrices and the effects of non-equal axes. The user initially rotated the viewpoint about the x-axis by -15 degrees and then about the original z-axis by 10 degrees. The discrepancy in the calculated angle was resolved by setting the axes to be equal in MATLAB, which aligned the calculated angle with the measured angle of -2.134 degrees. This highlights the importance of axis scaling in 3D visualizations.

PREREQUISITES
  • Understanding of 3D coordinate systems and right-hand rule
  • Familiarity with rotation matrices in linear algebra
  • Proficiency in MATLAB for 3D plotting
  • Knowledge of axis scaling and its impact on visual representation
NEXT STEPS
  • Learn about MATLAB's axis properties and how to set equal axes
  • Explore advanced rotation matrix applications in 3D graphics
  • Study the effects of different rotation orders on 3D transformations
  • Investigate the use of quaternions for 3D rotations in MATLAB
USEFUL FOR

Mathematics students, MATLAB users, 3D graphics developers, and anyone involved in visualizing spatial transformations in engineering or computer graphics.

irishetalon00
Messages
20
Reaction score
2

Homework Statement


I am working in Matlab, and have a 3D plot that I made:
ATTACH]

mkx2mt.png

IKX0GUG.png
x is parallel to axis labeled "lateral direction (m)"
y is parallel to axis labeled "long. dir. (m)"
z is normal to these (right hand coordinate sytem)

The original view was looking parallel with +y. To get the current view, I rotated our viewpoint about the x-axis -15 degrees, then rotated about the ORIGINAL z axis 10 degrees.

How do I calculate the angle that the x-axis now forms on the page?

For comparison, I used image editing software to measure the angle of the axis. It is a rectangle 12 high, 322 wide, so the angle is -2.134 deg.

Homework Equations

The Attempt at a Solution


I attempted to do rotation matrices. I did:
phi = -15deg
theta = 10deg

A =
[cos(theta) sin(theta) 0;
-sin(theta) cos(theta) 0;
0 0 1]

B =
[1 0 0;
0 cos(phi) -sin(phi);
0 sin(phi) cos(phi)]

B*A =
[ cos(theta), cos(phi)*sin(theta), -sin(phi)*sin(theta);
[ -sin(theta), cos(phi)*cos(theta), -cos(theta)*sin(phi);
[ 0, sin(phi), cos(phi)]

And do get the angle that the original x-axis forms with our new viewpoint, I do

r =
[1;
0;
0]

then do:
B*A*r

and I get:
[cos(theta);
-sin(theta);
0]

Which does not give me a correct result. Not only that, there is no way that a rotation in two different axes does not depend on both theta and phi.
 

Attachments

  • mkx2mt.png
    mkx2mt.png
    20.1 KB · Views: 254
Last edited:
Physics news on Phys.org
I made a mental faux pas. The reason for the discrepancy is that the axes in MATLAB are not equal by default. Once I set the axes to be equal, my calculated angle matches the measured axis angle.
 

Similar threads

Replies
4
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 11 ·
Replies
11
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
Replies
1
Views
1K
  • · Replies 2 ·
Replies
2
Views
2K