MATLAB Answers

scatterInterpolant doesn't work

1 view (last 30 days)
Tianshu Yu
Tianshu Yu on 9 Jul 2019
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');
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);
hold on
legend('Sample Points','Interpolated Surface','Location','NorthWest')
hold off


Sign in to comment.

Answers (0)


Community Treasure Hunt

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

Start Hunting!