# -*- coding: utf-8 -*-
"""
Created on Thu Feb 17 08:36:08 2022

@author: mathi
"""
import matplotlib.pyplot as plt
import numpy as np

n1 = 1  #indice optique de l'air
n2 = 1.33 #indice optique de l'eau

thetai = np.linspace(0,np.pi/2,100)  #angle d'incidence
thetaideg = thetai*180/np.pi
thetat = np.arcsin(n1/n2 *np.sin(thetai)) #calcul de l'angle de réfraction

#### coeff de reflexion pour une onde incidente de polarisation contenue dans le plan d'incidence

r1 = (n1*np.cos(thetat)-n2*np.cos(thetai))/(n1*np.cos(thetat)+n2*np.cos(thetai))


#### coeff de reflexion pour une onde incidente de polarisation orthogonale au plan d'incidence
r2 = (n1*np.cos(thetai)-n2*np.cos(thetat))/(n1*np.cos(thetai)+n2*np.cos(thetat))

plt.plot(thetaideg,r1,label = "Polarisation dans le plan d'incidence")
plt.plot(thetaideg,r2,label="Polarisation orthogonale au plan d'incidence")
plt.title("Evolution du coefficient de réflexion avec l'angle d'incidence")
plt.xlabel("Angle d'incidence (°)")
plt.ylabel("Coefficient de réflexion r")
plt.legend()
plt.grid()
    