import math
# Given parameters
rop2 = 1e6 # in ohms (Ω), example value
ron4 = 1e6 # in ohms (Ω), example value
rop6 = 1e6 # in ohms (Ω), example value
ron5 = 1e6 # in ohms (Ω), example value
gm2 = 5e-3 # in Siemens (S), example value
gm5 = 5e-3 # in Siemens (S), example value
Cf = 1e-12 # Capacitance in Farads (F), example value
# Calculate parameters a and b
a = (rop2 * ron4) / (rop2 + ron4)
b = (rop6 * ron5) / (rop6 + ron5)
# Calculate DC gain
DC_gain = gm2 * (rop2 * ron4 / (rop2 + ron4)) * gm5 * (rop6 * ron5 / (rop6 + ron5))
# Convert DC gain to dB
DC_gain_dB = 20 * math.log10(DC_gain)
# Calculate pole frequency (f1)
f1 = 1 / (2 * math.pi * a * (1 + gm5 * b) * Cf)
# Calculate GB product
GB_product = DC_gain * f1
# Print results
print(f"DC Gain: {DC_gain:.4f}")
print(f"DC Gain (dB): {DC_gain_dB:.4f} dB")
print(f"Pole Frequency (f1): {f1:.4f} Hz")
print(f"GB Product: {GB_product:.4f}")
import math
# Given parameters
gm = 10e-3 # Transconductance in Siemens (S)
rop = 1e6 # Output resistance in ohms (Ω), example value
ron = 1e6 # Input resistance in ohms (Ω), example value
C = 10e-12 # Capacitance in Farads (F)
R = 1e3 # Resistance in ohms (Ω), example value
# Calculate DC gain
DC_gain = gm * (rop * ron / (rop + ron))
# Convert DC gain to dB
DC_gain_dB = 20 * math.log10(DC_gain)
# Calculate mirror effect capacitance
mirror_capacitance = C * (1 + DC_gain)
# Calculate pole frequency (f1)
f1 = 1 / (2 * math.pi * R * mirror_capacitance)
# Print results
print(f"DC Gain: {DC_gain:.4f}")
print(f"DC Gain (dB): {DC_gain_dB:.4f} dB")
print(f"Mirror Effect Capacitance: {mirror_capacitance:.4e} F")
print(f"Pole Frequency (f1): {f1:.4f} Hz")
import math
# Given parameters
A1_dB = 20 # Desired gain A1 in dB
A2_dB = 40 # Desired gain A2 in dB
rop2 = 10e3 # Output resistance of M2 in ohms
ron4 = 10e3 # Input resistance of M2 in ohms
rop6 = 10e3 # Output resistance of M5 in ohms
ron5 = 10e3 # Input resistance of M5 in ohms
Cc = 10e-12 # Capacitance Cc in Farads
CL = 100e-12 # Load capacitance CL in Farads
# Calculate a and b
a = (rop2 * ron4) / (rop2 + ron4)
b = (rop6 * ron5) / (rop6 + ron5)
# Calculate gm2 for A1
A1 = 10 ** (A1_dB / 20)
gm2 = A1 / a
# Calculate gm5 for A2
A2 = 10 ** (A2_dB / 20)
gm5 = A2 / b
# Calculate principal frequency f1
f1 = 1 / (2 * math.pi * a * Cc * (A2 + 1))
# Calculate 0 dB frequency GB product
GB_product_0dB = A1 * A2 * f1
# Calculate second frequency f2 assuming very large Cc
f2 = gm5 / (2 * math.pi * CL)
# Print results
print(f"a: {a:.4e}")
print(f"b: {b:.4e}")
print(f"gm2: {gm2:.4e} S")
print(f"gm5: {gm5:.4e} S")
print(f"Principal Frequency (f1): {f1 / 1e6:.4f} MHz")
print(f"0 dB Frequency GB Product: {GB_product_0dB / 1e6:.4f} MHz")
print(f"Second Frequency (f2): {f2 / 1e6:.4f} MHz")
fは遮断周波数
import math
# Given values
gain_dB = 26
gm = 10e-3 # 10 mS (10 millisiemens)
f = 1e6 # 1 MHz
# Calculate R
gain = 10**(gain_dB / 20)
R = gain / (gm * 10**3) # converting mS to S
# Calculate C
C = 1 / (2 * math.pi * R * f)
print(f"R ≈ {R/1000:.2f} kΩ")
print(f"C ≈ {C * 1e12:.2f} pF")
import numpy as np
import matplotlib.pyplot as plt
from scipy import signal
# Given parameters (adjust these values as needed)
gm = 35e-6 # Transconductance in siemens
Rd = 50e6 # Drain resistance in ohms
Ci = 1e-12 # Input capacitance in farads
Cc = 1e-12 # Compensation capacitance in farads
Rs = 50e3 # Source resistance in ohms
C0 = 1e-12 # Load capacitance in farads
rL = Rd # Load resistance
# Calculate gain
gain = gm * Rd
print(f"Gain (gm * Rd): {gain}")
# Calculate Miller effect capacitance
Cm = Ci + Cc * (1 + gain)
print(f"Miller Effect Capacitance (Cm): {Cm}")
# Calculate angular frequencies ωA and ωB
ωA = 1 / (Cm * Rs)
ωB = 1 / (C0 * rL)
print(f"Angular Frequency ωA: {ωA}")
print(f"Angular Frequency ωB: {ωB}")
# Transfer function H(s) = -gm * Rd / [(1 + s/ωA) * (1 + s/ωB)]
numerator = [-gain]
denominator = [1, (1/ωA + 1/ωB), 1/(ωA * ωB)]
system = signal.TransferFunction(numerator, denominator)
# Frequency response
w, mag, phase = signal.bode(system)
# Plot Bode magnitude plot
plt.figure()
plt.semilogx(w, mag)
plt.title('Bode Plot - Magnitude')
plt.xlabel('Frequency [rad/s]')
plt.ylabel('Magnitude [dB]')
plt.grid(which='both', linestyle='-', color='grey')
plt.show()
# Plot Bode phase plot
plt.figure()
plt.semilogx(w, phase)
plt.title('Bode Plot - Phase')
plt.xlabel('Frequency [rad/s]')
plt.ylabel('Phase [degrees]')
plt.grid(which='both', linestyle='-', color='grey')
plt.show()