Physics307L F09:People/Young/Young's Speed of light/Matlab code for data analysis

Koch comments

 * Maybe you're just using it as a quick variable name, but "Timewalk" refers to a different phenomenon in the lab.
 * I believe your error is in converting to time. The conversion factor should be 50 ns / 10 V, and I believe you use 10 ns / 50 V.  Thus a factor of 25 difference!

%% Calibration

delay=[0 	.5e-9 	1e-9 	2e-9 	4e-9 	8e-9 	16e-9 ] set1=[4.13e-9 	4.24e-9 	4.24e-9 	4.56e-9 	4.92e-9 	5.68e-9 	7.32e-9 ] set2=[4.0e-9 	4.04e-9 	4.12e-9 	4.4e-9 	4.76e-9 	5.56e-9 	7.12e-9 ]

set=[set1;set2] plot(delay,mean(set),'ko')

%% Analysis x1=[8.56 	8.44 	8.56 	7.5 	7.2 	7.7 	7.44 	7.8 	7.44 	7.6 	7.8 	7.9 	7.8 	7.24 	6.8 	6.6 	7.24 	6.5 	6.88 	6 	6.6 	6.8 ].*10.^-9 x2=[8.48 	8.24 	8.5 	8.4 	8.4 	8.32 	8.2 	8.12 	8.08 	8.08 	8.0 	8.0 	7.9 	7.6 	6.7 	7.24 	6.9 	7.12 	7.0 	6.95 	7.25 	6.6 ].*10.^-9 x3=[8.5 	8.2 	8.16 	7.9 	7.7 	7.6 	7.24 	7.64 	7.6 	7.4 	7.3 	7.6 	7.56 	7.96 	7.4 	6.9 	7.36 	6.8 	6.72 	6.7 	7.0 	7.24 ].*10.^-9

data=[x1;x2;x3]

avg=mean(data) dis=[0 	10 	20 	30 	40 	50 	60 	70 	80 	90 	100 	110 	120 	130 	140 	150 	160 	170 	180 	190 	200 	210 ].*10.^-2 figure plot(avg,dis,'ko') wrongc=polyfit(avg,dis,1)

figure timewalk=mean(.2.*data)+4e-9 plot(timewalk,dis,'ko') realc=polyfit(timewalk,dis,1)

percenterror=((2.99792e9+realc(1))./2.99792e9)*100