% SUPPLEMENTARY MATERIAL "Source S1": Simulating acquired spectra. % % Example source code for “Method for assessing the reliability of % molecular diagnostics based on multiplexed SERS-coded nanoparticles.” % (Manuscript #PONE-D-13-01484) % Load reference spectra s440 = load('s440 ref.asc'); spectra_maxvalue = max([s440(:,2)]); length_s440 = 601; % Load acquired set of background noise at a particular condition bkglist = load('AFglass,water2000acqat100msbkgcorrectedtoroomlightsat10mWlaserpower.asc'); % Simulate 50000 acquisition trials and 10 different S440 concentrations num_trials = 50000; num_points = 10; % Pre-allocate space for noise vector noise = zeros(length_s440,1); for i = 1:num_trials for j = 1:num_points % First, generate noise using the 'randn' function to ensure the % noise is normally-distributed noise = (10/100)*spectra_maxvalue*randn(length_s440,1); % From the list of experimentally-acquired background acqusitions, % randomly choose one to add to the simulated spectrum. bkg_index = round(2 + (2000-2).*rand); bkg = bkglist(:,bkgindex); % The simulated spectrum 'test' is composed of S440, background, % and noise. test = j*s440 + bkg + noise; end end