Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: linear regression with a nonlinear constraint
Date: Wed, 12 Mar 2008 06:20:03 +0000 (UTC)
Organization: Inst of Thermomechanics AS CR
Lines: 31
Message-ID: <fr7smj$ql9$1@fred.mathworks.com>
References: <fr6t5q$648$1@fred.mathworks.com>
Reply-To: <HIDDEN>
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 1205302803 27305 172.30.248.38 (12 Mar 2008 06:20:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 12 Mar 2008 06:20:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 79193
Xref: news.mathworks.com comp.soft-sys.matlab:456704



"Santiago Mazuelas" <mazuyo@hotmail.com> wrote in message
<fr6t5q$648$1@fred.mathworks.com>...
> I have a linear regression problem in which the variables 
> X,Y,Z are related by
>  
> Z=aX+bY+c
> 
> but a I have the nonlinear constraint c=a^2+b^2
> 
> Anybody can tell me how to solve this problem? 

Hi

Try function LMFnlsq

http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=17534&objectType=FILE

to obtain least squares solution by calling

res = @(ab) X*ab(1)+Y*ab(2)+ab(1)^2+ab(2)^2-Z; 
x = LMFnlsq(res,x0);

where x0 is the inoitial guess of the solution, x(1)=a  and
x(2)=b.

I hope it helps.

Mira