Mesh with griddata, how eliminate undesidered extra surface
7 views (last 30 days)
Show older comments
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!!
0 Comments
Answers (2)
Cris LaPierre
on 10 Jan 2021
You can set those points equal to NaN.
z=peaks(25);
z(12:18,:)=NaN;
surf(z)
2 Comments
Cris LaPierre
on 10 Jan 2021
Edited: Cris LaPierre
on 10 Jan 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.
Star Strider
on 10 Jan 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.
0 Comments
See Also
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!