scatterInterpolant doesn't work

3 次查看(过去 30 天)
Tianshu Yu
Tianshu Yu 2019-7-9
I have a tetrahedral mesh. I want to plot a contour of its surface. I first test it on a mesh. But the scatterInterpolant return me some nonsense. Below is my code. I also include the picture of the interpolated surface and the pdeplot.
See, that is far from a smooth surface. I don't know why. If anyone know how to generate a contour out of this scatter plot I would be very grateful.
Below is the code. I have save the meshobject in the meshdata.mat, which is attached above.
model = createpde;
importGeometry(model, 'virus_3.stl');
figure(1)
pdegplot(model,'FaceLabels','on')
meshobject = generateMesh(model);
nodes = meshobject.Nodes;
nodesID = findNodes(meshobject, 'region', 'Face', [3, 7]);
surfNodes = nodes(:, nodesID);
surfNodes = surfNodes';
F = scatteredInterpolant(surfNodes(:,1),surfNodes(:,2),surfNodes(:,3));
[xq,yq] = meshgrid(0:12, 0:12);
F.Method = 'natural';
vq2 = F(xq,yq);
figure(2)
plot3(surfNodes(:,1),surfNodes(:,2),surfNodes(:,3),'mo')
hold on
mesh(xq,yq,vq2)
title('Linear')
legend('Sample Points','Interpolated Surface','Location','NorthWest')
hold off

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Contour Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by