# Physics307L:Labs/Balmer/balmerlab1.m

```
%Using the values taken in runs 1 - 4
% Not using runs 5 & 6 for this as that was taken to show
% variablilty of data with single calibration and weights data unfairly
% towards last calibration

V1Raw = [410.8 410 412 410]; %Violet 1 data
V2Raw = [435.5 434 436 434]; %Violet 2 data
GBRaw = [488.8 486 489 486]; %Green Blue data
RRaw = [666 657 666 656];    %Red data

V1 = mean(V1Raw);
V2 = mean(V2Raw);
GB = mean(GBRaw);
R = mean(RRaw);

for n=3:10
%Candidates for R from Violet 1 data
RV1(n) = V1 * (1/4 - 1/n.^2);
RV1(n) = 1/RV1(n);

%Candidates for R from Violet 2 data
RV2(n) = V2 * (1/4 - 1/n.^2);
RV2(n) = 1/RV2(n);

%Candidates for R from green blue data
RGB(n) = GB * (1/4 - 1/n.^2);
RGB(n) = 1/RGB(n);

%Candidates for R from Red data
RR(n) = R * (1/4 - 1/n.^2);
RR(n) = 1/RR(n);
end
RV1 = RV1.* 1E9;
RV2 = RV2.* 1E9;
RGB = RGB.* 1E9;
RR = RR.* 1E9;

n = 1:10;
figure(1);
plot(n(3:10), RV1(3:10), 'b');
hold on;
plot(n(3:10), RV2(3:10),'b--');
plot(n(3:10), RGB(3:10),'g');
plot(n(3:10), RR(3:10),'r');
hold off; grid on;

Rydberg = RR(3) + RGB(4) + RV2(5) + RV1(6); Rydberg = Rydberg/4
R(n) = Rydberg;

figure(1); hold on; plot(n(3:10), R(3:10), 'k');hold off;
title(sprintf('Averaged Data from Balmer lab: R = %.3E', Rydberg));
legend('Violet 1', 'Violet 2', 'Blue-Green', 'Red', 'Calculated R', -1);
xlabel('Value of n2');
ylabel('Possible Value of R');
```