2
$\begingroup$

I would like to diagnolize a rank-1 matrix using the well known eigenvalue decomposition as $\mathbf{U}^H\mathbf{A}\mathbf{U} = diag (M, 0,\cdots, 0)$, where $\mathbf{A}$ is a Hermitian matrix and $\mathbf{U}$ is a unitary matrix.

While if we use eig.m in matlab, the resulting $\mathbf{U}$ fails to satisfy the property of unitary matrix $\mathbf{U}^H\mathbf{U} = \mathbf{I}_{M}$ due to the unit round-off error and the use of \pi.

What should I do?

The code can be given:

    clc
    clear all
    close all

    c           = 340;
    j           = sqrt(-1);
    theta_s     = 0;
    theta_s     = theta_s*pi/180;

    M           = 6;
    delta       = 0.012;
    M_vector    = (0:M-1)';
    theta       = 0:0.1:360;
    theta       = theta*pi/180;

    f           = 4000;

    %% eigenvalue decomposition of matrix 
    omega       = 2*pi*f;
    d           = exp(-j*omega*M_vector*delta/c);
    h_DS        = 1/M*d;
    A           = d*d';

    [U,D]       = eig(A);
$\endgroup$
  • $\begingroup$ Use of $\pi$??? ${}$ $\endgroup$ – copper.hat Apr 28 at 3:56
  • $\begingroup$ The entries in matrix $\mathbf{A}$ relate to $\pi$, and the $pi$ in matlab is an approximate value. $\endgroup$ – chen xi Apr 28 at 3:58
  • $\begingroup$ Does it badly fail to satisfy it, or is it satisfying up to double-precision round-off? $\endgroup$ – eyeballfrog Apr 28 at 4:04
  • $\begingroup$ Badly failed. I can give a test code $\endgroup$ – chen xi Apr 28 at 4:07
  • 1
    $\begingroup$ The matrix A is a Hermitian matrix. $\endgroup$ – chen xi Apr 28 at 4:15
3
$\begingroup$

Due to round-off errors, MATLAB isn't recognizing that your matrix is Hermitian. You can fix this easily by averaging A with its Hermitian transpose:

>> ishermitian(A)

ans =

  logical

   0

>> B=(A+A')/2;
>> ishermitian(B)

ans =

  logical

   1

Once you've done this, U'*U=I as expected.

>> [U,D]=eig(B);
>> U'*U

ans =

  Columns 1 through 4

   1.0000 + 0.0000i  -0.0000 + 0.0000i   0.0000 + 0.0000i  -0.0000 - 0.0000i
  -0.0000 - 0.0000i   1.0000 + 0.0000i  -0.0000 - 0.0000i  -0.0000 - 0.0000i
   0.0000 - 0.0000i  -0.0000 + 0.0000i   1.0000 + 0.0000i   0.0000 - 0.0000i
  -0.0000 + 0.0000i  -0.0000 + 0.0000i   0.0000 + 0.0000i   1.0000 + 0.0000i
   0.0000 - 0.0000i   0.0000 - 0.0000i   0.0000 - 0.0000i  -0.0000 + 0.0000i
  -0.0000 + 0.0000i  -0.0000 - 0.0000i   0.0000 - 0.0000i   0.0000 + 0.0000i

  Columns 5 through 6

   0.0000 + 0.0000i  -0.0000 - 0.0000i
   0.0000 + 0.0000i  -0.0000 + 0.0000i
   0.0000 + 0.0000i   0.0000 + 0.0000i
  -0.0000 - 0.0000i   0.0000 - 0.0000i
   1.0000 + 0.0000i   0.0000 + 0.0000i
   0.0000 - 0.0000i   1.0000 + 0.0000i
$\endgroup$
  • $\begingroup$ I really appreciate your help. Thank you!!! $\endgroup$ – chen xi Apr 28 at 4:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.