For Programmers: Free Programming Magazines  


Home > Archive > Matlab > August 2007 > Re: Eigen Values









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Eigen Values
Bobby Cheng

2007-08-30, 4:29 am

Have you try D = (D+D')/2 ?
---Bob.

"Arash " <ahazeghi@gmail.com> wrote in message
news:fb4uek$g2h$1@fred.mathworks.com...
> Hi,
> I am trying to compute the eigenvalues of a 6X6 matrix D,
> which has complex elements with tiny phase factors. the
> matrix should be Hermitian, but apparently due to roundup
> errors the final matrix turns out to be non-Hermitian, I
> then manually subtract the non-Hermitian part (i.e.
> D(hermitian)=D-(D-D')/2)
> but surprisingly still I get eigenvalues with tiny imaginary
> parts. Also from Physics I know eigenvalues should be
> positive, however some eigenvalues that are close to zero
> turn out to be negative. I am using [v E]=eig(D) command I
> also used 'nobalance' flag with no success.
>
> Any suggestions?
>
> Regards,
> Arash



John D'Errico

2007-08-30, 8:15 am

"Bobby Cheng" <bcheng@mathworks.com> wrote in message <fb5dmi$f2u
$1@fred.mathworks.com>...
> Have you try D = (D+D')/2 ?
> ---Bob.


I wonder if the OP might think that these two
forms are mathematically identical,

(D+D')/2 == D-(D-D')/2)

while not realizing that they need not be equal
in the floating point world of Matlab.

D = randn(5);
(D+D')/2 == D-(D-D')/2
ans =
1 1 0 1 1
0 1 0 0 0
0 0 1 1 1
1 0 1 1 0
1 0 1 0 1

John
Arash

2007-08-30, 8:59 pm

John,
When I try your script I get all 1's:

1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1

I wonder if this has to do with default accuracy in matlab.
Is there a way to get rid of roundup errors from small phase
factors in matrix calculations?

Best,
Arash


"John D'Errico" <woodchips@rochester.rr.com> wrote in
message <fb6amk$evj$1@ginger.mathworks.com>...
> "Bobby Cheng" <bcheng@mathworks.com> wrote in message

<fb5dmi$f2u
> $1@fred.mathworks.com>...
>
> I wonder if the OP might think that these two
> forms are mathematically identical,
>
> (D+D')/2 == D-(D-D')/2)
>
> while not realizing that they need not be equal
> in the floating point world of Matlab.
>
> D = randn(5);
> (D+D')/2 == D-(D-D')/2
> ans =
> 1 1 0 1 1
> 0 1 0 0 0
> 0 0 1 1 1
> 1 0 1 1 0
> 1 0 1 0 1
>
> John


Arash

2007-08-30, 8:59 pm

This is better for some of the cases of D, in other cases I
still see the problem.

Thanks,
Arash


"Bobby Cheng" <bcheng@mathworks.com> wrote in message
<fb5dmi$f2u$1@fred.mathworks.com>...
> Have you try D = (D+D')/2 ?
> ---Bob.
>
> "Arash " <ahazeghi@gmail.com> wrote in message
> news:fb4uek$g2h$1@fred.mathworks.com...
>
>


John D'Errico

2007-08-30, 8:59 pm

"Arash " <ahazeghi@gmail.com> wrote in message <fb7bud$hs
$1@fred.mathworks.com>...
> John,
> When I try your script I get all 1's:
>
> 1 1 1 1 1
> 1 1 1 1 1
> 1 1 1 1 1
> 1 1 1 1 1
> 1 1 1 1 1


Did you use rand to generate the array?
Note that there is a difference.

D = rand(5);
(D+D')/2 == D-(D-D')/2
ans =
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1

D = randn(5);
(D+D')/2 == D-(D-D')/2
ans =
1 0 0 0 1
0 1 1 1 0
0 0 1 1 1
1 0 1 1 1
1 0 1 1 1


> I wonder if this has to do with default accuracy in matlab.
> Is there a way to get rid of roundup errors from small phase
> factors in matrix calculations?


No.

John
Bobby Cheng

2007-08-30, 11:46 pm

You should not. Can you give us an example?

D = (D+D')/2; %guarantee to be Hermitian.
norm(D-D',1) %should be zero for all finite D.

---Bob.



"Arash " <ahazeghi@gmail.com> wrote in message
news:fb7ca4$6bq$1@fred.mathworks.com...
> This is better for some of the cases of D, in other cases I
> still see the problem.
>
> Thanks,
> Arash
>
>
> "Bobby Cheng" <bcheng@mathworks.com> wrote in message
> <fb5dmi$f2u$1@fred.mathworks.com>...
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com