scatterInterpolant doesn't work

3 visualizzazioni (ultimi 30 giorni)
Tianshu Yu
Tianshu Yu il 9 Lug 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');
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

Risposte (0)

Categorie

Scopri di più su Contour Plots in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by