wrong_path
wrong_path

Reputation: 376

Visualize a large number of eigenvectors in Matlab

I have 6 matrices for which I am required to plot the eigenvectors. These matrices have dimensions from 20x20 to 320x320. I really do not know what would be the best (clearer) way to plot them. Is there any library available to your knowledge? I thought about reducing the dimension of each eigenvector but still, it would be a lot of work.

N = [40, 80, 160]; % Dimension 1-D grid

% Laplace operators
L1 = -1/((1/N(1))^2) * full( ( spdiags(repmat([1,-2,1], N(1)-1, 1), -1:1, N(1)-1, N(1)-1) ) );
L2 = -1/((1/N(2))^2) * full( ( spdiags(repmat([1,-2,1], N(2)-1, 1), -1:1, N(2)-1, N(2)-1) ) );
L3 = -1/((1/N(3))^2) * full( ( spdiags(repmat([1,-2,1], N(3)-1, 1), -1:1, N(3)-1, N(3)-1) ) );

These matrices are the Laplace operators associated to Poisson's equation. The aim is to visualize how the eigenvectors change when we change the dimension of the 1D grid I use to solve Poisson's equation.

Upvotes: 0

Views: 707

Answers (1)

Cecilia
Cecilia

Reputation: 4721

As you have intuited, we cannot plot them the same way we would plot a 3D vector. If you want to visualize the spacial distance between eigenvectors, you could consider geometry preserving dimensionally reduction like isomap, but the simplest visualization, is to plot the dimensions of the eigenvectors.

First, let's get some eigenvectors. I use the same example as the eig documentation

A = gallery('lehmer',20)
[A_eig_vec, A_eig_val] = eig(A);

Then plot each column as a line. I also use multiple plots to avoid the plots getting too noisy with too many lines.

subplot(4, 1, 1);
plot(A_eig_vec(:, 1:5));

subplot(4, 1, 2);
plot(A_eig_vec(:, 6:10));

subplot(4, 1, 3);
plot(A_eig_vec(:, 11:15));

subplot(4, 1, 4);
plot(A_eig_vec(:, 16:20));

The result looks like this

Eigen vector plot

You can see how the eigenvectors seem to capture different frequencies.

Upvotes: 2

Related Questions