Path: news.mathworks.com!not-for-mail From: <HIDDEN> Newsgroups: comp.soft-sys.matlab Subject: Re: finding complex root from nonlinear equations Date: Sat, 3 Jan 2009 22:49:01 +0000 (UTC) Organization: The MathWorks, Inc. Lines: 15 Message-ID: <gjoq0t$4h3$1@fred.mathworks.com> References: <046c08c7-878f-4967-bab1-41273a92bcbd@r2g2000vbp.googlegroups.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 1231022941 4643 172.30.248.38 (3 Jan 2009 22:49:01 GMT) X-Complaints-To: news@mathworks.com NNTP-Posting-Date: Sat, 3 Jan 2009 22:49:01 +0000 (UTC) X-Newsreader: MATLAB Central Newsreader 1187260 Xref: news.mathworks.com comp.soft-sys.matlab:509708 Mars creature <jinbow@gmail.com> wrote in message <046c08c7-878f-4967-bab1-41273a92bcbd@r2g2000vbp.googlegroups.com>... > Hi Matlab users, > I know fsolve can find the real roots from polynomial equations, but > I don't know how to find complex roots, like x^2+1=0. Also I have a > complicated nonlinear equation with complex coefficients to solve > numerically, anyone give me a hint where to find the instruction? > Thank you very much! > JB wang For polynomial equations the matlab function 'roots' will find all roots, complex or real. For general nonlinear equations, Mathworks' advice in their 'fsolve' documentation is "fsolve only handles real variables. When x has complex variables, the variables must be split into real and imaginary parts." Presumably this splitting would also apply to the values in the function F(x) to be zero-ed. Its real and imaginary parts could be brought to zero as separate elements of the F(x) vector. In effect you would be doubling the number of unknowns and the number of equations. As to finding all possible roots, 'fsolve' only promises to find one root. However that can be manipulated by selecting differing starting values on different calls to 'fsolve'. That might be easier said than done, though. Roger Stafford