% Evaluation of Reflection Coefficient
% K. A. Connor 26 April 2007

% Dielectric Constants
epso=(1/36*pi)*1e-9;
epsr1=1;epsr2=4;
eps1=epsr1*epso;eps2=epsr2*epso;

% Intrinsic Impedances
muo=4*pi*1e-7;
eta1=sqrt(muo/eps1);
eta2=sqrt(muo/eps2);

% Indices of Refraction
n1=sqrt(epsr1);
n2=sqrt(epsr2);

% Incident and Transmitted Angles
thetai_deg=[0:.01:90];
thetai=thetai_deg.*pi./180;
thetat=asin(n1.*sin(thetai)./n2);

% Perpendicular Polarization
gamperp=(eta2.*cos(thetai)-eta1.*cos(thetat))./(eta2.*cos(thetai)+eta1.*cos(thetat));

% Parallel Polarization
gampar=(eta2.*cos(thetat)-eta1.*cos(thetai))./(eta2.*cos(thetat)+eta1.*cos(thetai));

% Plots
plot(thetai_deg,gamperp,'r',thetai_deg,gampar,'b');grid;
title('Reflection Coefficients');xlabel('Incident Angle');legend('Perpendicular','Parallel');

figure;plot(thetai_deg,abs(gamperp),'m',thetai_deg,abs(gampar),'g');grid;
title('Reflection Coefficient Magnitudes');xlabel('Incident Angle');legend('Perpendicular','Parallel');
