필터 지우기
필터 지우기

Error in delaunayTriangulation function

조회 수: 2 (최근 30일)
DDD
DDD 2017년 3월 31일
답변: Carl 2017년 4월 3일
Trying to implement the FEM i am using delaunayTriangulation to divide the space. I am getting an error:
Error using delaunayTriangulation
Invalid data format for delaunayTriangulation.
My code is:
X_select=[X_select;X_circulo'];
Y_select=[Y_select;Y_circulo'];
z=[X_select,Y_select];
figure(1)
plot ( z(:,1), z(:,2), 'b.','MarkerSize', 15 )
k = boundary(z,0.4);
hold on;
plot(X_select(k),Y_select(k),'g');
hold off
C=[X_select(k)';Y_select(k)'];
figure(2)
t = delaunayTriangulation(double(z),double(C));
triplot( t, z(:,1), z(:,2) );
the first section of the code is working properly.
What am i doing wrong?
Thanks in advance!
  댓글 수: 2
KSSV
KSSV 2017년 3월 31일
편집: KSSV 2017년 3월 31일
what are the sizes of double(z),double(C) which you are sending to function? Are these numbers valid? Without data it is not easy for us to get the error.
DDD
DDD 2017년 3월 31일
>> size(z)
ans =
489 2
>> size(C)
ans =
2 84
I have also updated the question with fig1

댓글을 달려면 로그인하십시오.

답변 (1개)

Carl
Carl 2017년 4월 3일
Hi DDD, the constrained edges must be passed in as a 2-column matrix. Additionally, the values of those columns should be IDs of the vertices that define each edge, not the (x,y) values of the vertices themselves. See the documentation here:
In your case, if you'd like to use the output of 'boundary' as constrained edges, you can construct C like so:
C=[k(1:end-1),k(2:end)];

카테고리

Help CenterFile Exchange에서 Delaunay Triangulation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by