Problem calculating eigenvalues and eigenvectors

In summary, the speaker is trying to construct a functioning version of randomfields in Matlab and needs to calculate the Karhunen-Loève expansion of 2D data. They have a matrix of size 144*5 and are calculating eigenvectors and eigenvalues, but the results do not match the sample data. They are wondering if ignoring the grid positions could be the cause and asking for advice on how to improve the results.
  • #1
Frank Einstein
170
1
Hello everyone. I am trying to construct a functioning version of randomfields (specifically 2D_karhunen_loeve_identification_example.py) in Matlab. For that, I have to calculate the Karhunen-Loève expansion of 2D data, since this is what it says in the documentation. I also have some sample data to test my results.
I have a matrix of size 144*7, being 144 the number of points, 5 the number of random variables and the first two, the X and Y points of each value. If I ignore the first two rows and calculate

Eigenpair:
[evec, eval]=eig(cov(realizations));
the resulting eigenvectors and eigenvalues don't look at all like the ones of the sample data. I was wondering if this might happen because I am ignoring the grid positions at the time of calculating the covariance matrix.

Best regards.
Frank.

E. G. I will attach the stochastic realizations I have received and what I am expected to get
 

Attachments

  • 2D_sample_paths.txt
    25 KB · Views: 141
  • 2D_identification_eigensolution_0.png
    2D_identification_eigensolution_0.png
    14.3 KB · Views: 118
  • 2D_identification_eigensolution_1.png
    2D_identification_eigensolution_1.png
    13.4 KB · Views: 112
  • 2D_identification_eigensolution_2.png
    2D_identification_eigensolution_2.png
    16.3 KB · Views: 118
  • 2D_identification_eigensolution_3.png
    2D_identification_eigensolution_3.png
    15.8 KB · Views: 121
  • 2D_identification_eigensolution_4.png
    2D_identification_eigensolution_4.png
    13.9 KB · Views: 128
Physics news on Phys.org
  • #2
I'm struggling to understand your problem. What are the "grid positions" you're referring to?

I believe EIG does not return the eigenvalues / eigenvectors in any particular order. You may be comparing to a plot where they are sorted in order of descending eigenvalue magnitude.

Perform that sort and see if it improves your results.
 

Related to Problem calculating eigenvalues and eigenvectors

1. What are eigenvalues and eigenvectors?

Eigenvalues and eigenvectors are mathematical concepts used in linear algebra to describe the behavior of a linear transformation, such as a rotation or a stretch. Eigenvalues are scalars that represent the amount by which the eigenvector is stretched or compressed by the transformation. Eigenvectors are the corresponding vectors that remain in the same direction after the transformation.

2. How do I calculate eigenvalues and eigenvectors?

To calculate eigenvalues and eigenvectors, you first need to find the characteristic polynomial of the matrix representing the linear transformation. Then, you can use various methods such as the characteristic equation or the power iteration method to solve for the eigenvalues and eigenvectors.

3. Why is it important to calculate eigenvalues and eigenvectors?

Eigenvalues and eigenvectors are important in many areas of science and engineering. They are used to solve systems of differential equations, analyze the stability of dynamical systems, and perform data analysis and dimensionality reduction in machine learning and data mining. They also have applications in quantum mechanics, structural engineering, and image processing.

4. What are some common problems encountered when calculating eigenvalues and eigenvectors?

One common problem is finding the roots of the characteristic polynomial, which can be a complicated and time-consuming process. Another problem is the potential for round-off errors when using numerical methods to solve for the eigenvalues and eigenvectors. Additionally, some matrices may have complex eigenvalues and eigenvectors, which can be challenging to interpret and use in calculations.

5. How can I check if my calculated eigenvalues and eigenvectors are correct?

You can check the accuracy of your calculated eigenvalues and eigenvectors by plugging them back into the original matrix and seeing if they satisfy the eigenvalue equation. Additionally, you can check if the eigenvectors are orthogonal to each other and have a unit length. You can also compare your results with known or theoretical values if available.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
Replies
3
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
32
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • Programming and Computer Science
Replies
3
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
913
  • Set Theory, Logic, Probability, Statistics
Replies
1
Views
1K
Back
Top