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: polar_loop_space.m
    path of file: ./repos/GIBBON/lib
    
    the code of the file until where you have to start completion: function [X,Y]=polar_loop_space(x,y,n,THETA_start,interpMethod)

% [X,Y]=polar_loop_space(x,y,n,THETA_start,interp_method)
% ------------------------------------------------------------------------
%This function interpolates n evenly spaced points onto the loop specified
%by x,y using interpMethod  as the interpolation method. The loop should
%be interpolatable in a polar coordinate system, i.e. each angle should
%provide a unique radius. THETA_start indicates the angle for the start of
%the loop. 
%
% Kevin Mattheus Moerman
% kevinmoerman@hotmail.com
% 11/04/2011
%------------------------------------------------------------------------


    
function [X,Y]=polar_loop_space(x,y,n,THETA_start,interpMethod)

% [X,Y]=polar_loop_space(x,y,n,THETA_start,interp_method)
% ------------------------------------------------------------------------
%This function interpolates n evenly spaced points onto the loop specified
%by x,y using interpMethod  as the interpolation method. The loop should
%be interpolatable in a polar coordinate system, i.e. each angle should
%provide a unique radius. THETA_start indicates the angle for the start of
%the loop. 
%
% Kevin Mattheus Moerman
% kevinmoerman@hotmail.com
% 11/04/2011
%------------------------------------------------------------------------

%% Converting to polar coordinates
x=x(:); y=y(:);
[THETA,R] = cart2pol(x,y);
[THETA,ind_sort]=sort(THETA); %Sorting angles
R=R(ind_sort); %Sorting radii according to angle order
THETA=unwrap(THETA); %unwrapping angles

% Removing double points
[THETA,ia,ic] = unique(THETA); clear ic; %N.B. performance depend