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 Center および File ExchangeSurface 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