i need help make the earth in the center, and the moon (lua) rotation and translation

1 回表示 (過去 30 日間)
Ian Samuelsson
Ian Samuelsson 2020 年 9 月 14 日
編集済み: Geoff Hayes 2020 年 9 月 15 日
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
  1 件のコメント
Ian Samuelsson
Ian Samuelsson 2020 年 9 月 14 日
i'm stuck in this equation, and i don't know how to put the earth on center, can someone please help me ?

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeDialog Boxes についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by