You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: RPCA.m
    path of file: ./repos/lrslibrary/algorithms/rpca/RPCA
    
    the code of the file until where you have to start completion: 
function [L,S] = RPCA(Data,sizeim)
% imagesc(reshape(Data(:,i),sizeim))
% show_2dvideo(Data,120,160);

%computing standard PCA
mean_ls = mean(Data')';
[u,s,v] = svd(Data-mean_ls*ones(1,size(Data,2)),0);
u = u(:,1:ceil(size(Data,2)/10));
s = diag(s);
v = v(:,1:ceil(size(Data,2)/10));

Nl = 1; % Spatial Neighborhood to compute scale statistics
beta = 2.3; % Parameter ....
number_component = 4; %(8) number of components which preserve 55% of the energy with standard PCA.
    
function [L,S] = RPCA(Data,sizeim)
% imagesc(reshape(Data(:,i),sizeim))
% show_2dvideo(Data,120,160);

%computing standard PCA
mean_ls = mean(Data')';
[u,s,v] = svd(Data-mean_ls*ones(1,size(Data,2)),0);
u = u(:,1:ceil(size(Data,2)/10));
s = diag(s);
v = v(:,1:ceil(size(Data,2)/10));

Nl = 1; % Spatial Neighborhood to compute scale statistics
beta = 2.3; % Parameter ....
number_component = 4; %(8) number of components which preserve 55% of the energy with standard PCA.

%compute scale statistics
Sigmaf = zeros(sizeim);
cini = (u(:,1:number_component)'*(Data-mean_ls*ones(1,size(Data,2))));
error = Data-mean_ls*ones(1,size(Data,2))-u(:,1:number_component)*cini;
medianat = median(abs(error(:)));
error2 = error(:)-medianat;
Sigmaft = sqrt(3)*1.4826*median(abs(error2(:)));

for i = Nl+1:sizeim(1)-Nl-1
      for j = Nl+1:sizeim(2)-Nl-1
         [y,x]=meshgrid(i-Nl:i+Nl,j-Nl:j+Nl);
         ind=sub2ind(sizeim,y(:),x(:));
         errorlo=error(ind,:);
         medianat=median(abs(errorlo(:)));
   		error2=error(ind,:)-medianat;
		   Sigmaf(i,j)=beta*sqrt(3)*1.4826*median(abs(error2(:)));         
      end