% [ r, p, rms_error] = Moore_PCF(data, q_range, D) % % Generate a Pair Correlation Function using Moore's method (Moore, PB. % Meth. of Exper. Phys. (1982) Vol 20 p337-390) % % Inputs - % I versus q --> data(:,1)= q; data(:,2) = I; % q_range --> Restrict q_range(1)<=q<=q_range(2) % D ---> Maximum correlation length. % % Outputs - % Pair Correlation function p(r) --> r(j) and p(j) % RMS_Error --> Root Mean square error difference between % theoretical I versus Q and measured I versus q. % % Moore's method assumes that the correlation function goes to zero for % r>D. Thus, D must be larger than the size of the object. % Moore's method decomposes p(r) into a sum of sine waves - % p(r) = Sum (n_min, n_max) An * sin(n* pi * r/D); % % It takes whatever value of D you care to give it, figures out what harmonics % of n it is allowed to fit (from the measured q-range) and then goes off % and attempts a least square's fit of the An co-efficients to the data. function [r,p,rms_error] = Moore_PCF(data_in, q_range, D) % Cut the data just to the allowed q_range; temp = length(data_in); jmin = 1; while ((jmin