作为我目前正在进行的一个项目的一部分,我必须解决国际空间站绕地球运行的两体问题。到目前为止,我已经设法通过使用sphere/surf函数来近似这一点,然而,我想知道是否有任何方法可以创建一个更逼真的代表国际空间站的图形?不幸的是,这个项目必须完全通过MATLAB来完成,所以我不能使用任何其他工具来提供更好的可视化效果。
发布于 2019-04-15 23:22:31
美国宇航局有许多物体的3D模型,包括国际空间站,which can be found here。这个文件可以转换成你想要的STL格式,我找到了适合我的this random website。
在Matlab中,您可以通过以下方式读取此文件
stl = stlread('isscombined.stl');
V = stl.Points;
F = stl.ConnectivityList然后,可以使用以下命令对其进行绘图
p = patch('vertices',V,'faces',F,'FaceColor',[.8 .8 .8]);然后,当空间站绕地球运行时,您可以使用新的顶点位置更新对象。显然,您还可以通过将顶点乘以一定数量来缩放对象。如果不想绘制镶嵌面的边缘,也可以在patch选项中添加'EdgeAlpha', 0。
这是一个简单的例子,展示了国际空间站围绕一个球体运行
% Note: not to scale
ISS_radius = 2; % distance from center of Earth
RE = 1; % radius of earth
theta = 0:.05:2*pi;
x = ISS_radius*cos(theta);
y = ISS_radius*sin(theta);
stl = stlread('isscombined.stl');
r = .01; % scaling factor
V = stl.Points * r;
V = V - mean(V); % center at origin
F = stl.ConnectivityList;
figure; hold on;
plot3(x,y,zeros(numel(theta)),'--');
[X,Y,Z] = sphere(50);
surf(RE*X,RE*Y,RE*Z,'FaceColor',[0 0 .8],'EdgeAlpha',0);
p = patch('Vertices', V*r, 'Faces', F, 'FaceColor', [0 0 0], 'EdgeAlpha', 0);
axis equal;
set(gca,'View',[200 13])
grid on;
counter = 1;
while true
p.Vertices = V + [x(counter), y(counter), 0];
pause(0.01);
drawnow
counter = mod(counter + 1, numel(theta)) + 1;
axis([-1 1 -1 1 -1 1]*ISS_radius*1.2)
endhttps://stackoverflow.com/questions/55691298
复制相似问题