Calculating radius of circle

37 ビュー (過去 30 日間)
Robert Smith
Robert Smith 2017 年 9 月 6 日
回答済み: Image Analyst 2017 年 9 月 8 日
Looking for a simple function. I would like calculate radius of a circle using three points. anyone done this before or know a function that will do this?
  1 件のコメント
Jacob Ward
Jacob Ward 2017 年 9 月 6 日
What do you mean by three points? Will these points be along the circumference of the circle? Will one be the center of the circle?

サインインしてコメントする。

回答 (2 件)

Jacob Ward
Jacob Ward 2017 年 9 月 6 日
編集済み: Jacob Ward 2017 年 9 月 8 日
Using the following equation:
You have three unknowns: h, k, and r.
So you'll need to solve a system of three equations using your three different x-y pairs:
(x1 - h)^2 + (y1 - k)^2 = r^2
(x2 - h)^2 + (y2 - k)^2 = r^2
(x3 - h)^2 + (y3 - k)^2 = r^2
Solving this system of equations will give you r and MATLAB's solve(eqns,vars) command should do the trick.
Something like this:
syms h k r
eqns = [(x1-h)^2+(y1-k)^2==r^2,(x2-h)^2+(y2-k)^2==r^2,(x3-h)^2+(y3-k)^2==r^2];
S = solve(eqns, [h k r]);
radius = S.r(2);
The S.r(2) takes the second r solution because the first one is the negative of what you want, the second is the positive and desired solution.

Image Analyst
Image Analyst 2017 年 9 月 8 日

カテゴリ

Help Center および File ExchangeNumeric Solvers についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by