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: sampleInitialPoints.m
    path of file: ./repos/CADET/src/cadet-mi/examples/publications/LewekeEtAl2018/parest
    
    the code of the file until where you have to start completion: function [samples, objVals] = sampleInitialPoints(nSamples, transformedSampling)
%SAMPLEINITIALPOINTS Samples initial points for parameter estimation of a three component SMA process.
%
%   The SMA parameters of three components are simultaneously estimated from
%   four gradient and one breakthrough experiments i
    
function [samples, objVals] = doSampling(nSamples, loBound, upBound, logScale, parFit, transformedSampling, massesIn)
%DOSAMPLING Runs the parameter sampling using method 1 or 2 for ambiguitiy elimination.

	% Preallocate arrays
	samples = zeros(nSamples, length(loBound));
	objVals = zeros(nSamples, 1);
	i = 1;
	
	% Progress monitoring
	tStart = tic;
	lastProg = -0.1;

	% Main loop
	while i <= nSamples
		% Obtain a (log-)uniform sample from the box specified by loBound and
		% upBound
		r = rand(size(loBound));
		curParams = loBound + (upBound - loBound) .* r;
		curParams(logScale) = exp(log(loBound(logScale)) + log(upBound(logScale) ./ loBound(logScale)) .* r(logScale));
		
		if transformedSampling
			% Method 2: The sample is in transformed space (loBound and 
			% upBound are already transformed) and we need to transform it
			% back to Simulator space (nu_i instead of nu_1, offsets)
			curParams = paramTransform(curParams);
		else
			% Method 1: Sort components in ascend