Thread Subject: Intersection between line and half-circle

Subject: Intersection between line and half-circle

From: Catherine Szeto

Date: 8 Nov, 2009 05:37:01

Message: 1 of 3

How do I find the intersections between a line and a circle? If I do it by hand, I end up with:

y = mx +b (line equation)
(x-h)^2 + (y- k)^2 = r^2 (circle equation)

do some algebra...

(x-h)^2 + (mx + b - k )^2 = r^2

(x-h)^2 = r^2 - (mx +b -k)^2

How do I make Matlab get x for me?

Subject: Intersection between line and half-circle

From: Rune Allnor

Date: 8 Nov, 2009 08:34:42

Message: 2 of 3

On 8 Nov, 06:37, "Catherine Szeto" <catsz...@gmail.com> wrote:
> How do I find the intersections between a line and a circle? If I do it by hand, I end up with:
>
> y = mx +b (line equation)
> (x-h)^2 + (y- k)^2 = r^2   (circle equation)
>
> do some algebra...
>
> (x-h)^2 + (mx + b - k )^2 = r^2
>
> (x-h)^2 = r^2 - (mx +b -k)^2
>
> How do I make Matlab get x for me?

1) Write out the expression as a 2nd order polynomial in x
2) Write out the standard formula for solving 2nd order
   polynomials
3) Find the numbers that go into the formulas
4) Have matlab compute the answers from the formulas and
   numbers

Rune

Subject: Intersection between line and half-circle

From: Cat

Date: 9 Nov, 2009 02:58:01

Message: 3 of 3

Rune Allnor <allnor@tele.ntnu.no> wrote in message <0727aeb3-86d2-42f3-b629-4fb12f55a557@d5g2000yqm.googlegroups.com>...
> On 8 Nov, 06:37, "Catherine Szeto" <catsz...@gmail.com> wrote:
> > How do I find the intersections between a line and a circle? If I do it by hand, I end up with:
> >
> > y = mx +b (line equation)
> > (x-h)^2 + (y- k)^2 = r^2 ? (circle equation)
> >
> > do some algebra...
> >
> > (x-h)^2 + (mx + b - k )^2 = r^2
> >
> > (x-h)^2 = r^2 - (mx +b -k)^2
> >
> > How do I make Matlab get x for me?
>
> 1) Write out the expression as a 2nd order polynomial in x
> 2) Write out the standard formula for solving 2nd order
> polynomials
> 3) Find the numbers that go into the formulas
> 4) Have matlab compute the answers from the formulas and
> numbers
>
> Rune

Thanks, I got it working. Turns out I was using a function wrong.

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com