clear all;
%n1=1;
%n2=1.52;
n1=1.52;
n2=1;
n=n2./n1;
if n1
hold on
end
legend('Frp')
else
subplot(1,3,1)
qc=asin(n2./n1);
qa=0:0.0001:qc;
qb=asin(n1.*sin(qa)./n2);
rs=-sin(qa-qb)./sin(qa+qb);
rp=tan(qa-qb)./tan(qa+qb);
ts=2.*cos(qa).*sin(qb)./sin(qa+qb);
tp=2.*cos(qa).*sin(qb)./sin(qa+qb)./cos(qa-qb);
plot(qa*180./pi,rs,'r',qa*180./pi,rp,'c',qa*180./pi,ts,'b',qa*180./pi,
tp,'g')
hold on
qa=qc:0.0001:pi/2;
tp=0;
ts=0;
rs=1;
rp=1;
plot(qa*180./pi,rs,'r',qa*180./pi,rp,'c',qa*180./pi,ts,'b',qa*180./pi,
tp,'g')
hold on
legend('rs','rp','ts','tp')
%rs
qc=asin(n2./n1);
subplot(1,3,2)
for qa=0:pi/1000:qc
qb=asin(n1.*sin(qa)./n2);
rs=-sin(qa-qb)./sin(qa+qb);
if rs<=0
Frs=pi;
else
Frs=0;
end
plot(qa*180./pi,Frs,'r')
hold on
end
qa=qc:pi/1000:pi/2;
Frs= 2.*atan(sqrt(sin(qa).^2-(n.^2))./cos(qa));
plot(qa*180./pi,Frs,'r')
hold on
legend('Frs')
%rp
subplot(1,3,3)
for qa=0:pi/1000:qc;
qb=asin(n1.*sin(qa)./n2);
rp=tan(qa-qb)./tan(qa+qb);
if rp<=0
Frp=pi;
else
Frp=0;
end
plot(qa*180./pi,Frp,'b')
hold on
end
qa=qc:pi/1000:pi/2;
Frp= 2.*atan(sqrt(sin(qa).^2-(n.^2))./cos(qa)./n.^2);
plot(qa*180./pi,Frp,'b')
hold on
legend('Frp')
end