Path: news.mathworks.com!not-for-mail
From: "Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Help needed with Non-Linear Least Square Fitting
Date: Thu, 15 May 2008 22:12:01 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 30
Message-ID: <g0icfh$f2l$1@fred.mathworks.com>
References: <g0i43e$n5i$1@fred.mathworks.com> <g0i4o4$2lt$1@fred.mathworks.com> <g0i5kc$pjn$1@fred.mathworks.com>
Reply-To: "Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1210889521 15445 172.30.248.38 (15 May 2008 22:12:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 15 May 2008 22:12:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:468723


"Nima Azar" <nimakev@yahoo.com> wrote in message <g0i5kc$pjn
$1@fred.mathworks.com>...
> Thanks Roger for your reply:
> 
> Here's the Function:
> v2 = -a &#8211; b*v1 &#8211; c*(v1)^2 + d[1+(e/2d)cos((16.745*g/v1) + 
> h)] Exp(-j/(v1)^2)
> 
> so basically g and h are to be found through fitting...and 
> I can get V1, V2 through measurments...
> 
> thanks for help.
-------------
  If you have the Optimization Toolbox, one way is to use 'fsolve'.

  In case you don't have that toolbox, I notice that the equation can be 
reformulated to look like this:

 A*g+h = B

where A and B are column vectors that depend on the various values of V1 
and V2.  This is done by solving for the cosine expression in terms of 
everything else and then taking the arccosine of both sides.  In this form it is 
a standard linear least squares problem for which you can use matlab's 
backslash operator.  You will have to ensure that the arccosine values you 
obtain in B lie in the appropriate angular range so that realistic values of g 
and h are obtained.

Roger Stafford