?? try_circ_fitgai.m
字號:
% 寫入一組數(shù)據(jù)x,y
% 畫出這些數(shù)據(jù)在坐標(biāo)面的圖形
% 用circfit擬合出圓心和半徑
%
% 圓心(xc,yc)
th = linspace(0,2*pi,200)';
x = [
3.105240816627634
3.842272217109386
4.525109412571643
4.96516054383299
5.430063015752501
5.471623959289557
5.267638746605347
4.784779535235192
4.181448065548226
3.414805511294115
2.611546942222702
1.76837538915662
1.190624549998018
0.734772000988176
0.529409901608607
0.573251513927203
0.931228586186639
1.553030706664068
2.144382787294432
2.955908335236294
];
y = [
0.483220848230414
0.313229622700572
-0.049357854133657
-0.631477912114776
-1.383100990158417
-2.273182533554851
-3.029403407318204
-3.668280076348937
-4.210646067620194
-4.45883747500716
-4.418508513095978
-4.255411054624004
-3.696381518302045
-2.999380429206509
-2.255829847208239
-1.487374575402619
-0.609257281218404
-0.024500186718258
0.390606916543935
0.510084467937848
];
plot(x,y,'o'), title(' measured points')
pause(1)
% 由以上數(shù)據(jù)擬合圓
[xc,yc,Re,a] = circfit(x,y);
xe = Re*cos(th)+xc; ye = Re*sin(th)+yc;
plot(x,y,'o',[xe;xe(1)],[ye;ye(1)],'-.'),
title(' measured fitted and true circles')
legend('measured','fitted')
text(xc-Re*0.9,yc,sprintf('center (%g , %g ); R=%g',xc,yc,Re))
xlabel x, ylabel y
axis equal
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -