% run G-lab data analysis % load data load Glabdata.mat % measured & given values M1 = 3.041; M2 = 2.998; lo = 9.75; d = 0.050; b = 0.047; yo = 1.00; yp = 1.35; y1 = 1.41; % estimate parameters with non-linear curve fit % note "reasonable" estimates for y_2, B, a, T & phi [y_2,B,a,T_1,phi,values,nEvals] = bigGfit(yn,t,[1.3 0.2 3000 900 0.01]); %% use results to calculate G % natural period squared To2 = 4*pi^2/((4*pi^2/mean(T_1)^2)+(1/mean(a)^2)); % non-corrected G Go = 2*d*b^2*lo*pi^2/((M1+M2)*(lo^2+(yp-yo)^2)*To2); % correction factor b_dRatio = b/d; K = GlabCorrectionFactor(b_dRatio); % corrected G G = Go * K % percent error G_theory = 6.673e-11; error = (G - G_theory)/G_theory*100 return