Index exceeds the number of array elements (1). Error coming in the code below
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi,
I am using one of the matlab function called CircleFitByTaubin but I am stuck on one of the line as shown in the error below and not sure how to correct this? If anyone can help here? I have attached the code, function and data here.
Error:
Index exceeds the number of array elements (1).
Error in CircleFitByTaubin (line 25)
Yi = XY(i,2) - centroid(2); % centering data
Error in circlefitting (line 9)
Par = CircleFitByTaubin(P);
댓글 수: 4
per isakson
2020년 10월 23일
But you have not told us how to use these three files to reproduce the error, which you have reported!
채택된 답변
per isakson
2020년 10월 23일
편집: per isakson
2020년 10월 23일
I cannot reproduce (on R2018b) the error that you report:
Index exceeds the number of array elements (1).
Error in CircleFitByTaubin (line 25)
Yi = XY(i,2) - centroid(2); % centering data
Error in circlefitting (line 9)
Par = CircleFitByTaubin(P);
You have not provided the mfunction, circlefitting. There is no call to CircleFitByTaubin in bestcirclefit.m. The mfile, bestcirclefit.m, has an syntax error and isn't possible to run.
CircleFitByTaubin works as expected:
%%
XY = dlmread('test1.txt','\t',0,0);
%%
par = CircleFitByTaubin(XY);
and returns
>> par
par =
0.41541 0.30058 0.028124
댓글 수: 5
per isakson
2020년 10월 24일
편집: per isakson
2020년 10월 24일
Search the File Exchange for fit ellipse. There are some submissions, which will help you earn the "plus point".
"to fit the points to the well defined shape" it's the other way round. One fits a model/equation/shape to data points.
And in the column to the right of this page there is an interesting link: Fitting Circles (again) and Ellipses
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Descriptive Statistics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!