This is a MATLAB question. I am trying to find the eigenvalues of a matrix with both real and complex numbers. This is my session.(adsbygoogle = window.adsbygoogle || []).push({});

>> A=[1/sqrt(2),i/sqrt(2),0; -1/sqrt(2),i/sqrt(2),0; 0,0,1]

A =

0.7071, 0 + 0.7071i, 0

-0.7071, 0 + 0.7071i, 0

0, 0, 1.0000

>> eig(A)

ans =

0.9659 - 0.2588i

-0.2588 + 0.9659i

1.0000

However, matrix A is unitary, so [tex]|\lambda|[/tex] should equal 1. This is true for the third eigenvalue, but not for the other two. I even noticed that MATLAB fails to confirm A is unitary:

A =

0.7071, 0 + 0.7071i, 0

-0.7071, 0 + 0.7071i, 0

0, 0, 1.0000

>> B=[1/sqrt(2),-1/sqrt(2),0; i/sqrt(2),i/sqrt(2),0;0,0,1]

B =

0.7071, -0.7071, 0

0 + 0.7071i, 0 + 0.7071i, 0

0, 0, 1.0000

>> A*B

ans =

0, -1, 0

-1, 0, 0

0 , 0, 1

Why is MATLAB giving me incorrect answers? It was even doing this for me yesterday when I was dealing with real matricies. It was giving me eigenvalues with imaginary components when they were, in fact, all real. What's the deal?

**Physics Forums - The Fusion of Science and Community**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# MATLAB Problems

Can you offer guidance or do you also need help?

Draft saved
Draft deleted

Loading...

Similar Threads - MATLAB Problems | Date |
---|---|

Does anyone had this plotting problem with MATLAB? | Dec 23, 2017 |

Matlab map representation problems | Feb 11, 2017 |

Matlab Problem with Generating Barnsley Fern Fractal in MATLAB | Sep 21, 2016 |

Problem of plotting picture and video in Linux HPC | Dec 3, 2015 |

Problem with Matlab | Sep 4, 2015 |

**Physics Forums - The Fusion of Science and Community**