Matlab code

%% Hydrogen

HydDP=[410.2,409.9,410,409.9,410.2,410.3].*10^-9; sigDP=std(HydDP)/sqrt(6); HydP=[434.7,434.6,434.7,434.6,434.6,434.2].*10^-9;sigP=std(HydP)/sqrt(6); HydCy=[486.9,487,487,486.9,487,487].*10^-9;sigCy=std(HydCy)/sqrt(6); HydR=[665.5,666,666,665,666,666.5].*10^-9;sigR=std(HydR)/sqrt(6);

%Hydaccep=[410,434,486,656] Hyd= [HydDP;HydP;HydCy;HydR]; nhyd=[6,6,6,6,6,6;5,5,5,5,5,5;4,4,4,4,4,4;3,3,3,3,3,3]; Rhyd=(1./Hyd)./((1./4)-(1./(nhyd.^2)))

%% Deterium

DetP=[434.2,433.6,433.4,434.5,434.2,433.9].*10^-9;dsigP=std(DetP)/sqrt(6); DetCy=[486.5,486.4,486.5,486.6,486.7,486.7].*10^-9;dsigCy=std(DetCy)/sqrt(6); DetR=[664,665,664.5,665,665,665].*10^-9;dsigR=std(DetR)/sqrt(6); Det= [(DetP);(DetCy);(DetR)]; ndet=[5,5,5,5,5,5;4,4,4,4,4,4;3,3,3,3,3,3]; Rdet=(1./Det)./((1./4)-(1./(ndet.^2)))

%% Analize the Rydberg constant Rvec=zeros(7,6);nvec=zeros(7,6); Rvec(1:4,:)=Rhyd; Rvec(5:7,:)=Rdet; nvec(1:4,:)=nhyd; nvec(5:7,:)=ndet; sigvec=[std(Rvec(1,:))/sqrt(6),std(Rvec(2,:))/sqrt(6),std(Rvec(3,:))/sqrt(6),std(Rvec(4,:))/sqrt(6),std(Rvec(5,:))/sqrt(6),std(Rvec(6,:))/sqrt(6),std(Rvec(7,:))/sqrt(6)] hold on Raccept=10.972e6;

errorbar(mean(nvec'),mean(Rvec'),sigvec,'ko') plot([1,10],[Raccept,Raccept]) legend('experimental value of Rydberg constant w/ error bar','accepted value of Rydberg constant','Location','Best') hold off

Avg=mean([mean(Rdet),mean(Rhyd)])

percentdiff=(abs(Raccept-Avg)./Raccept).*100