%% Generate an undecorated version of Figure 2(a) function []=Figure2a() %% Decide for which temperatures to plot autocorrelation functions; % temperature_index=2 corresponds to T=1.000; % temperature_index=3 corresponds to T=0.800; % temperature_index=4 corresponds to T=0.600; % temperature_index=5 corresponds to T=0.550; % temperature_index=6 corresponds to T=0.510; % temperature_index=7 corresponds to T=0.485; % temperature_index=8 corresponds to T=0.465; % temperature_index=9 corresponds to T=0.450; temperature_indices=[2,3,4,6,9]; %% Plot data and a fit, one temperature by one temperature; close all; figure(1); set(gca,'yscale','log') hold on for ii=1:size(temperature_indices,2) temperature_index=temperature_indices(ii); %% Read in the data % Dynamical correlation function data_name=sprintf('./Gdyn%d.dat',temperature_index); fid = fopen(data_name,'r'); numbers=fscanf(fid, '%f'); fclose('all'); r=(0:0.1:8.0).'; Nr=size(r,1); % radii where dynamical correlation functions are measured Gd=numbers(2*(1:Nr)-1); % dynamical correlation functions Gd_error=numbers(2*(1:Nr)); % error bars %% Exponential fit % Throw away short-distance data points UVcut=1.5; Ikeep=logical(r>=UVcut); r=r(Ikeep); Gd=Gd(Ikeep); Gd_error=Gd_error(Ikeep); % Exponential fit, B*exp(-(r/xi_DH)) x=r; y=Gd; Init=[y(1), 1]; weight=diag(ones(size(x))); Outliers=false(size(x)); [fit_values,confidence_intervals]=exponential_decay_fit(x,y,weight,Init,Outliers); B=fit_values(1); xi_DH=fit_values(2); xi_DH_error=1.96*(confidence_intervals(2,2)-confidence_intervals(1,2))/2; % 95-percent confidence interval r_fit=0:0.01:8; Gd_fit=B*exp(-(r_fit/xi_DH)); %% Plot them plot(r_fit,Gd_fit) plot(r,Gd,'Linestyle','none','Marker','.') end %% Label axis and print it out xlabel('$r$','Interpreter','latex') ylabel('$G_{\rm dyn}$','Interpreter','latex') xlim([0,8]) ylim([10^(-4),10^(-1)]) axis square set(gcf, 'PaperPositionMode', 'auto'); print -depsc2 Figure2a.eps end