% [ r, p, rms_error] = Guess_PCF(data, q_range, D, N, r, p) % % Generate a Pair Correlation Function by the Guess and Check Method % % Inputs - % I versus q --> data(:,1)= q; data(:,2) = I; % q_range --> Restrict q_range(1)<=q<=q_range(2) % D ---> Maximum correlation length. % N --> Number of segments to use if generating a new % pair correlation function % r,p --> p(r) --> r(j) and p(j) of an initial guess for % p(r) % note r(1)=0; r(N+1)=D; p(1)=p(N+1)=0! % % 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. % function [r,p,rms_error] = Guess_PCF(data_in, q_range, D, N, r, p) % Cut the data just to the allowed q_range; temp = length(data_in); jmin = 1; while ((jmin