eigenvalue decomposition using matlab

1.2k Views Asked by At

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);
1

There are 1 best solutions below

1
On BEST ANSWER

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