```Path: news.mathworks.com!not-for-mail
From: "Bruno Luong" <b.luong@fogale.findmycountry>
Newsgroups: comp.soft-sys.matlab
Subject: Re: How to solve this non-convex quadratically constrained quadratic programming
Date: Thu, 19 Apr 2012 12:25:07 +0000 (UTC)
Organization: FOGALE nanotech
Lines: 13
Message-ID: <jmp073\$1ac\$1@newscl01ah.mathworks.com>
References: <3072521.689.1334707719706.JavaMail.geo-discussion-forums@ynmm9> <jmljp0\$jbi\$1@newscl01ah.mathworks.com> <16329087.1512.1334757550839.JavaMail.geo-discussion-forums@ynmm10> <jmofmi\$q63\$1@newscl01ah.mathworks.com>
Reply-To: "Bruno Luong" <b.luong@fogale.findmycountry>
NNTP-Posting-Host: www-06-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1334838307 1356 172.30.248.38 (19 Apr 2012 12:25:07 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 19 Apr 2012 12:25:07 +0000 (UTC)
Xref: news.mathworks.com comp.soft-sys.matlab:765164

David is correct in many points.

1) The intersection of the two spheres is a sphere of dimension - 1. So the problem can reduce to two independent maximization with constraint 1, constraint 2, constraint 1 & 2.

2) The method is based on Lagrange multiplier

3) To change minimization to maximization, change the line #51 of spherelsq.m (FEX mentioned above) to

lambda = max(lambda);

That is it!

Bruno
```