% Gyration1.m just calculates the radius of gyration of a small-angle % x-ray scattering curve. % The input should be a two column matrix of q's and scattering strengths. % For a gyration calculation, early data will be unreasonable because of the % beamstop while data with a high-q will no longer fit the expansion. % The fit assumes that I(q) = I(0) * ( 1 - q^2 Rg^2 / 3) - bad, bad, bad! function [Io,Rg] = Gyration1(data) % Find the beginning and the end of the region for a Guiner fit! X = [data(:,1)]; Y = [data(:,2)]; plot(X,Y); hold ; min_q = input('What is the lowest value of Q to start fit at?'); max_q = input('What is the maximum value of Q to terminate fit at?'); min_i = 1; while(X(min_i)