作为我目前正在进行的项目的一部分,我必须解决围绕地球轨道运行的国际空间站的双体问题。到目前为止,我已经设法通过使用球体/冲浪功能来近似这个,但是,我想知道是否有任何方法可以创建一个代表国际空间站的更逼真的数字?不幸的是,这个项目必须完全通过MATLAB完成,所以我不能使用任何其他可以提供更好可视化的工具
NASA拥有许多物体的3D模型,包括ISS,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]);
然后,您可以使用新的顶点位置更新对象,因为工作站会绕地球运行。显然,您还可以通过将顶点乘以某个量来缩放对象。如果您不希望绘制构面边缘,还可以将'EdgeAlpha', 0
添加到patch
选项中。
这是一个简单的例子,显示围绕球体的ISS轨道运行
% 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)
end