Mesh with griddata, how eliminate undesidered extra surface

조회 수: 8 (최근 30일)
Francesco Marconcini
Francesco Marconcini 2021년 1월 10일
답변: Star Strider 2021년 1월 10일
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
Francesco Marconcini 2021년 1월 10일
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