Effacer les filtres
Effacer les filtres

scatterInterpolant doesn't work

2 vues (au cours des 30 derniers jours)
Tianshu Yu
Tianshu Yu le 9 Juil 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

Réponses (0)

Catégories

En savoir plus sur Contour Plots dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by