-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_brewster.m
More file actions
61 lines (51 loc) · 1.54 KB
/
plot_brewster.m
File metadata and controls
61 lines (51 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
function [minTheta,minFv] = plot_brewster(epsilon1,epsilon2,plotflag)
%PLOT_BREWSTER Plots the Fresnel reflection coefficients vs the incident
%angle
if (nargin <= 2)
plotflag = 'on';
end
N = 200;
N = N+1;
theta = linspace(0,0.5*pi,N);
fresnel_h = zeros(N,1);
fresnel_v = zeros(N,1);
for i = 1:N
[fresnel_h(i),fresnel_v(i)] = Fresnel_reflection(epsilon1,epsilon2,theta(i));
end
[minFv,mini] = min(abs(fresnel_v));
minTheta = theta(mini);
if (strcmp(plotflag,'on'))
figure
plot(theta,abs(fresnel_h))
hold on
plot(theta,abs(fresnel_v))
xline(minTheta);
yline(0);
scatter(minTheta,minFv,'r','LineWidth',2)
hold off
xticks(0:pi/8:pi/2)
xticklabels({'0','\pi/8','\pi/4','3\pi/8','\pi/2'})
axis([0 pi/2 0 1])
title('Magnitude of the Fresnel Reflection Coefficients')
xlabel('\theta_i [rad]')
ylabel('|\Gamma|')
legend({'|\Gamma_H|','|\Gamma_V|'})
text(minTheta+0.02,minFv+0.05,[sprintf('Brewster''s Angle =\n'),num2str(minTheta/pi),'\pi rad'])
figure
plot(theta,angle(fresnel_h))
hold on
plot(theta,angle(fresnel_v))
xline(minTheta);
yline(0);
hold off
xticks(0:pi/8:pi/2)
yticks(-pi:pi/2:pi)
xticklabels({'0','\pi/8','\pi/4','3\pi/8','\pi/2'})
yticklabels({'-\pi','-\pi/2','0','\pi/2','\pi'})
axis([0 pi/2 -pi pi])
title('Phase of the Fresnel Reflection Coefficients')
xlabel('\theta_i [rad]')
ylabel('\angle\Gamma [rad]')
legend({'\angle\Gamma_H','\angle\Gamma_V'})
end
end