Why does the rotate function let the body rotate around the wrong axis?
Show older comments
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
darova
on 25 Mar 2020
Why can't you just rotate data about X axis and the about Z?
Felix Richter
on 27 Mar 2020
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])
Answers (1)
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
on 30 Mar 2020
Categories
Find more on Geoscience 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!