# variable declaration
g_m=4.0*10**-3; #gm value
R_d=1.5*10**3; #resistance
#calculation
A_v=g_m*R_d; #voltage gain
#result
print "Voltage gain = %.2f" %A_v
# variable declaration
r_ds=10.0*10**3;
R_d=1.5*10**3; #from previous question
g_m=4.0*10**-3; #from previous question
#calculation
A_v=g_m*((R_d*r_ds)/(R_d+r_ds)); #voltage gain
#result
print "Voltage gain = %.2f" %A_v
# variable declaration
R_s=560; #resistance in ohm
R_d=1.5*10**3; #resistance in ohm
g_m=4*10**-3; #g_m value
#calculation
A_v=(g_m*R_d)/(1+(g_m*R_s)) #voltage gain
#result
print "Voltage gain = %.2f" %A_v
#Variable declaration
vdd=12.0 #volts
Id=1.96*10**-3 #Amp
Rd=3.3*10**3 #ohm
Idss=12.0*10**-3 #Amp
Rs=910 # Ohm
vgsoff= 3 #v
vin=0.1 #V
#calculation
vd=vdd-(Id*Rd)
vgs=-Id*Rs
gm0=2*Idss/(abs(vgsoff))
gm=0.00325 #mS
vout=gm*Rd*vin
vout=vout*2*1.414
#Result
print"Total output ac voltage(peak-to-peak) = %f V \nridig on DC value of %fV "%(vout,vd)
# variable declaration
R_D=3.3*10**3; #resistance in ohm
R_L=4.7*10**3; #load resistance in ohm
g_m=3.25*10**-3; #from previous question
V_in=100.0*10**-3; #previous question
#calculation
R_d=(R_D*R_L)/(R_D+R_L); #Equivalent drain resistance
V_out=g_m*R_d*V_in; #output RMS voltage in volt
#result
print "Output voltage rms value = %.2f Volts" %V_out
# variable declaration
I_GSS=30.0*10**-9; #current in ampere
V_GS=10.0; #ground-source voltage
R_G=10.0*10**6; #resistance in ohm
#calculation
R_IN_gate=V_GS/I_GSS; #gate input resistance
R_in=(R_IN_gate*R_G)/(R_IN_gate+R_G); #parallel combination
#result
print "Input resistance as seen by signal source = %.2f ohm" %R_in
# variable declaration
I_DSS=200.0*10**-3;
g_m=200.0*10**-3;
V_in=500.0*10**-3;
V_DD=15.0;
R_D=33.0;
R_L=8.2*10**3;
#calculation
I_D=I_DSS; #Amplifier is zero biased
V_D=V_DD-I_D*R_D;
R_d=(R_D*R_L)/(R_D+R_L);
V_out=g_m*R_d*V_in;
#result
print "DC output voltage = %.2f Volts" %V_D
print "AC output voltage = %.2f volts" %V_out
# Theoretical example
# result
print "Part A:\nQ point: V_GS=-2V I_D=2.5mA. At V_GS=-1V, I_D=3.4mA,"
print "At V_GS=-3V, I_D=1.8mA. So peak to peak drain current is"
print "the difference of the two drain currents=1.6mA"
print "\nPart B:\nQ point: V_GS=0V I_D=4mA. At V_GS=1V, I_D=5.3mA,"
print "At V_GS=-1V, I_D=2.5mA. So peak to peak drain current is"
print" the difference of the two drain currents=2.8mA"
print "\nPart C:\nQ point: V_GS=8V I_D=2.5mA. At V_GS=9V, I_D=3.9mA,"
print " At V_GS=7V, I_D=1.7mA. So peak to peak drain current is"
print " the difference of the two drain currents=2.2mA"
# variable declaration
R_1=47.0*10**3;
R_2=8.2*10**3;
R_D=3.3*10**3;
R_L=33.0*10**3;
I_D_on=200.0*10**-3;
V_GS=4.0;
V_GS_th=2.0;
g_m=23*10**-3;
V_in=25*10**-3;
V_DD=15.0;
#calculation
V_GSnew=(R_2/(R_1+R_2))*V_DD;
K=I_D_on/((V_GS-V_GS_th)**2)
#K=value_of_K(200*10**-3,4,2);
K=K*1000;
I_D=K*((V_GSnew-V_GS_th)**2);
V_DS=V_DD-I_D*R_D/1000;
R_d=(R_D*R_L)/(R_D+R_L);
V_out=g_m*V_in*R_d;
#result
print "Drain to source voltage = %.2f volts" %V_GSnew
print "Drain current = %.2f mA" %I_D
print "Gate to source voltage = %.2f volts" %V_DS
print "AC output voltage = %.2f volts" %V_out
print "Answer in textbook are approximated"
# variable declaration
V_DD=-15.0; #p=channel MOSFET
g_m=2000.0*10**-6; #minimum value from datasheets
R_D=10.0*10**3;
R_L=10.0*10**3;
R_S=4.7*10**3;
#calculation
R_d=(R_D*R_L)/(R_D+R_L); #effective drain resistance
A_v=g_m*R_d;
R_in_source=1.0/g_m;
#signal souce sees R_S in parallel with ip rest at source terminal(R_in_source)
R_in=(R_in_source*R_S)/(R_in_source+R_S);
#result
print "minimum voltage gain = %.2f" %A_v
print "Input resistance seen from signal source = %.2f ohms" %R_in