%% Compute SVD of Matrix Sketch
% Use svdsketch to compute the SVD factors of a low-rank matrix approximation.
%
% Use gallery to create a 200-by-200 random matrix with geometrically distributed singular values.

A = gallery('randsvd',200);

%
% Use svdsketch to calculate the SVD of a low-rank approximation of A.

[U,S,V] = svdsketch(A);

% Check the size of the outputs.

size(S)

% The results indicate that the low-rank matrix approximation of A has a rank of 120.
% Copyright 2020 The MathWorks, Inc.