Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Circumscribing circles

Subject: Circumscribing circles

From: Joshua

Date: 18 Nov, 2010 06:23:03

Message: 1 of 3

My problem is using matlab I need to write a function
function [xc,yc,r]=circumcirc(A,B,C)
that computes both the center and radius of the circle containing the three points A,B, and C and then plots the triangle and the circumscribing circle on the samel plot.
I am stuck on where to begin. I know that a circle is given by the equation
x^2+y^2+ax+by=c, but not sure what to do with that using matlab. any help would be greatly appreciated.

Subject: Circumscribing circles

From: ImageAnalyst

Date: 18 Nov, 2010 11:41:12

Message: 2 of 3

Just use the line() function to draw lines between your three points
to create your triangle. Also search the newsgroup for "circle" - I'm
certain that code for drawing a circle from 3 points has been given
many times before.

Subject: Circumscribing circles

From: Roger Stafford

Date: 18 Nov, 2010 19:00:07

Message: 3 of 3

"Joshua " <jtnciolet@wichita.edu> wrote in message <ic2go7$74h$1@fred.mathworks.com>...
> .......
> that computes both the center and radius of the circle containing the three points A,B, and C ........
> ......
- - - - - - - - - - - -
  Here is code that computes the center, (xc,yc), and radius, r, of the circle circumscribing the triangle with vertices (x1,y1), (x2,y2), and (x3,y3).

x21 = x2-x1; y21 = y2-y1;
x31 = x3-x1; y31 = y3-y1;
d21 = x21^2+y21^2;
d31 = x31^2+y31^2;
a4 = 2*(x21*y31-y21*x31);
xc = x1+(y31*d21-y21*d31)/a4;
yc = y1+(x21*d31-x31*d21)/a4;
r = sqrt(d21*d31*((x3-x2)^2+(y3-y2)^2))/abs(a4);

Roger Stafford

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us