How can I sepearte these two spehrical Objects - Earth and Moon - to get one Moon and one Earth? So far I get two Moon's or either two Earth

조회 수: 2 (최근 30일)
I tried to plot the Earth and the Moon, but I failed. Each sphere has his own Topography and here is the problem. When I run the Project the two sphere's have the topography of the Moon. How can i separate these two functions to get a sphere with the look of the Earth and the other sphere as the moon?
close all
%%create sphere
[X,Y,Z] = sphere;
%% combines Earth topography and sphere
%earth gets a jpg file to get the look of the earth
earth = imread('');
h2 = findobj('Type','surface');
axis equal
%% second sphere
hold on
r = 7,22;
X2 = X * r;
Y2 = Y * r;
Z2 = Z * r;
%% combines the second sphere with Moon topography
moon = imread('')
h = findobj('Type','surface');
axis equal
%%Earth and Moon spins
El = 24;
for Az = 0:360

채택된 답변

Prudhvi Peddagoni
Prudhvi Peddagoni 2020년 12월 29일
When you are executing the below line, It is returning both the Earth's surface plot and Moon's surface plot. So you are editing both surface plots when you edit the object h.
h = findobj('Type','surface');
Instead of using find function, you can directly store the output of surf function as h2 and h variables in this case.
h2 = surf(X,Y,Z)
h = surf(X2+15,Y2-15,-Z2)
Hope this helps.
  댓글 수: 1
Syntax 2020년 12월 29일
Mate, thank you so much!! I have been wondering for so long, how I can solve this problem. Now it is fixed and works perfectly! Thank you.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)


Help CenterFile Exchange에서 Earth and Planetary Science에 대해 자세히 알아보기


Community Treasure Hunt

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

Start Hunting!

Translated by