hw2_num1and2_submit
pdf
keyboard_arrow_up
School
University of South Florida *
*We aren’t endorsed by this school
Course
4931
Subject
Mathematics
Date
Feb 20, 2024
Type
Pages
8
Uploaded by BaronTurtleMaster4039
clear; clc; %HW 2 due 9/15 by 5 pm
M1 = 10 * 10000; % M1 = 10cm =~ 1E5 um from beam splitter
M2 = M1; % M2 is also 10cm
dist = 0:0.025:2 % increment of distance (in um) M2 is moving away from beam splitter
dist = 1×81
0 0.0250 0.0500 0.0750 0.1000 0.1250 0.1500 0.1750
M2 = M1 + dist M2 = 1×81
10
5
×
1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000
lambda_nm = 350:50:800; %wavelengths using 350nm to 800nm in increments of 50 nm
lambda_um = lambda_nm ./ 1000
lambda_um = 1×10
0.3500 0.4000 0.4500 0.5000 0.5500 0.6000 0.6500 0.7000
a = length(lambda_um);
b = linspace(dist(1), dist(end), a);
array = [lambda_um; b];
%Compute the resultant intensity of light at the detector.
%1.A.a % Plot intensity data for each wavelength ("lambda") separately in a
% 5(row)X2(column) plots
initialIntensity = 0; for j = 1:length(lambda_um)
Intensity(j, :) = initialIntensity + (cos( (pi .* dist) ./ lambda_um(j) )).^2;
subplot(5, 2, j); plot(dist, Intensity(j, :)) subplot(5,2,j) title([
'Intensity at '
, num2str(lambda_nm(j)),
'nm'
] ) sgtitle(
'Intensity Plots at each Wavelength on M2"s distance from beam splitter'
)
xlabel(
'Distance (um)'
)
ylabel(
'Intensity (W/m^2)'
)
end
1
%2
%a) You'll need to calculate the phase shift between % the light paths that was introduced by moving M2
%phaseShiftM2 = (4*pi* (M2(end) - M2(1)) ) ./ lambda_um %phaseShifted = (4*pi*dist) ./ lambda_um phaseShift = zeros([length(lambda_um) 81]);
for j = 1:length(lambda_um)
phaseShift(j,:) = ( (4*pi) .* dist) ./ (lambda_um(j)) ;
end %2 b) figure;
plot(dist,phaseShift(1,:)); xlabel(
'Distance (um)'
); ylabel(
'Phase Output'
); title(
'Phase Shift over Distance'
)
%b) Next, calculate the sum of two sine waves with that phase shift. % -->Sample the sine waves at 0.1*π increments through % one complete cycle (2π) and add the values at each sample point. cycle = 0 : (0.1*pi) : 2*pi %this is how the directions wanted it
cycle = 1×21
0 0.3142 0.6283 0.9425 1.2566 1.5708 1.8850 2.1991
cycleL = length(cycle); %using this length to scale down the matrix size of shift and sin calculations bc it's supposed to be 21, not 81
cycleLonger = linspace(cycle(1), cycle(end), 81)
cycleLonger = 1×81
2
0 0.0785 0.1571 0.2356 0.3142 0.3927 0.4712 0.5498
sincyclefull = sin(cycleLonger); sinShiftIncfull = sin(phaseShift + cycleLonger); %sinShifted2pi = sin(phaseShift + 2*pi); sinShiftedpi = sin(phaseShift + pi); sumfull = sinShiftIncfull + sincyclefull; d1 = linspace(phaseShift(1), phaseShift(end), cycleL); %condensing the 81 columns to 21
%d2 = linspace(sinShift(1), sinShift(end), cycleL);
%d3 = linspace(sinShift(1), sinShift(end), cycleL); %only for sample 1
dist_cycle = linspace(dist(1), dist(end), cycleL);
tiledlayout(5,4)
for k = cycleL
sinPhaseShift(k, :) = sin(d1); sinCycle(k,:) = sin(cycle);
sinShiftIncrem(k,:) = sin(d1 + cycle); sumSin(k,:) = sinCycle(k,:) + sinShiftIncrem(k,:);
nexttile
plot(dist_cycle, sinPhaseShift(k,1), 'g'
) xlabel(
'Distance (um)'
); ylabel(
'Phase Output'
)
title(
'Sin Wave of Phase Shift'
) hold on
plot(dist_cycle, sinCycle(k,2), 'c'
)
xlabel(
'Distance (um)'
); ylabel(
'Phase Output'
)
title(
'Sin Wave of Cycle'
)
hold on
plot(dist_cycle, sinShiftIncrem(k,3), 'r'
)
xlabel(
'Distance (um)'
); ylabel(
'Phase Output'
)
title(
'Sin Wave of PhaseShift+Cycle'
)
%hold on
%plot(cycle, sumSin(k,4), 'r')
%xlabel('Radians'); ylabel('Phase Output')
3
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
%title('Sin Wave of PhaseShift+Cycle')
hold off
end % testing outside of for loop
figure;
plot(dist_cycle, sinPhaseShift(21,:), 'm'
)
xlabel(
'Distance (um)'
); ylabel(
'Phase Output'
)
title(
'Sin Wave of Phase Shift Partial'
) hold on
plot(dist,sinShiftIncfull(1,:),
'b'
)
xlabel(
'Distance (um)'
); ylabel(
'Phase Output'
)
title(
'Sin Wave of Phase Shift Full'
) hold off
figure;
plot(dist_cycle, sinCycle(21,:),
'g'
)
xlabel(
'Distance (um)'
); ylabel(
'Phase Output'
)
title(
'Sin Wave of Cycle'
)
4
figure;
plot(dist_cycle, sinShiftIncrem(21,:), 'm'
)
xlabel(
'Distance (um)'
); ylabel(
'Phase Output'
)
title(
'Sin Wave of PhaseShift+Cycle Approach A (partial)'
)
hold on
plot(dist, sinShiftIncfull(1,:), 'b'
)
xlabel(
'Distance (um)'
); ylabel(
'Phase Output'
)
title(
'Sin Wave of PhaseShift+Cycle Approach A (full)'
)
hold off
figure;
plot(dist_cycle, sumSin(21,:), 'm'
)
xlabel(
'Distance (um)'
); ylabel(
'Phase Output'
)
title(
'Sin Wave of PhaseShift+Cycle partial'
)
hold on
plot(dist, sumfull(1,:), 'b'
)
xlabel(
'Distance (um)'
); ylabel(
'Phase Output'
)
title(
'Sin Wave of PhaseShift+Cycle full'
)
hold off
5
%c) Then to compute intensity, square each value of the summed sine wave % (recall Intensity is proportional to Amplitude^2)
sumSquared = ( (sinCycle + sinShiftIncrem) .^2);
figure; plot(dist_cycle, sumSquared(21,:), 'r'
)
xlabel(
'Distance (um)'
); ylabel(
'Phase Output'
)
title(
'Intensity is proportional to Amplitude Squared'
)
%d) Sum the 21 values and divide by 21 to achieve the average intensity
avg21 = mean( sumSquared(21,:) );
fprintf(
'The average intensity is %f for the 21 samples'
, avg21)
The average intensity is 0.952381 for the 21 samples
2. Using the interferometer from problem 1, we will measure the index of refraction (n) of a thin piece of glass.
A. Introduce into the middle of the light path from the beam splitter to M1 (at the 5 cm location) a piece of glass 1mm thick. For the purpose of this 6
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
problem, assume that the glass has index of refraction n = 1.4.
M1_prob2 = 5*100 %5cm or 500um from beam splitter M1_prob2 = 500
n = 1.4;
thickmm = 1; %thickness of glass is 1mm
thickum = thickmm*1000 %converting to microns
thickum = 1000
%Plot intensity profile while moving M2 as in #1 % without and with the piece of glass in the light path.
lambdanm = M1_prob2; %wavelength lambda is 500nm
lambdaum = lambdanm / 1000;
M1Refraction = lambdaum / n;
figure;
intensity2a = ( cos( (pi .* dist) ./ lambdaum) ).^2 ;
intensity2a = 1×81
1.0000 0.9755 0.9045 0.7939 0.6545 0.5000 0.3455 0.2061
plot(dist, intensity2a, '.b'
)
hold on
optPathDiff = 2*thickum*(n-1);
phaseShift2 = ( (2*pi) / lambdaum) * optPathDiff;
intensity2b = (cos( (phaseShift2-thickum) + ((pi.*dist)./lambdaum) )).^2 ;
intensity2b = 1×81
0.3163 0.4690 0.6247 0.7682 0.8855 0.9650 0.9990 0.9842
plot(dist, intensity2b, '-g'
)
xlabel(
'distance (um)'
); ylabel(
'Intensity'
);
title(
'Intensity Profile due to Glass'
)
legend(
'Without Glass'
, 'With Glass'
)
hold off
7
8