How can i make my esphere (lua "moon in english") rotate in my earth ?

1 view (last 30 days)
clearvars;
set(0,'defaultTextInterpreter','latex');
set(groot, 'defaultAxesTickLabelInterpreter','latex')
set(groot, 'defaultLegendInterpreter','latex');
oLua = [4;4;4];
esc = 8;
% figure(1);
% xx = [0 0]; yy = [0 0]; zz = [-2*oLua 2*oLua];
% plot3(xx,yy,zz,'LineWidth',2); hold on; grid on;
% plot3(xx,zz,yy,'LineWidth',2);
% plot3(zz,yy,xx,'LineWidth',2);
% xlabel('$x$'); ylabel('$y$'); zlabel('$z$');
rLua = 2;
phi = 0:15:180;
theta = 0:15:360;
[theta,phi] = meshgrid(theta,phi);
LUA(3,25*13) = 0;
X = rLua .* sind(phi) .* cosd(theta);
Y = rLua .* sind(phi) .* sind(theta);
Z = rLua .* cosd(phi);
LUA(3,25*13) = 0; kk = 1;
for ii=1:13
for jj=1:25
LUA(:,kk) = [X(ii,jj);...
Y(ii,jj);...
Z(ii,jj)];
kk = kk + 1;
end
end
LUA = LUA + oLua;
for ang=0:5:360
LUA2 = rotacaoZ(LUA,ang);
scatter3(LUA2(1,:),LUA2(2,:),LUA2(3,:),2);
view([-13.8 24.9]);
axis([-esc esc -esc esc -esc esc]);
drawnow;
end
hold off;
function w = rotacaoZ(v,alpha)
Rot = [cosd(alpha) sind(alpha) 0 ;
-sind(alpha) cosd(alpha) 0 ;
0 0 1 ];
w = Rot * v;
end
  6 Comments
Rik
Rik on 14 Sep 2020
Ok. What do you expect from me? Help me to help you. Give details about what you tried and why. Explain what specific functions you have trouble with and what specific problems you need help to solve. Currently I can only respond like this:
I try hard to help you, but I can't do it.

Sign in to comment.

Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!