How to plot a surf-plot without data extrapoation?

I would like to plot the same surf plot but without extrapolating on areas where are not scatter data.
The following script generates the attached figure.
The final plot should interpolate below the black line (only where data exists) like:

3 件のコメント

Star Strider
Star Strider 2020 年 12 月 3 日
I have no idea what you want to do, however:
X = griddata(y,z,x,Y,Z,'nearest');
C = griddata(y,z,c,Y,Z,'nearest');
may get you where I believe you want to go.
Philippe Corner
Philippe Corner 2020 年 12 月 3 日
編集済み: Philippe Corner 2020 年 12 月 3 日
Hi Star Strider, thanks for your help. I edited de question to clarify what I'm trying to do
Philippe Corner
Philippe Corner 2020 年 12 月 6 日
Hi Star Strider.. any idea about how to solve? if you are thinking on anything i'm sure it would be helpfull

サインインしてコメントする。

 採用された回答

KSSV
KSSV 2020 年 12 月 4 日

0 投票

You have the black line in hand.. make a closed polygon out of it and get the indices of the points lying inside and outside using inpolygon. From the data matrix, make the points lying outside NaN.

6 件のコメント

Philippe Corner
Philippe Corner 2020 年 12 月 4 日
Hi KSSV, thanks for your suggestion. The thing is that, there is no data above the black line. As yous see in the black scatter, we only have data below the black line. Surf plot is filling some space above de existing data. That's why I would like find a way to use surf only covering existing data. Moreover, I cant use a patch above the black line, because I have more surf plots close to this one and they may be cover by a white patch or polygon.
Do you think that may be a way to use like a boundary using the black line for the surf function?
Philippe Corner
Philippe Corner 2020 年 12 月 6 日
編集済み: Philippe Corner 2020 年 12 月 6 日
Hi man, I've been thinking a lot on this.. do you have any idea about how to proceed?
KSSV
KSSV 2020 年 12 月 7 日
Pick the values which lie above the black line and make the repsecitve values NaN...
Philippe Corner
Philippe Corner 2020 年 12 月 7 日
編集済み: Philippe Corner 2020 年 12 月 7 日
Man, but I think I'm not undestanding you. There are no values above the black line.. you can see it in the scatter plot. That is actually the reason im trying to delete the interpolation of surf function above the line..
Philippe Corner
Philippe Corner 2020 年 12 月 10 日
I solved it with you advice. Thanks KSSV
Philippe Corner
Philippe Corner 2021 年 8 月 8 日
編集済み: Walter Roberson 2021 年 8 月 8 日
Hello KSSV, could you check this question? I think you may help me to find the best way to solve it.. https://it.mathworks.com/matlabcentral/answers/894752-how-to-assign-values-to-a-mesh-based-on-xyzc-points

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

タグ

質問済み:

2020 年 12 月 3 日

編集済み:

2021 年 8 月 8 日

Community Treasure Hunt

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

Start Hunting!

Translated by