function plotneededsamples(L,N,sigma,upperlimsamples)

  angl = pi/4;
  d = 1;
  lambda = 10;
  
  c = L/N;
  truecapacitiesall = [];  
  %get an estimate very close to the true capacity
  for (numsamples=10:10:upperlimsamples)
    numsamples
    sum = 0;
    for (k=1:numsamples)
      V1 = zeros(N,L);
      V2 = zeros(N,L);
      for (k=1:L) 
        theta = 2*angl*(rand(1)-0.5);
        V1(:,k) = ((exp(2*pi*j*sin(theta)*d/lambda)).^(0:(N-1)))';
        theta = 2*angl*(rand(1)-0.5);
        V2(:,k) = ((exp(2*pi*j*sin(theta)*d/lambda)).^(0:(N-1)))';
      end
      V1 = (1/sqrt(N))*V1;
      V2 = (1/sqrt(N))*V2;
      sum = sum + log2(det( eye(L,L) + (1/(sigma^2)) * V1' * V2 * V2' * V1 ));
    end
    truecapacitiesall = [ truecapacitiesall sum/(numsamples*N) ];
  end
      
  plot(10:10:upperlimsamples,truecapacitiesall,'ko');
  xlabel('Number of samples');
  ylabel('Capacity');