from __future__ import division
# Given data
V_GS = 0 # in V
I_D = 4 # in mA
R = 2 # in kohm
V_DD = 15 # in V
V_DS = V_DD - (I_D*R) # in V
g_m = 2000 # in µS
g_m= g_m*10**-6 # in S
g_mo = g_m # in S
R_D = 2 # in kohm
R_D = R_D * 10**3 # in ohm
R_L = 10 # in kohm
R_L = R_L * 10**3 # in ohm
r_d = (R_D*R_L)/(R_D+R_L) # in ohm
A_v = g_m*r_d
V_in = 20 # in mV
V_out = A_v * V_in # in mV
print "The output voltage = %0.1f mV" %V_out
# Given data
V1 = 20 # in V
V2 = 2 # in V
V = V1-V2 # in V
R = 1 # in kohm
R = R * 10**3 # in ohm
I_D = V/R # in A
I_D = I_D * 10**3 # in mA
print "The drain current = %0.f mA" %I_D
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
# Given data
I_DSS = 10 # in mA
V_GS = 0 # in V
I_D = 0 # in mA
V_P = -4 # in V
V_GS= np.arange(0,V_P,-0.1) # in V
I_D = I_DSS*(1-(V_GS/V_P))**2 # mA
plt.plot(V_GS,I_D)
plt.xlabel("V_gs in volts")
plt.ylabel("I_D in mA")
plt.title("Transfer characteristics for an n-channel depletion type MOSFET")
print "Transfer characteristics for an n-channel depletion type MOSFET Shown in figure"
# Given data
V_GS = 0 # in V
I_DSS = 10 # in mA
I_D = I_DSS # in mA
R_D = 1.5 # in kohm
V_DD = 20 # in V
V_DS = V_DD - (I_D*R_D) # in V
print "The value of V_DS = %0.f V" %V_DS
# Given data
I_D = 5 # in mA
V_GS1 = 8 # in V
V_GS2 = 4 # in V
V_GS = 6 # in V
K = I_D/(V_GS1-V_GS2)**2 # in mA/V**2
I_D = K*(V_GS-V_GS2)**2 # in mA
print "The drain current = %0.2f mA" %I_D
# Given data
V_T = 1 # in V
I_D = 4 # in mA
V_GS = 5 # in V
V_GSth = 1 # in V
K = I_D/(V_GS-V_GSth)**2 # in mA/V**2
print "The value of K = %0.2f mA/V**2" %K
# Given data
V_GS = 3 # in V
V_GSth=2 # inV
# Part (a)
print "Part (a) : For V_DS= 0.5 V"
V_DS= 0.5 # in V
if V_DS<(V_GS-V_GSth) :
print "Transistor is in ohmic region"
else :
print "Transistor is in saturation region"
# Part (b)
print "Part (b) : For V_DS= 1 V"
V_DS= 1 # in V
if V_DS<(V_GS-V_GSth) :
print "Transistor is in ohmic region"
else :
print "Transistor is in saturation region"
# Part (c)
print "Part (c) : For V_DS= 5 V"
V_DS= 5 # in V
if V_DS<(V_GS-V_GSth) :
print "Transistor is in ohmic region"
else :
print "Transistor is in saturation region"
# Given data
I_DSS = 4 # in mA
V_GSoff = -2 # in V
V_GS = -0.5 # in V
I_D = I_DSS*(1-(V_GS/V_GSoff))**2 # in mA
print "At V_GS=-0.5 V, the drain current = %0.2f mA" %I_D
V_GS = -1 #in V
I_D = I_DSS*(1-(V_GS/V_GSoff))**2 # in mA
print "At V_GS=-1.0 V, the drain current = %0.f mA" %I_D
V_GS = -1.5 # in V
I_D = I_DSS*(1-(V_GS/V_GSoff))**2 # in mA
print "At V_GS=-1.5 V, the drain current = %0.2f mA" %I_D
# Given data
I_DSS = 12 # in mA
I_DSS= I_DSS*10**-3 # in A
I_D = I_DSS # in A
V_DD = 12 # in V
R_D = 470 # in ohm
V_DS = V_DD - (I_D*R_D) # in V
print "The circuit drain current = %0.f mA" %(I_D*10**3)
print "The drain source voltage = %0.2f V" %V_DS
# Given data
I_D = 12 # in mA
I_D= I_D*10**-3 # in A
I_DSS = I_D # in A
V_DS = 6.36 # in V
g_mo = 4000 # in µS
g_mo=g_mo*10**-6 # in S
g_m = g_mo # in S
R_D = 470 # in ohm
R_L = 2 # in kohm
R_L = R_L * 10**3 # in ohm
r_d = (R_D*R_L)/(R_D+R_L) # in ohm
print "The value of r_d = %0.2f Ω" %r_d
A_v = g_m*r_d
print "The value of A_v = %0.2f" %A_v
V_in = 100 # in mV
V_in = V_in *10**-3 # in V
V_out = A_v*V_in # in V
print "The value of Vout = %0.2f V" %V_out
# Given data
V_DS = 0.1 # in V
I_D = 10 # in mA
I_D= I_D*10**-3 # in A
R_DS = V_DS/I_D # in ohm
print "Part (a) The value of R_DS(on) = %0.f ohm" %R_DS
V_DS = 0.75 # in V
I_D = 100 # in mA
I_D= I_D*10**-3 # in A
R_DS = V_DS/I_D # in ohm
print "Part (b) The value of R_DS(on) = %0.1f ohm" %R_DS
from __future__ import division
# Given data
I_D = 500 # in mA
V_GS = 3 # in V
R_DS = 2 # in ohm
V_DD = 20 # in V
R1 = 1 # in kohm
R1 = R1 * 10**3 # in ohm
V_out = (R_DS/(R1+R_DS))*V_DD # in V
print "The output voltage = %0.2f V" %V_out