Re: How to fit like-elliptical funcion?
- To: mathgroup at smc.vnet.net
- Subject: [mg51563] Re: How to fit like-elliptical funcion?
- From: koopman at sfu.ca (Ray Koopman)
- Date: Sat, 23 Oct 2004 00:21:44 -0400 (EDT)
- References: <cl9s12$7f1$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
kras at iwm.fhg.de (Andriy Krasowsky) wrote in message
news:<cl9s12$7f1$1 at smc.vnet.net>...
> does anyone knows how to fit an equation like
> (x/P1)**a + (y/P2)**b = 1
> on data which are in the first quadrant? P1, P2, a, b are to fit.
I assume you mean (x/P1)^a + (y/P2)^b = 1.
Let {x,y} be a 2 by n matrix. For fixed a & b, let
w = {x^a,y^b}; c = w.Transpose@w; t = Tr/@w .
Then taking
{P1^-a,P2^-b} == {p,q} = LinearSolve[c,t]
gives a least-squares fit. The residual sum of squares is
n - t.{p,q} .
Minimize it as a function of a & b, then take
{P1,P2} = {p^(-1/a),q^(-1/b)} .
Note: to keep a & b positive, express them as E^alpha & E^beta
and minimize with respect to alpha & beta.