```Path: news.mathworks.com!not-for-mail
From: "Steven_Lord" <slord@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: suppose I have an equation x^2+x+y^2+3*y=5*y^2+3*y+3*x*y+5 and I want to find the set of (x,y) that satisfy the equation.
Date: Thu, 12 Aug 2010 10:46:14 -0400
Organization: MathWorks
Lines: 43
Message-ID: <i411fm\$4e0\$1@fred.mathworks.com>
References: <i40rce\$qur\$1@fred.mathworks.com>
NNTP-Posting-Host: ah-slord0w.dhcp.mathworks.com
Mime-Version: 1.0
Content-Type: text/plain;
format=flowed;
charset="UTF-8";
Content-Transfer-Encoding: 7bit
X-Trace: fred.mathworks.com 1281624374 4544 172.31.44.22 (12 Aug 2010 14:46:14 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 12 Aug 2010 14:46:14 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
Importance: Normal
X-Newsreader: Microsoft Windows Live Mail 14.0.8089.726
X-MimeOLE: Produced By Microsoft MimeOLE V14.0.8089.726
Xref: news.mathworks.com comp.soft-sys.matlab:661427

news:i40rce\$qur\$1@fred.mathworks.com...
> Question
> How can i do that?
> I've been trying, solve, explot and subs.
> I can get the graph, but i cannot get the (x,y) pairs that I want.

What, specifically, do you want to obtain?  There are an infinite number of
(x, y) points that satisfy this equation.  One such pair is approximately
(3, -2.8615).

> When I use function solve to solve the equation in term of x or y and then
> substitute the numeric value for one of them to find the other, I got the
> problem about complex numer. This might be because that numeric value that
> I substitute is not the number that satisfy the equation, so the program
> give me the result in complex number.
>
> Background.
> I need to use the pairs to find the optimal value of my objective
> function.
> I tried to use the fmincon, but it gave me the optimal value that is not
> reliable, so i try to do it manually.
> Note that my equality constraint is in the form of the equation in the
> subject.

for easy quoting.

> I also have a couple of inequality constraints.

If you were just looking to identify the points that satisfy your equation
graphically, I would use CONTOUR.  Write your equation as z = f(x, y) and
look at the contour for z = 0.

--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ