
function R=reflexionTE(n1,n2,theta1)
    cosTheta2=sqrt(1-(n1*sin(theta1)/n2)^2);
    R=abs((n1*cos(theta1)-n2*cosTheta2)/(n1*cos(theta1)+n2*cosTheta2))^2
endfunction
function R=reflexionTM(n1,n2,theta1)
    cosTheta2=sqrt(1-(n1*sin(theta1)/n2)^2);
    R=abs((n2*cos(theta1)-n1*cosTheta2)/(n2*cos(theta1)+n1*cosTheta2))^2
endfunction
            

function [R]=reflexNormale(n,kappa)
    npts=length(kappa);
    R=zeros(npts);
    for p=1:npts,
        R(p)=reflexionTE(1,n-%i*kappa(p),0);
    end,
endfunction
                
kappa=[0:0.01:10];
plot1=scf();
plot2d(kappa,reflexNormale(0.5,kappa),style=4,rect=[0,0,10,1.5]);
plot2d(kappa,reflexNormale(1,kappa),style=5);
plot2d(kappa,reflexNormale(2,kappa),style=6);
plot2d(kappa,reflexNormale(4,kappa),style=9);
xtitle("","K","R");
legend("n=0.5","n=1","n=2","n=4");
                
R=reflexNormale(1.44,5.32)
R=reflexNormale(8,1.2)
getf('multilayer.sci');
function [R,T,A]=reflexionLame(n,kappa,e)
    npts=length(e);
    R=zeros(npts);
    T=zeros(npts);
    A=zeros(npts);
    for p=1:npts,
        [R(p),T(p)]=coefficientsRTpuissances(1,1,0,1,1,[n-%i*kappa,e(p)]);
        A(p)=1-T(p)-R(p);
    end,
endfunction
            
e=[0:0.001:2];
[R1,T1,A1]=reflexionLame(2,0.1,e);
[R2,T2,A2]=reflexionLame(2,0.2,e);
[R3,T3,A3]=reflexionLame(2,0.5,e);
            
plotB=scf();
plot2d(e,R1,style=5,rect=[0,0,2,1]);
plot2d(e,R2,style=6);
plot2d(e,R3,style=9);
legend("n=2, K=0.1","n=2, K=0.2", "n=2, K=0.5");
xtitle("Reflexion","e/lambda","R");
            
plotC=scf();
plot2d(e,T1,style=5,rect=[0,0,2,1]);
plot2d(e,T2,style=6);
plot2d(e,T3,style=9);
legend("n=2, K=0.1","n=2, K=0.2", "n=2, K=0.5");
xtitle("Transmission","e/lambda","R");
            
plotD=scf();
plot2d(e,A1,style=5,rect=[0,0,2,1.5]);
plot2d(e,A2,style=6);
plot2d(e,A3,style=9);
legend("n=2, K=0.1","n=2, K=0.2", "n=2, K=0.5");
xtitle("Absorption","e/lambda","R");
            
e=[0:0.001:0.5];
[R1,T1,A1]=reflexionLame(2,2,e);
[R2,T2,A2]=reflexionLame(2,3,e);
[R3,T3,A3]=reflexionLame(2,5,e);
            
plotE=scf();
plot2d(e,R1,style=5,rect=[0,0,0.5,1]);
plot2d(e,R2,style=6);
plot2d(e,R3,style=9);
legend("n=2, K=2","n=2, K=3", "n=2, K=5");
xtitle("Reflexion","e/lambda","R");
            
plotF=scf();
plot2d(e,T1,style=5,rect=[0,0,0.5,1]);
plot2d(e,T2,style=6);
plot2d(e,T3,style=9);
legend("n=2, K=2","n=2, K=3", "n=2, K=5");
xtitle("Transmission","e/lambda","R");
            
plotG=scf();
plot2d(e,A1,style=5,rect=[0,0,0.5,1.5]);
plot2d(e,A2,style=6);
plot2d(e,A3,style=9);
legend("n=2, K=2","n=2, K=3", "n=2, K=5");
xtitle("Absorption","e/lambda","R");
            
e=[0:0.001:0.5];
[R1,T1,A1]=reflexionLame(8,1.9,e);
                
plotH=scf();
plot2d(e,R1,style=5,rect=[0,0,0.5,1]);
plot2d(e,T1,style=9);
plot2d(e,A1,style=14);
legend("R","T","A");
xtitle("Eau (10 GHz)","e/lambda","");
                
