Singular value decomposition positive components

94 Views Asked by At

I am using Singular Value Decomposition (SVD) applied to Singular Spectrum Analysis (SSA) of a timeseries.

% original time series
x1= rand(1,10000);
N = length(x1);

% windows for trajectory matrix
L = 600;
K=N-L+1; 

% trajectory matrix/matrix of lagged vectors
X = buffer(x1, L, L-1, 'nodelay'); 

% Covariance matrix
A = X * X' / K;

% SVD
[U, S_temp, ~] = svd(A);


% The eigenvalues of A are the squared eigenvalues of X
S = sqrt(S_temp);
d = diag(S);
% Principal components
V = X' * U;
for i = 1 : L
    V(:, i) = V(:, i) / d(i);             
end

I wanted to know if there is a way to have the singular components V always positive.

X is always > 0 in my case (and also the Covariance matrix A)