Path: news.mathworks.com!not-for-mail
From: "Chirag Dave" <chiragdave12@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Pls Help me to solve
Date: Sun, 8 Nov 2009 18:55:03 +0000 (UTC)
Organization: IIT Delhi
Lines: 70
Message-ID: <hd7467$8uj$1@fred.mathworks.com>
References: <hd1lmg$9g5$1@fred.mathworks.com> <2126357853.29693.1257594694977.JavaMail.root@gallium.mathforum.org>
Reply-To: "Chirag Dave" <chiragdave12@gmail.com>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1257706503 9171 172.30.248.35 (8 Nov 2009 18:55:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 8 Nov 2009 18:55:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1902255
Xref: news.mathworks.com comp.soft-sys.matlab:583387


Thanks Torsten for spending time to answer my question. By assuming square of the variable I could resolve the problem of getting complex number, but still in fsolve it asks for assuming some different initial guess and i changed intial guess no. of times but I couldn't solve it. The problem is getting converged at the point which is not root of the given problem---such sort of error I m getting all the time and it's asking for new initial guess 2 solve......What to do now?

Thank You



Torsten Hennig <Torsten.Hennig@umsicht.fhg.de> wrote in message <2126357853.29693.1257594694977.JavaMail.root@gallium.mathforum.org>...
> > Dear Readers
> > I m facing problem in solving set of nonliner
> > equations. Set contains 13 nonlinear equations and 13
> > variables. I've spent lots of time but unfortunately
> > couldn't solve it....
> > I've tried so far solve and fsolve commands.......
> > When I am using solve my computer gets hanged. And
> > fsolve is returning complex number which is
> > practically not possible......
> > 
> > I've made two files
> > 
> > 1st File:function file
> > 
> > function F=myfun(x)
> > F=[-22.47+log(x(1)/(x(1)+x(2)+x(3)+x(4)+x(5)+x(6)+x(7)
> > +x(8)+x(9)+x(10)))+(3*x(11))+(3*x(12))+(8*x(13));-24.8
> > 9+log(x(2)/((x(1)+x(2)+x(3)+x(4)+x(5)+x(6)+x(7)+x(8)+x
> > (9)+x(10))))+x(12)+(2*x(13));-49.539+log(x(3)/((x(1)+x
> > (2)+x(3)+x(4)+x(5)+x(6)+x(7)+x(8)+x(9)+x(10))))+x(11)+
> > (2*x(12));-0.0574+log(x(4)/((x(1)+x(2)+x(3)+x(4)+x(5)+
> > x(6)+x(7)+x(8)+x(9)+x(10))))+(2*x(13));-24.597+log(x(5
> > )/((x(1)+x(2)+x(3)+x(4)+x(5)+x(6)+x(7)+x(8)+x(9)+x(10)
> > )))+x(11)+x(12);-0.7027+log(x(6)/((x(1)+x(2)+x(3)+x(4)
> > +x(5)+x(6)+x(7)+x(8)+x(9)+x(10))))+x(11)+(4*x(13));-32
> > .59+log(x(7)/((x(1)+x(2)+x(3)+x(4)+x(5)+x(6)+x(7)+x(8)
> > +x(9)+x(10))))+(2*x(11))+(2*x(12))+(4*x(13));-10.927+l
> > og(x(8)/((x(1)+x(2)+x(3)+x(4)+x(5)+x(6)+x(7)+x(8)+x(9)
> > +x(10))))+x(11)+x(12)+(4*x(13));-4.635+log(x(9)/((x(1)
> > +x(2)+x(3)+x(4)+x(5)+x(6)+x(7)+x(8)+x(9)+x(10))))+(2*x
> > (11))+(x(12))+(6*x(13));-7.5188+log(x(10)/((x(1)+x(2)+
> > x(3)+x(4)+x(5)+x(6)+x(7)+x(8)+x(9)+x 
> > (10))))+(2*x(11))+(x(12))+(4*x(13));3*x(1)+x(3)+x(5)+x
> > (6)+2*x(7)+x(8)+2*x(9)+2*x(10)-0.1002;3*x(1)+x(2)+2*x(
> > 3)+x(5)+2*x(7)+x(8)+x(9)+x(10)-1.6332;8*x(1)+2*x(2)+2*
> > x(4)+4*x(6)+4*x(7)+4*x(8)+6*x(9)+4*x(10)-3.3332] 
> > 
> > 
> > 2nd file: calls the function
> > 
> > clc
> > clear all
> > x0=[2;13;13;13;13;13;13;13;13;13;1;1;1]  %initial
> > guess
> > options=optimset('Display','iter');   % Option to
> > display output
> > [x,fval] = fsolve(@myfun,x0,options)  % Call
> > optimizer
> > 
> > It would be great help if u can give me some guidance
> > to solve it.....
> > 
> > 
> > Thank You
> 
> In order to avoid complex number solutions, you should
> be careful that you do not take the log of a negative
> number during iteration. Restrict your solution variables
> to be positive or solve in the squares of your solution 
> variables.
> 
> Best wishes
> Torsten.