function create_pointset( np )
  
  if nargin < 1
    error( [ mfilename ' needs at least one input argument.' ] );
  end
  
  % Create synthetic data set
  
  pointset = generate_data( np );
  
  % Save it all
  
  output_filename = fullfile( 'DATA', sprintf( 'pointset_np%02d.mat', np ) );
  save( output_filename, 'pointset' );
  disp( [ mfilename ' wrote out "' output_filename '".' ] );
  
  
function data = generate_data( np_per_sector )
  
  if nargin < 1
    error( [ mfilename '.generate_data() 1 input argument' ] );
  end
  
  nchannels = 8;
    
  a = ( -5 + (1:nchannels) ) * pi / 4;
  geometry = [ 0.1 * cos( a ); 0.1 * sin( a ); 0 * a ];
  
  
  % Divide space around the microphone array 
  % into sectors, which look like slices of a pie.
  
  nsectors = 18;
  k = 1:nsectors;
  sector_az_min = 2*pi*(k-1)/nsectors;
  sector_az_max = 2*pi*k/nsectors;
  sector_el_min = 0 * k;
  sector_el_max = 0 * k + 80/180*pi;
  sector_r_min  = 0 * k + 0.2;
  sector_r_max  = 0 * k + 20.2;
  
  % Definition of the data
  
  data_npoints = np_per_sector ^ 3;  % Overall
  
  data.x = repmat( NaN, [ 3, data_npoints, nsectors ] );
  alpha = ( 0.5:np_per_sector ) / np_per_sector;
  
  for a_sector = 1:nsectors
    
    disp( sprintf( 'Sector %d/%d', a_sector, nsectors ) );
    
    % Create points that cover the sector in a uniform manner,
    % IN THE (AZ,EL,R) SPACE  (not uniform in euclidian space)
    % -> this corresponds to the DESIRED (az,el) precision, which is independent of radius.
    
    az = sector_az_min( a_sector ) + alpha * ( sector_az_max( a_sector ) - sector_az_min( a_sector ) );
    el = sector_el_min( a_sector ) + alpha * ( sector_el_max( a_sector ) - sector_el_min( a_sector ) );
    r  = sector_r_min( a_sector ) + alpha * ( sector_r_max( a_sector ) - sector_r_min( a_sector ) );
    
    % "combvec" can be used instead
    m = peigne_vec( az, el, r );
    
    % Translate to cartesian coordinates
    [ x, y, z ] = sph2cart( m(1,:), m(2,:), m(3,:) );
    
    % Translate to time-delay and store id
    data.x( :, :, a_sector ) = [x;y;z];
        
  end
  
  % Also save the parameters used to create the data
  
  data.np_per_sector = np_per_sector;
  data.nsectors      = nsectors;
  data.geometry      = geometry;
  data.sector_az_min = sector_az_min;
  data.sector_az_max = sector_az_max;
  data.sector_el_min = sector_el_min;
  data.sector_el_max = sector_el_max;
  data.sector_r_min  = sector_r_min;
  data.sector_r_max  = sector_r_max;
  