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:
solving 2 functions

Subject: solving 2 functions

From: MICHAEL

Date: 13 Aug, 2010 14:56:08

Message: 1 of 2

i wanna find the cross points of 2 circles, but as a result i get complex number

need some help

X,Y are center coordinates vector (X for x position, Y for y position), R is a radius vector

function [x,y]=INTERSECT (X,Y,R)

syms x y x_center y_center r
eq=(x-x_center)^2+(y-y_center)^2-r^2;
x_center=X(1);
y_center=Y(1);
r=R(1);
eq1=subs(eq);

x_center=X(2);
y_center=Y(2);
r=R(1);
eq2=subs(eq);

[x,y]=solve(eq1,eq2);

Subject: solving 2 functions

From: Torsten Hennig

Date: 13 Aug, 2010 15:16:41

Message: 2 of 2

> i wanna find the cross points of 2 circles, but as a
> result i get complex number
>
> need some help
>
> X,Y are center coordinates vector (X for x position,
> Y for y position), R is a radius vector
>
> function [x,y]=INTERSECT (X,Y,R)
>
> syms x y x_center y_center r
> eq=(x-x_center)^2+(y-y_center)^2-r^2;
> x_center=X(1);
> y_center=Y(1);
> r=R(1);
> eq1=subs(eq);
>
> x_center=X(2);
> y_center=Y(2);
> r=R(1);

Maybe you mean r=R(2) here ?

> eq2=subs(eq);
>
> [x,y]=solve(eq1,eq2);

If the two circles do not cross, you will get
complex solutions for x and y.

Best wishes
Torsten.

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