MATLAB - 从三维散点图数据绘制平滑的体积

时间:2015-04-10 08:17:12

标签: matlab volume surface

所以我有[x y z strength]形式的数据,我用xyz轴绘制在scatter3图上。数据的颜色用于指示强度值。问题是,使用散点图意味着数据点显示为离散点。我需要的是一个平滑的形状 - 所以我想我需要在点之间进行某种插值?

我尝试过使用trisurf,但这个问题的一个问题就是它在点之间进行插值。所以我的表面应该有“间隙”,它会连接边缘而不是填补空隙。请参阅随附的图片以获得澄清。

有人有任何建议吗?

我使用的代码如下(注释掉的scatter3是散点图,其余的是trisurf):

% Read in data
dataM = csvread('3dDispersion.csv');

% scatter3(dataM(:,1), dataM(:,2), dataM(:,3), 5, dataM(:,4),'filled');

% Plot
hold on;
x = dataM(:,1);
y = dataM(:,2);
freq = dataM(:,3);
tri = delaunay(x,y);
h = trisurf(tri, x, y, freq);

% Make it pretty
% view(-45,30);
view(3);
axis vis3d;
lighting phong;
shading interp;

The scatter plot

The trisurf plot

1 个答案:

答案 0 :(得分:0)

在Matlab中使用K = boundary(X,Y,Z,0.9函数。这将在您的点上应用类似于收缩包装的网格。为了减少“间隙闭塞器”,您需要增加“缩小系数”。

尝试trimesh

X,Y& Z是数据点的向量

https://www.mathworks.com/help/matlab/ref/boundary.html

然后,您可以使用# On your controller. respond_to :docx # filename and word_template are optional. By default it will name the file as your action and use the default template provided by the gem. The use of the .docx in the filename and word_template is optional. def my_action # ... respond_with(@object, filename: 'my_file.docx', word_template: 'my_template.docx') # Alternatively, if you don't want to create the .docx.erb template you could respond_with(@object, content: '<html><body>some html</body></html>', filename: 'my_file.docx') end def my_action2 # ... respond_to do |format| format.docx do render docx: 'my_view', filename: 'my_file.docx' # Alternatively, if you don't want to create the .docx.erb template you could render docx: 'my_file.docx', content: '<html><body>some html</body></html>' end end end 或相关的曲面绘图功能,具体取决于您希望如何显示它。