Untitled

 avatar
unknown
plain_text
2 years ago
1.2 kB
4
Indexable
import numpy as np
import matplotlib.pyplot as plt

# Constants
k = 8.617333262145e-5  # Boltzmann constant in eV/K
T = 300  # Temperature in Kelvin
E_F = 0  # Fermi energy level, assumed to be at 0 eV for simplicity

# Energy range
E = np.linspace(-0.5, 0.5, 1000)  # Energy range from -0.5 eV to 0.5 eV

# Fermi-Dirac distribution function
def fermi_dirac(E):
    return 1 / (1 + np.exp((E - E_F) / (k * T)))

# Plotting the Fermi-Dirac distribution function
plt.figure(figsize=(8, 6))

# Plot for n-type semiconductor (Fermi level slightly above mid-gap)
E_F_n_type = 0.05  # Fermi level for n-type
plt.plot(E, fermi_dirac(E - E_F_n_type), label='n-type (E_F > 0)', color='blue')

# Plot for p-type semiconductor (Fermi level slightly below mid-gap)
E_F_p_type = -0.05  # Fermi level for p-type
plt.plot(E, fermi_dirac(E - E_F_p_type), label='p-type (E_F < 0)', color='red')

# Fermi level lines
plt.axvline(x=E_F_n_type, linestyle='--', color='blue', label='Fermi level (n-type)')
plt.axvline(x=E_F_p_type, linestyle='--', color='red', label='Fermi level (p-type)')

# Set plot properties
plt.title('Fermi-Dirac Distribution Function')
plt.xlabel('Energy (eV)')
plt.ylabel('Probability of Occupancy')
plt.legend()
plt.grid(True)
plt.show()
Editor is loading...
Leave a Comment