0

I have :

 A =
 1     2     3
 2     4     5
 5     5     5

and

[U S V]=svd(A)  

How can I remove the dimension of A matrix from SVD function?

Christian Gollhardt
  • 16,510
  • 17
  • 74
  • 111
Tarrah Arshad
  • 74
  • 2
  • 9

1 Answers1

1

I'm assuming you want to get a reduced version of the matrix A.

This is done by using PCA, search it. For example, if you want the reduced matrix A to have K dimensions:

[m, ~] = size(A);

Sigma = 1.0/m .* A' * A;
[U, S, ~] = svd(Sigma);

newA = zeros(size(A, 1), K);

for i = 1:size(A, 1),
    for j = 1:K,
        x = A(i, :)';
        projection_k = x' * U(:, j);
        newA(i, j) = projection_k;
    end
end
end

So the matrix newA will be a reduced version of A with K dimensions.

It's better for you to search about PCA.

SamuelNLP
  • 4,038
  • 9
  • 59
  • 102
  • i have many dataset related ( social network system ) . i like user dataset reduced users and cols. i use this code in matlab but not work , error in K variable – Tarrah Arshad May 26 '15 at 14:58
  • 1
    K is the dimension. If your data has originally 10 dimentions and you wnat to reduce it to 2, K = 2. I think you don't know anything about PCA, better to study it than to just use the code. – SamuelNLP May 26 '15 at 20:09
  • can you call me on skype for help me , skypeid= tarraharshad – Tarrah Arshad May 27 '15 at 06:24