Path: news.mathworks.com!not-for-mail
From: "John D'Errico" <woodchips@rochester.rr.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Solving equations
Date: Tue, 14 Jul 2009 02:06:02 +0000 (UTC)
Organization: John D'Errico (1-3LEW5R)
Lines: 43
Message-ID: <h3gp6a$i21$1@fred.mathworks.com>
References: <g8bugl$e7c$1@fred.mathworks.com> <g8dp5i$509$1@fred.mathworks.com> <g8hni0$klf$1@fred.mathworks.com> <g8hvvt$r50$1@fred.mathworks.com> <g8sd8u$koe$1@fred.mathworks.com> <h3fgoj$jtq$1@fred.mathworks.com>
Reply-To: "John D'Errico" <woodchips@rochester.rr.com>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1247537162 18497 172.30.248.37 (14 Jul 2009 02:06:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 14 Jul 2009 02:06:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 869215
Xref: news.mathworks.com comp.soft-sys.matlab:555193


"Miguel Torres" <gugugifo@yahoo.com> wrote in message <h3fgoj$jtq$1@fred.mathworks.com>...
> In order to solve your equations you need to solve it by the non-linear least-square methodology. In the link below you can find a brief mathematical description which will help you to solve your problem.
> 
> http://www.ndt.net/article/ewgae2004/pdf/l58schubert.pdf
> 
> Anyhow, you can solve this problem as well with the code provided by Prof. Balda (LMFnlsq function).
> 
> 
> Best regards,
> 
> Miguel Angel

NO. You do not need nonlinear least squares to solve
this.

While it looks like a nonlinear problem because of the
sqrt, or square terms, it turns out this is not necessary
at all.

There are three circles of known radii, all must have
the same (unknown) center. Call that center (x0,y0).

  (x0 - x1)^2 + (y0 - y1)^2 = r1^2
  (x0 - x2)^2 + (y0 - y2)^2 = r2^2
  (x0 - x3)^2 + (y0 - y3)^2 = r3^2

The only unknowns are x0 and y0. Expand and subtract.

  2*(x2 - x1)*x0 + 2*(y2 - y1)*y0 = r2^2 - r1^2 + x1^2 - x2^2
  2*(x3 - x1)*x0 + 2*(y3 - y1)*y0 = r3^2 - r1^2 + x1^2 - x3^2

You are left with two LINEAR equations in the two
unknowns. Solve. If you have noise in the data, one
option that I recall seems to help is to make it a
least squares problem. Generate the 3x2 linear system:

  2*(x2 - x1)*x0 + 2*(y2 - y1)*y0 = r2^2 - r1^2 + x1^2 - x2^2
  2*(x3 - x1)*x0 + 2*(y3 - y1)*y0 = r3^2 - r1^2 + x1^2 - x3^2
  2*(x3 - x2)*x0 + 2*(y3 - y2)*y0 = r3^2 - r2^2 + x2^2 - x3^2

Again, solve using backslash.

John