Path: news.mathworks.com!not-for-mail
From: "Steve " <steveDEL.bachmeierDEL@yahoo.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: non-complex elements
Date: Sat, 9 Feb 2008 19:06:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 22
Message-ID: <foktiq$mvb$1@fred.mathworks.com>
References: <foj731$a8d$1@fred.mathworks.com> <foj8ce$r3v$1@fred.mathworks.com> <foja4h$l8g$1@fred.mathworks.com> <fojbqt$e8m$1@fred.mathworks.com> <fojemq$p29$1@fred.mathworks.com> <fokbh9$1of$1@fred.mathworks.com>
Reply-To: "Steve " <steveDEL.bachmeierDEL@yahoo.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 1202583962 23531 172.30.248.35 (9 Feb 2008 19:06:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 9 Feb 2008 19:06:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1034320
Xref: news.mathworks.com comp.soft-sys.matlab:450352



OK, thanks a lot; this seems to work.  How come I have to
eval() the vectors first before imag()==0 will work?

"Shaun " <s@s.com> wrote in message
<fokbh9$1of$1@fred.mathworks.com>...
> >> z = solve('3*x^4+7*x^3+7*x+3')
> z =
>    1/2*5^(1/2)-3/2
>   -3/2-1/2*5^(1/2)
>  1/3+2/3*i*2^(1/2)
>  1/3-2/3*i*2^(1/2)
> >> z = eval(z)
> z =
>   -0.3820          
>   -2.6180          
>    0.3333 + 0.9428i
>    0.3333 - 0.9428i
> >> z = z(imag(z)==0)
> z =
>    -0.3820
>    -2.6180