Why does the rotate function let the body rotate around the wrong axis?

1 view (last 30 days)
Hello everyone,
I have a problem regarding the rotate fuction.
I want to rotate the earth (sphere function) around it's z-axis in a heliocentric coordinate system (HCI).
The problem is: The rotation occurs around the x-axis or any other point in space, even though i specifically defined as followed.
origin: earth-center in HCI
direction: point in north pole direction in HCI
Edit: Maybe this picture helps -> I want the body to rotate around the Z_J2000 vector, expressed in HCI-coordinates (co-planar to the ecliptic plane).
Thanks in advance!
My code looks something like this:
[x,y,z]= sphere; %Defining the sphere
%Load Image file to project on sphere
image_file_earth = 'pic/earth_mercator.jpg';
cdata_ea = imread(image_file_earth);
%Plot earth
earth = surf(x*r_earth+x_coord_earth_HCI,...
y*r_earth+y_coord_earth_HCI,...
z*r_earth+z_coord_earth_HCI,'some settings');
%Some settings
set(earth,'some settings');
%Define axis of rotation
Q_GCI = [0 0 1] %z-axis in GCI
%Coordinate transformation from geocentric to heliocentric
eps = 23.439 %"obliquity of the ecliptic"
T_eps = [1 0 0;...
0 cosd(eps) sind(eps);...
0 -sind(eps) cosd(eps);];
%Transformation matrix for rotation around geocentric x-axis
Q_HCI = xyz_coord_earth_HCI'+T_eps*Q_GCI;
%earth's position vector in heliocentric cs + rotated z-axis vector
rate = 10 %deg
%The rotation
rotate(earth,Q_HCI,rate,xyz_coord_earth_HCI);
  3 Comments
Felix Richter
Felix Richter on 27 Mar 2020
That is what i am trying to do. It just does not work.
And I am sure the coordinate transformation and therefore the rotation axis (Q_HCI) is right. The plot shows the axis is correctly defined.
But when i am trying to rotate the sphere-object about this axis, it rotates instead around the x-axis or any other point.
Now is my question: Am I using the rotate function wrong? I do understand the syntax as following:
rotate(object to rotate , one point in space (direction point) , angle of rotation , one point in space (origin point))
Am right about this?
darova
darova on 27 Mar 2020
What about this?
[X,Y] = meshgrid(-1:1);
Z = X*0;
h = surf(X,Y,Z);
rotate(h, [0 0 1], 10, [0 0 0])
rotate(h, [1 0 0], 10, [0 0 0])

Sign in to comment.

Answers (1)

David Goodmanson
David Goodmanson on 28 Mar 2020
Hello Felix,
this shold be (assuming that the object's center is at (0,0,0) )
tilt = 23.4;
rotationangle = 30; % for example
rotate(earth,[0 sind(tilt) cosd(tilt)],rotationangle)
You may have to change one or both of these angles to their negatives to get the right result.
  1 Comment
Felix Richter
Felix Richter on 30 Mar 2020
Hello David,
thanks for you answer!
Unfortunately the origin is not (0,0,0), but at a changing point in space (earth's center coasting through the solar system). The origin lies in the center of earth expressed in heliocentric coordinate system.
So:
axis_rot_geocentric = [0 0 1] -->
coordinate transformation -->
axis_rot_heliocentric = [0 0.3978 0.9175] + position_earth_in_heliocentric_cs
But:
The rotation just does not happen around this axis.

Sign in to comment.

Categories

Find more on Gravitation, Cosmology & Astrophysics in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!