我怎样才能让地球绕着它在matlab中的轴旋转?
How can I make the Earth rotate around it's axis in matlab?
所以我想表示地球从一个 tspan 开始旋转数秒,因为我知道完整的旋转发生在 86160 秒内。这意味着在 239.33 秒内,地球旋转了一个度数。问题是我不知道如何以正确的方式使用旋转命令。
这是代码:
tspan=[0 :72000];
[X,Y,Z]=sphere(50);
R=6400000;
earth = imread('earth.jpg');
globe= surf(-X*R,Y*R,-Z*R);
image_file='earth.jpg';
cdata = imread(image_file);
set(globe, 'FaceColor', 'texturemap', 'CData', cdata, 'EdgeColor', 'none');
set(gcf,'Color','k')
set(gca, 'visible', 'off')
axis equal
view (90,0)
rotating=1; % 1 degree ever 239.33 seconds from tspan
rotate(earth, [0 1 0],1) % test to see if it's working
不旋转地球,而是使用view
旋转相机,试试
...
axis equal
for n=0:90
view(90+n,0)
pause(1)
end
所以我想表示地球从一个 tspan 开始旋转数秒,因为我知道完整的旋转发生在 86160 秒内。这意味着在 239.33 秒内,地球旋转了一个度数。问题是我不知道如何以正确的方式使用旋转命令。 这是代码:
tspan=[0 :72000];
[X,Y,Z]=sphere(50);
R=6400000;
earth = imread('earth.jpg');
globe= surf(-X*R,Y*R,-Z*R);
image_file='earth.jpg';
cdata = imread(image_file);
set(globe, 'FaceColor', 'texturemap', 'CData', cdata, 'EdgeColor', 'none');
set(gcf,'Color','k')
set(gca, 'visible', 'off')
axis equal
view (90,0)
rotating=1; % 1 degree ever 239.33 seconds from tspan
rotate(earth, [0 1 0],1) % test to see if it's working
不旋转地球,而是使用view
旋转相机,试试
...
axis equal
for n=0:90
view(90+n,0)
pause(1)
end