如何使用 UliEngineering 在 Python 中绘制 Shockley 二极管电流

你可以使用 UliEngineering Python 库轻松地以线性和对数两种形式绘制 Shockley 二极管电流。

plot_shockley_diode_current.py
from UliEngineering.Electronics.Diode import shockley_diode_current
import matplotlib.pyplot as plt
import numpy as np

plt.style.use('ggplot')

voltages = np.linspace(0, 0.8, 400)
current = shockley_diode_current(voltages, "1pA")

# 线性图
plt.figure(figsize=(6, 4))
plt.plot(voltages, current)
plt.title('Shockley diode current (linear)')
plt.xlabel('Voltage (V)')
plt.ylabel('Current (A)')
plt.grid(True, which='both', linestyle='--', linewidth=0.5)
plt.tight_layout()
plt.savefig('shockley_diode_current_linear.svg')
plt.close()

# 对数图
plt.figure(figsize=(6, 4))
plt.plot(voltages, np.maximum(current, 1e-20))
plt.title('Shockley diode current (log)')
plt.xlabel('Voltage (V)')
plt.ylabel('Current (A)')
plt.yscale('log')
plt.grid(True, which='both', linestyle='--', linewidth=0.5)
plt.tight_layout()
plt.savefig('shockley_diode_current_log.svg')

shockley diode current linear.svg

shockley diode current log.svg


Check out similar posts by category: Electronics, Python