Mesh with griddata, how eliminate undesidered extra surface

8 visualizaciones (últimos 30 días)
Francesco Marconcini
Francesco Marconcini el 10 de En. de 2021
Respondida: Star Strider el 10 de En. de 2021
I wanted to create a surface that best approximate the distribution of the points in the figure. I tried using griddata but when i try to use mesh it come out another planar surface that "fill" the concave part of the points distribution. There is a way to eliminate this surface?.
There it is my script:
x=etaT_data; %vector 1xn
y=P_data; %vector 1xn
z=Isp_data; %vector 1xn
%% Points in space
plot3(x',y',z','.','markersize',12);
hold on
%% Interpolating surface
[xi,yi] = meshgrid(linspace(min(x),max(x),100) , linspace(min(y),max(y),100));
zi = griddata(x,y,z,xi,yi);
mesh(xi,yi,zi);
Thanks!!

Respuestas (2)

Cris LaPierre
Cris LaPierre el 10 de En. de 2021
You can set those points equal to NaN.
z=peaks(25);
z(12:18,:)=NaN;
surf(z)
  2 comentarios
Francesco Marconcini
Francesco Marconcini el 10 de En. de 2021
I can't cancel the mesh in an interval as in your example, because the extra surface is a portion of a 3D plan (a sort of circular segment).
Cris LaPierre
Cris LaPierre el 10 de En. de 2021
Editada: Cris LaPierre el 10 de En. de 2021
Sure, you'll have to figure out how to identify the points. Once you do, you can set them to NaN so they are not included in the mesh. You haven't shared enough info for us to be able to help with that.

Iniciar sesión para comentar.


Star Strider
Star Strider el 10 de En. de 2021
Without your data, posting an exact solution (if one even exists) is not possible.
One possibility is that your data are actually gridded, and in that instance, simply reshaping them could be the solution. See for example why surface plot is connecting its edges? where reshaping the data was the appropriate approach.
One way to easily determine if your data are gridded would be to use stem3 rather than plot3, for example:
figure
stem3(x',y',z','.')
grid on
If your data are gridded, that will be readily apparent by the gridded nature of the stems. If they are not gridded, the stems will not be regular.

Categorías

Más información sobre Surface and Mesh Plots en Help Center y File Exchange.

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by