Coherent Backscattering from Multiple Scattering Systems - KOPS ...

Coherent Backscattering from Multiple Scattering Systems - KOPS ... Coherent Backscattering from Multiple Scattering Systems - KOPS ...

kops.ub.uni.konstanz.de
from kops.ub.uni.konstanz.de More from this publisher
26.12.2013 Views

MATLAB codes % reference files index = regexp (name_ref, ’_’, ’start’) ; index = index (length(index) - 1) ; namebase = name_ref (1 : index) ; list = dir ([path_ref,namebase,’*.dat’]) ; data_ref = zeros (size(list,1),256,2) ; P_ref = zeros (size(list,1),1) ; for N = 1 : size(list,1) filename = [path,list(N).name] ; data_ref(N,:,:) = load (filename,’-ascii’) ; parts = regexp (list(N).name, ’_|+-|.dat’, ’split’) ; p_ref = parts ( size(parts,2) - 2 ) ; P_ref(N) = str2double (p_ref:,1) ; end % other data k = 2 * pi / wavelength ; c = 3e8 ; % speed of light l_approx = D * n_eff / c ; n_surr = 1 ; % refractive index of surrounding medium = air R = reflectivity (n_eff,n_surr) ; %% Calibrate data cone = zeros(256,1) ; cone_delta = zeros(256,1) ; for n = 1 : 256 x = data_ref(:,n) ; y = P_ref * diffuson(theta(n),l_approx,R) ; temp1 = sortrows ([x,y],1) ; % sort by x x = temp1(:,1) ; y = temp1(:,2) ; warning off % many warnings because of defect photodiodes (causing NANs)! [p,s,mu] = polyfit (x,y,3) ; [cone(n),cone_delta(n)] = polyval (p,data_samp(n),s,mu) ; warning on end %% Fold data dummy = sortrows ([abs(theta), cone, cone_delta]) ; theta = dummy (:,1) ; cone = dummy (:,2) ; cone_delta = dummy (:,3) ; 82

Evaluation of the wide angle data % remove NANs and data with huge errors from damaged photodiodes m = 1 ; for n = 1 : 256 if isnan (cone(n)) elseif cone_delta(n) > 0.1*P_samp else Cone(m) = cone(n) ; Delta(m) = cone_delta(n) ; Theta(m) = theta(n) ; m = m + 1 ; end end cone = Cone ; cone_delta = Delta ; theta = Theta ; clear Theta Cone Delta % fold data (i.e. -pi/2 < theta < pi/2 -> 0 < theta < pi/2) m = 1 ; n = 1 ; while n < size(theta,2) if theta(n+1) > theta(n) Theta(m) = theta(n) ; Theta(m+1) = theta(n+1) ; Cone(m) = cone(n) ; Cone(m+1) = cone(n+1) ; Delta(m) = cone_delta(n) ; Delta(m+1) = cone_delta(n+1) ; n = n + 1 ; else % theta(n) == theta(n+1) Theta(m) = theta(n) ; Cone(m) = (cone(n) + cone(n+1)) / 2 ; Delta(m) = 0.5 * sqrt ( (cone_delta(n)).^2 + (cone_delta(n+1)).^2 ) ; n = n + 2 ; end m = m + 1 ; end cone = Cone ; cone_delta = Delta ; theta = Theta ; %% Derive experimental and theoretical cones % Correct cone with albedo mismatch corr_cone = aleph * cone ; corr_cone_delta = aleph * cone_delta ; 83

MATLAB codes<br />

% reference files<br />

index = regexp (name_ref, ’_’, ’start’) ;<br />

index = index (length(index) - 1) ;<br />

namebase = name_ref (1 : index) ;<br />

list = dir ([path_ref,namebase,’*.dat’]) ;<br />

data_ref = zeros (size(list,1),256,2) ;<br />

P_ref = zeros (size(list,1),1) ;<br />

for N = 1 : size(list,1)<br />

filename = [path,list(N).name] ;<br />

data_ref(N,:,:) = load (filename,’-ascii’) ;<br />

parts = regexp (list(N).name, ’_|+-|.dat’, ’split’) ;<br />

p_ref = parts ( size(parts,2) - 2 ) ;<br />

P_ref(N) = str2double (p_ref:,1) ;<br />

end<br />

% other data<br />

k = 2 * pi / wavelength ;<br />

c = 3e8 ; % speed of light<br />

l_approx = D * n_eff / c ;<br />

n_surr = 1 ; % refractive index of surrounding medium = air<br />

R = reflectivity (n_eff,n_surr) ;<br />

%% Calibrate data<br />

cone = zeros(256,1) ;<br />

cone_delta = zeros(256,1) ;<br />

for n = 1 : 256<br />

x = data_ref(:,n) ;<br />

y = P_ref * diffuson(theta(n),l_approx,R) ;<br />

temp1 = sortrows ([x,y],1) ; % sort by x<br />

x = temp1(:,1) ;<br />

y = temp1(:,2) ;<br />

warning off % many warnings because of defect photodiodes (causing NANs)!<br />

[p,s,mu] = polyfit (x,y,3) ;<br />

[cone(n),cone_delta(n)] = polyval (p,data_samp(n),s,mu) ;<br />

warning on<br />

end<br />

%% Fold data<br />

dummy = sortrows ([abs(theta), cone, cone_delta]) ;<br />

theta = dummy (:,1) ;<br />

cone = dummy (:,2) ;<br />

cone_delta = dummy (:,3) ;<br />

82

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!