Novice question - XY vector of coordinates
Show older comments
Hi there!
I'm sorry for the noob question but I'm new to MatLab and my googling efforts to find an example on how to test this have turned out a blank.
I'm trying to test the CircleFitByTaubin function (<http://www.mathworks.co.uk/matlabcentral/fileexchange/22678-circle-fit-taubin-method>) but I keep getting the following error:
>> Taubin_Test
Newton-Taubin will not converge
Error using +
Matrix dimensions must agree.
Error in CircleFitByTaubin (line 93)
Par = [Center+centroid , sqrt(Center*Center'+Mz)];
Error in Taubin_Test (line 10)
CircleFitByTaubin(XY);
Now I'm sure my 40 points in the "raw" variable are radial measurements taken from a point inside a circle so they should most definitely converge!
This is my test code:
raw = [4.4250 4.4480 4.4120 4.3130 4.2770 4.2140 4.1560 4.0730 4.0420 3.9790 3.8800 3.8240 3.8180 3.8260 3.6920 3.6660 3.6470 3.6690 3.7000 3.7540 3.7280 3.7120 3.7200 3.6700 3.6990 3.7640 3.7950 3.8560 3.8820 3.9710 4.0070 4.0220 4.1060 4.1500 4.2020 4.2420 4.2730 4.3210 4.3360 4.3690];
angle =(linspace(360/length(raw),360,length(raw))).*(pi/180);
x_raw=((raw/2).*(cos(angle)));
y_raw=((raw/2).*(sin(angle)));
XY = [x_raw;y_raw];
CircleFitByTaubin(XY);
Any help would be greatly appreciated!
Answers (2)
Mau
on 26 Sep 2013
0 votes
Roger Stafford
on 26 Sep 2013
0 votes
'CircleFitByTaubin' expects an n x 2 array for its input, whereas you have a 2 x n array. You need to do a transpose on your input to get sensible results.
Categories
Find more on Web Services in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!