How should I use the function Circfit ?
現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
古いコメントを表示
採用された回答
From the help section of that file,
% x,y are column vector where (x(i),y(i)) is a measured point
Their class are double.
They are column vectors of any length but must have the same length between x and y.
Demo
Here's a demo; see the inline comments to understand each step.
First, compute noisy circle coordinates for the demo.
% Create noisy circle coordinates
radius=3;
theta=linspace(0,2*pi,200);
theta(randi(numel(theta),1,190)) = []; % remove some data
x=radius*cos(theta);
y=radius*sin(theta);
% add noise
x = x + (rand(size(x))-0.5)*radius/4;
y = y + (rand(size(y))-0.5)*radius/4;
% Plot it
plot(x,y,'o')
axis equal
Do the fitting but you have to fill in the inputs. The reason I'm not telling you what the inputs should be is not to cause frustration but to get you to think about this. Again, the two inputs are column vectors of your x and y coordinates of each point you're fitting.
% Fit it
[xc,yc,R,a] = circfit(___, ___); % FILL IN THE INPUTS HERE
% [update: here's the solution: [xc,yc,R,a] = circfit(x, y);
Now you can use the outputs to compute the fitted circle and plot it.
% compute circle based on fit params
theta=linspace(0,2*pi,200);
xFit=R*cos(theta) + xc;
yFit=R*sin(theta) + yc;
% add fit
hold on
plot(xc,yc,'rx') % plot circle center
plot(xFit,yFit, 'r-')

9 件のコメント
farzad
2020 年 1 月 9 日
What length ? if I have to find the circumcircle of 3 points with their x and y , how do I write the command ?
x and y would be the x and y values of the 3 points. So, they would have length 3 if you only have 3 points.
Try it. If it doesn't work, show me what inputs you tried and I can help straighten it out.
farzad
2020 年 1 月 9 日
I'm asking if I have 3 coordinates what should I put instead of circLocs
[centerLoc, circleNormal, radius] = CircFit3D(circLocs)
should I do
[centerLoc, circleNormal, radius] = CircFit3D(x1,y1,x2,y2,x3,y3) ?
if not , please write the line, I don't get it from the incomplete documentation, and nothing on internet
Adam Danz
2020 年 1 月 9 日
The syntax is
[xc,yc,R,a] = circfit(x,y)
where x and y are column vectors describing the x and y points along the circumference.
You said you have 3 (x,y) coordinates. So x and y each have 3 elements.
I've gotten that from the documentation which I would not call 'incomplete'.
farzad
2020 年 1 月 9 日
what do you mean ? shall you please write it , how you understood ? are you sure it works ?
I don't understand your definitions, please write the line, why are you making me wait for longer time ?
I have already exhausted my guesses, if you know, why are you refraining ?
Adam Danz
2020 年 1 月 9 日
I've updated my answer, see the demo I've provided.
farzad
2020 年 1 月 9 日
why a vector? and how can the vector length be the same for different points?
I justice don't get it
Run my example. The x and y variables are vectors and together they are the coordinates of each noisy point along the cirlce. They are the variables you are fitting.
If you are only fitting 3 points, then your x vector will have 3 values (the x value for each point) and your y vector will have 3 values (the y value for each point).
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Language Support についてさらに検索
参考
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
