Obtaining EOF's from svds, orientation changes each time

2 views (last 30 days)
The orientation of the spatial EOF's keep changing each time I run the script. Im using the svds function with 2 singular values and the orientation of the vectors in the spatial EOF changes each time. Why is this?
  2 Comments
Shashank Prasanna
Shashank Prasanna on 22 Jan 2013
Could you share your code so that we can see why you see different results each time?
eduardoq
eduardoq on 22 Jan 2013
uf=randn(1000,10);
vf=randn(1000,10);
[nx,ny]=size(uf);
um=mean(uf);
vm=mean(vf);
um=ones(nx,1)*um;
vm=ones(nx,1)*vm;
um=uf-(um);
vm=vf-(vm);
um=mean(um,2); vm=mean(vm,2);
A=[um vm];
[U,S,V]=svds(A,2);
s=diag(S);
s=((s.^2)/(sum(s.^2)))*100;

Sign in to comment.

Answers (1)

Shashank Prasanna
Shashank Prasanna on 22 Jan 2013
Are you running the whole script again, or just the SVD part? Since you are generating random numbers using RANDN you will be performing SVD on completely different numbers each time.
You can either add this command at the beginning of the script such that the same random numbers are generated each time.
>> rng(0) ;
>> %%%Rest of your code %%%
Or you can re run only the last 3 lines of code from SVDS so that you perform SVD on the same data again. You will see that the result must be consistent.
  3 Comments
Shashank Prasanna
Shashank Prasanna on 22 Jan 2013
Can you reproduce this issue with a smaller subset of your data? How off are your results wrt to precision of numbers?
Javier
Javier on 18 Dec 2014
I have a little doubt about the procedure to compute the real-vector EOF: considering that I have N grid points with velocities for T time steps, I understand that I have to apply the svd decomposition to a 2NxT matrix where the first N rows correspond to the U points and the N+1 to 2N rows correspond to V. My doubt is: once the decomposition is performed (for example for the first 10 EOF modes) I obtain a 2Nx10 EOF matrix. Here I understand that again the first N rows correspond to the U component for that mode and from N+1 to 2N to V. Is it that correct? I'd really appreciate any help.
Thanks

Sign in to comment.

Categories

Find more on Eigenvalues in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!