フィルターのクリア

How to remove a 3d-Surface matrix entries outside of a 2D area/Curve?

1 回表示 (過去 30 日間)
Garvit Amipara
Garvit Amipara 2021 年 6 月 8 日
コメント済み: Garvit Amipara 2021 年 6 月 11 日
Hello lovely Mathworks members,
( I tried to find similar question but could not find any, so excuse me if there is already existing answer please share the link)
There is a 3D surface matrix which has some entries outside of a curve area and I want to remove the 3D matrix entries outside of a 2D curve. Can someone please help to understand how to remove the outside of curve entries of the 3D matrix. In attachmnet you will find both 2D and 3D matrices.
Best Regards!

採用された回答

KSSV
KSSV 2021 年 6 月 8 日
編集済み: KSSV 2021 年 6 月 9 日
You hvae to use inpolygon. Read about it.
load('3D_XYZ_Data.mat') ;
load('2D_RestrictedArea.mat') ;
X = XYZ_Data(:,1) ;
Y = XYZ_Data(:,2) ;
Z = XYZ_Data(:,3) ;
x = Restricted_Area(:,1) ;
y = Restricted_Area(:,2) ;
idx = inpolygon(X,Y,x,y) ; % get points lying inside the restricted points
plot3(X(idx),Y(idx),Z(idx),'.r')
hold on
plot(x,y,'.b')
view(2)
  3 件のコメント
KSSV
KSSV 2021 年 6 月 9 日
Hey actually code works fine. You need not to use boundary. I am edititng the code. You should get fine result now.
Garvit Amipara
Garvit Amipara 2021 年 6 月 11 日
Amazing!! Works perfectly. Thank you so much<3

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

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by