# How to plot only the existing scattered interpolated data with slice function?

조회 수: 4(최근 30일)
Philippe Corner 15 Mar 2020
I'm trying this code for plotting an interpolation only where the data exits.
clc;clear all
N = 70;
figure()
xvec = linspace(min(X),max(X), N); yvec = linspace(min(Y),max(Y), N); zvec = linspace(min(Z),max(Z), N);
[xq, yq, zq] = meshgrid(xvec, yvec, zvec);
F = scatteredInterpolant(X,Y,Z,res); vq = F(xq, yq, zq);
xslice = []; yslice = []; zslice = [1542 1550];
slice(xq, yq, zq, vq, xslice, yslice, zslice)
hold on
scatter3(X,Y,Z,50,'filled','k');
box on
axis equal
But the results seems like:
As you see, the slice function plot the information on the specific iso-depth I need "zslice = [1542 1550];", but the plot is geeting both wider and larger extrapolation outisde the REAL DATA..
How could I only plot the iso-depth on the existing data depth? please see how I express the meaning of existing data: the 1550 slice is above data on the right and below on the left, it means that the interpolation only exists on the left. The 1540 slice exist on both left side and rigth side because is under the scatter data. Next figures show with a X the non-existing interpolation and with a check the existing: