Mesh with griddata, how eliminate undesidered extra surface

7 次查看(过去 30 天)
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!!

回答(2 个)

Cris LaPierre
Cris LaPierre 2021-1-10
You can set those points equal to NaN.
z=peaks(25);
z(12:18,:)=NaN;
surf(z)
  2 个评论
Francesco Marconcini
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 2021-1-10
编辑:Cris LaPierre 2021-1-10
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.

请先登录,再进行评论。


Star Strider
Star Strider 2021-1-10
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.

类别

Help CenterFile Exchange 中查找有关 Surface and Mesh Plots 的更多信息

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by