In [1]:

```
from __future__ import division
IDSS=10*10**(-3)
print "IDSS = %0.2f"%(IDSS)," ampere" # maximum drain current
VP=(-4)
print "VP= %0.2f"%(VP)," volts" # pinch off voltage
VGS=(-2)
print "VGS = %0.2f"%(VGS)," volts" # gate to source voltage
VDSmin=VGS-VP
print "VDSmin =VGS-VP=%0.2f"%(VDSmin)," volts" # Drain to source voltage
ID=IDSS*(1-VGS/VP)**2
print "ID =IDSS*(1-VGS/VP)**2= %0.2e"%(ID)," ampere" # drain current
```

In [6]:

```
from __future__ import division
IDSS=10*10**(-3)
print "IDSS = %0.2f"%(IDSS)," ampere" # maximum drain current
VP=(-4)
print "VP= %0.2f"%(VP)," volts" # pinch off voltage
VGS=(0)
print "VGS = %0.2f"%(VGS)," volts" # gate to source voltage1
RDS=1/((2*(IDSS/(-VP)))*(1-VGS/VP))#formula for JFET
print "RDS = 1/[(2*(IDSS/(-VP)))*(1-VGS/VP)]=%0.2f"%(RDS)," ohm" # drain to source resistance for VGS=0V
VGS=(-2)
print "VGS = %0.2f"%(VGS)," volts" # gate to source voltage2
RDS=1/((2*(IDSS/(-VP)))*(1-VGS/VP))
print "RDS = 1/[(2*(IDSS/(-VP)))*(1-VGS/VP)]=%0.2f"%(RDS)," ohm" # drain to source resistance for VGS=(-2)
```

In [3]:

```
from __future__ import division
ID=10*10**(-3)
print "ID = %0.2f"%(ID)," ampere" # given drain current
VDD=(24)
print "VDD= %0.2f"%(VDD)," volts" # Drain voltage
VT=(5)
print "VT= %0.2f"%(VT)," volts" # Threshold voltage
VGS=(10)
print "VGS= %0.2f"%(VGS)," volts" # gate to source voltage1
KF=ID/(VGS-VT)**2
print "KF = ID/(VGS-VT)**2 = %0.2e"%(KF)," A/V**2" # To calculate Scale factor for finding ID2
VDS=(7)
print "VDS =VGS= %0.2f"%(VDS)," volts" # drain to source voltage
VGS=(VDS)
ID=KF*(VGS-VT)**2
print "ID =KF*(VGS-VT)**2= %0.2e"%(ID)," ampere" # New drain current for VDS=24V
RL=(VDD-VDS)/ID
print "RL=(VDD-VDS)/ID= %0.2e"%(RL)+ " ohm" #calculation for load resistance at VDS=24V
```

In [6]:

```
from math import sqrt
from __future__ import division
print "part(i) "# part(i) of this question
IDSS=5*10**(-3)
print "IDSS = %0.2f"%(IDSS)," ampere" # maximum drain current JFET 1
VP=(2)
print "VP= %0.2f"%(VP)," volts" # pinch off voltage for JFET 1
IDQ=4.42*10**(-3)
print "IDQ = %0.2f"%(IDQ)," ampere" # drain current for JFET 1
gm=((2)*sqrt(IDQ*IDSS))/VP
print "gm =[(2)*sqrt(IDQ*IDSS)]/VP= %0.2e"%(gm)," A/V"# calculating transconductance for JFET with IDQ = 4.42 mA
print "part(ii) "# part(ii) of this question
IDQ=6.04*10**(-3)
print "IDQ = %0.2f"%(IDQ)," ampere" # drain current for JFET 1
IDSS=15*10**(-3)
print "IDSS = %0.2f"%(IDSS)," ampere" # maximum drain current JFET2
VP=(6)
print "VP= %0.2f"%(VP)," volts" # pinch off voltage for JFET2
gm=((2)*sqrt(IDQ*IDSS))/VP
print "gm =[(2)*sqrt(IDQ*IDSS)]/VP= %0.2e"%(gm)," A/V"# calculating transconductance for JFET with IDQ = 6.04 mA
print "part(iii) "# part(iii) of this question
IDQ=1*10**(-3)
print "IDQ = %0.2e"%(IDQ)," ampere" # drain current for EMOSFET 1
KF=0.25*10**(-3)
print "KF = %0.2e"%(KF)," A/V**2" # Scale factor for finding EMOSFET1
gm=sqrt(4*IDQ*KF)
print "gm =sqrt(4*IDQ*KF)= %0.2e"%(gm)," A/V"# calculating transconductance for EMOSFET1 with IDQ = 1 mA
print "part(iv) "# part(iv) of this question
IDQ=0.91*10**(-3)
print "IDQ = %0.2e"%(IDQ)," ampere" # drain current for EMOSFET 2
KF=0.375*10**(-3)
print "KF = %0.2e"%(KF)," A/V**2" # Scale factor for finding EMOSFET2
gm=sqrt(4*IDQ*KF)
print "gm =sqrt(4*IDQ*KF)= %0.2e"%(gm)," A/V"# calculating transconductance for EMOSFET2 with IDQ = 0.91 mA
```

In [1]:

```
from __future__ import division
IDQmax=5*10**(-3)
print "IDQmax = %0.2f"%(IDQmax)," ampere" # drain current for JFET for maximum transfer characteristics
IDmax=IDQmax# maximum drain current will be given by IDQmax
IDQmin=3*10**(-3)
print "IDQmin = %0.2f"%(IDQmin)," ampere" # drain current for JFET for minimum transfer characteristics
VDD=(20)
print "VDD= %0.2f"%(VDD)," volts" # Drain voltage supply
VDSmin=(6)
print "VDSmin= %0.2f"%(VDSmin)," volts" # minimum Drain to source voltage supply
ID=2.4*10**(-3)
print "ID = %0.2e"%(ID)," ampere" # drain current chosen for operation within max and min limits
VGG=3
print "VGG= %0.2f"%(VGG)," volts" # Gate voltage from fig.
Ri=100*10**(3)
print "Ri= %0.2e"%(Ri)+ " ohm" #eqivalent input resistance
RF=(VGG-0)/(ID-0)
print "RF= (VGG-0)/(ID-0)= %0.2f"%(RF)+ " ohm" #calculation for feedback resistance
R1=VDD*Ri/VGG #using formulae VGG=VDD*Ri/R1
print "R1= VDD*Ri/VGG= %0.2e"%(R1)+ " ohm" #calculation for first resistance R1 at input side
R2=R1*VGG/(VDD-VGG)
print "R2= R1*VGG/(VDD-VGG)= %0.2e"%(R2)+ " ohm" #calculation for second resistance R2 at input side
RL=(((VDD-VDSmin)/IDmax)-RF) # using formulae VDD=IDmax(RL+RF)+VDSmin
print "RL=[((VDD-VDSmin)/IDmax)-RF]=%0.2f"%(RL)+ " ohm" #Load resistance calculation
```

In [2]:

```
from __future__ import division
IDSS=50*10**(-3)
print "IDSS = %0.2f"%(IDSS)," ampere" # maximum drain current JFET
VP=(-10)
print "VP= %0.2f"%(VP)," volts" # pinch off voltage for JFET
VGSQ=(-5)
print "VGSQ= %0.2f"%(VGSQ)," volts" # Gate operating point voltage
ID=IDSS*(1-VGSQ/VP)**2
print "ID =IDSS*(1-VGS/VP)**2= %0.2f"%(ID)," ampere" # drain current JFET
RF=abs(VGSQ/ID)
print "RF= (VGSQ)/(ID)= %0.2f"%(RF)+ " ohm" #calculation for feedback resistance
```

In [3]:

```
from sympy import symbols,solve
from __future__ import division
IDSS=5*10**(-3)
print "IDSS = %0.2f"%(IDSS)," ampere" # maximum drain current JFET
RL=910
print "RL= %0.2f"%(RL)+ " ohm" #Load resistance
RF=2.29*10**(3)
print "RF= %0.2f"%(RF)+ " ohm" # feedback resistance
R1=12*10**(6)
print "R1= %0.2e"%(R1)+ " ohm" # first resistance R1 at input side
R2=8.57*10**(6)
print "R2= %0.2e"%(R2)+ " ohm" # second resistance R2 at input side
VDD=(24)
print "VDD= %0.2f"%(VDD)," volts" # Drain voltage supply
VP=(-2)
print "VP= %0.2f"%(VP)," volts" # pinch off voltage for JFET
VGG=(VDD*R2)/(R1+R2)
print "VGG= VDD*R2/(R1+R2)=%0.2f"%(VGG)," volts" # Gate voltage for JFET
print "Quadratic equation =5.244*ID**(2)-55.76*ID+144=0"# Forming Quadratic equation using VGS = VGG-ID*RF and ID = IDSS(1-VGS/VP)**2 where ID in mA
p = [5.244, -55.76, 144]
P=symbols('P')
ID=solve(p[0]*P**2+p[1]*P+p[2])[0]*10**(-3)# values of ID converted into Ampere by multiplying by 10**(-3)
print "ID = %0.2f"%(ID)," ampere" # drain current JFET
print "Since ID <=IDSS, hence ID=6.214 mA cannot be chosen, so we chose ID=4.42 mA"
IDQ=4.42*10**(-3)
print "IDQ =%0.2f"%(IDQ)," A"#Since ID <=IDSS, hence ID=6.214 mA cannot be chosen, so we chose ID=4.42 mA
VGSQ=VGG-IDQ*RF
print "VGSQ = VGG-IDQ*RF = %0.2f"%(VGSQ)," volts" # Gate operating point voltage
VDSQ=VDD-IDQ*(RL+RF)
print "VDSQ= VDD-IDQ*(RL+RF)= %0.2f"%(VDSQ)," volts" # Drain voltage for JFET
VDGQ=VDSQ-VGSQ
print "VDGQ = VDSQ-VGSQ =%0.2f"%(VDGQ)," volts" # Drain-Gate voltage for JFET
print "VDGQ >magnitude_VP,Hence FET is in pinch off region"
```

In [4]:

```
from sympy import symbols,solve
from __future__ import division
IDSS=15*10**(-3)
print "IDSS = %0.2f"%(IDSS)," ampere" # maximum drain current of JFET
RL=910
print "RL= %0.2f"%(RL)+ " ohm" #Load resistance
RF=2.29*10**(3)
print "RF= %0.2f"%(RF)+ " ohm" # feedback resistance
R1=12*10**(6)
print "R1= %0.2e"%(R1)+ " ohm" # first resistance R1 at input side
R2=8.57*10**(6)
print "R2= %0.2e"%(R2)+ " ohm" # second resistance R2 at input side
VDD=(24)
print "VDD= %0.2f"%(VDD)," volts" # Drain voltage supply
VP=(-6)
print "VP= %0.2f"%(VP)," volts" # pinch off voltage for JFET
VGG=(VDD*R2)/(R1+R2)
print "VGG= VDD*R2/(R1+R2)=%0.2f"%(VGG)," volts" # Gate voltage for JFET
print "Quadratic equation =5.244*ID**(2)-75.68*ID+256=0"# where ID in mA
p = [5.244, -75.68, 256]
P=symbols('P')
ID=solve(p[0]*P**2+p[1]*P+p[2])[0]*10**(-3)#values of ID converted into Ampere by multiplying by 10**(-3)
print "ID = %0.2f"%(ID)," ampere" # drain current JFET
VDG=VDD-(ID*RL)-VGG
print "VDG= %0.2f"%(VDG)," volts" # Drain-gate voltage for JFET
print "since VDG < magnitude_VP for ID=9.0189 mA which is inappropriate for JFET pinch off region ,hence ID=5.4128 mA is choosen !"
IDQ=5.41*10**(-3) # since VDG < magnitude_VP for ID=9.0189 mA which is inappropriate for JFET pinch off region ,hence ID=5.4128 mA is choosen !
print "IDQ =%0.2f"%(IDQ)," ampere"
VGSQ=VGG-IDQ*RF
print "VGSQ = VGG-IDQ*RF = %0.2f"%(VGSQ)," volts" # Gate operating point voltage
VDSQ=VDD-IDQ*(RL+RF)
print "VDSQ= VDD-IDQ*(RL+RF)= %0.2f"%(VDSQ)," volts" # Drain voltage for JFET
VDGQ=VDSQ-VGSQ
print "VDGQ = VDSQ-VGSQ =%0.2f"%(VDGQ)," volts" # Drain-Gate voltage for JFET
print "VDGQ > VP,Hence FET is in pinch off region"
# NOTE :all values of book ans is wrong so give note-INCOMPLETE QUESTION
#Roots for drain current quadratic equation are wrong in the book thus value for VGSQ,VDSQ and VDGQ are also wrong
```

In [13]:

```
from sympy import symbols,solve
from __future__ import division
RL=12*10**(3)
print "RL= %0.2f"%(RL)+ " ohm" #Load resistance
RF=6*10**(3)
print "RF= %0.2f"%(RF)+ " ohm" # feedback resistance
R1=12*10**(6)
print "R1= %0.2e"%(R1)+ " ohm" # first resistance R1 at input side
R2=8.57*10**(6)
print "R2= %0.2e"%(R2)+ " ohm" # second resistance R2 at input side
VDD=(24)
print "VDD= %0.2f"%(VDD)," volts" # Drain voltage supply
VT=(3)
print "VT= %0.2f"%(VT)," volts" # Threshold voltage for n-channel EMOSFET
KF=0.25*10**(-3)
print "KF= %0.2f"%(KF)," A/V**2" # Constant for n-channel EMOSFET
VGG=(VDD*R2)/(R1+R2)
print "VGG= VDD*R2/(R1+R2)=%0.2f"%(VGG)," volts" # Gate voltage for n-channel EMOSFET
print "Quadratic equation =9*ID**(2)-25*ID+16=0"# IDS=KF*(VGS-VT)**2 and VGS=VGG-ID*RD ,so Quadratic equation formed is :IDS=KF*(VGG-ID*RD-VT)**2 where ID in mA
p = [9, -25, 16]
P=symbols('P')
ID=solve(p[0]*P**2+p[1]*P+p[2])[0]*10**(-3)#values of ID converted into Ampere by multiplying by 10**(-3)
print "ID = %0.2f"%(ID)," A" # drain current n-channel EMOSFET in Ampere
VGS=VGG-ID*RF# For ID=1.78 mA and ID=1mA
print "VGS = VGG-ID*RF = %0.2f"%(VGS)," volts" # Gate operating point voltage
print "Since VGS < VT for ID=1.78 mA, hence ID = 1.78 mA cannot be chosen, so we chose ID= 1 mA as operating drain current IDQ"
IDQ=1*10**(-3)
print "IDQ =%0.2f"%(IDQ),"A"#Since VGS < VT for ID=1.78 mA, hence ID = 1.78 mA cannot be chosen, so we chose ID= 1 mA as operating drain current IDQ
VGSQ=VGG-IDQ*RF
print "VGSQ = VGG-IDQ*RF = %0.2f"%(VGSQ)," volts" # Gate operating point voltage
VDSQ=VDD-IDQ*(RL+RF)
print "VDSQ= VDD-IDQ*(RL+RF)= %0.2f"%(VDSQ)," volts" # Drain voltage for n-channel EMOSFET
# NOTE:Value of VGS= -0.6676390 volts for ID=1.78 mA but in book given as -0.68 V
```

In [5]:

```
from math import sqrt
from __future__ import division
RL=12*10**(3)
print "RL= %0.2f"%(RL)+ " ohm" #Load resistance
RF=6*10**(3)
print "RF= %0.2f"%(RF)+ " ohm" # feedback resistance
R1=12*10**(6)
print "R1= %0.2e"%(R1)+ " ohm" # first resistance R1 at input side
R2=8.57*10**(6)
print "R2= %0.2e"%(R2)+ " ohm" # second resistance R2 at input side
VDD=(24)
print "VDD= %0.2f"%(VDD)," volts" # Drain voltage supply
VT=(3)
print "VT= %0.2f"%(VT)," volts" # Threshold voltage for n-channel EMOSFET
KF=0.375*10**(-3)
print "KF= %0.2f"%(KF)," A/V**2" # Constant for n-channel EMOSFET
VGG=(VDD*R2)/(R1+R2)
print "VGG= VDD*R2/(R1+R2)=%0.2f"%(VGG)," volts" # Gate voltage for n-channel EMOSFET
print "Quadratic equation =36*ID**(2)-86.67*ID+49=0"# IDS=KF*(VGS-VT)**2 and VGS=VGG-ID*RD ,so Quadratic equation formed is :IDS=KF*(VGG-ID*RD-VT)**2 ,where ID in mA
p = [36, -86.67, 49]
P=symbols('P')
ID=solve(p[0]*P**2+p[1]*P+p[2])[0]*10**(-3)#values of ID converted into Ampere by multiplying by 10**(-3)
print "ID = %0.2f"%(ID)," A" # drain current n-channel EMOSFET in Ampere
VGS=VGG-ID*RF# Gate voltage for ID = 1.5 mA and ID = 0.91 mA
print "VGS = VGG-ID*RF = %0.2f"%(VGS)," volts" # Gate voltage
print "Since VGS < VT for ID=1.5 mA, hence ID = 1.5 mA cannot be chosen, so we chose ID= 0.91 mA as operating drain current IDQ"
IDQ=0.91*10**(-3)
print "IDQ =%0.2f"%(IDQ)," A"#Since VGS < VT for ID=1.5 mA, hence ID = 1.5 mA cannot be chosen, so we chose ID= 0.91 mA as operating drain current IDQ
change_IDQ=((1-0.91)*100)/(1)#
print "change in IDQ = %0.2f"%(change_IDQ)," percent"# Percent change in IDQ from value 1 mA from its actual value IDQ=0.91mA
VGSQ=VGG-IDQ*RF
print "VGSQ = VGG-IDQ*RF = %0.2f"%(VGSQ)," volts" # Gate operating point voltage
VDSQ=VDD-IDQ*(RL+RF)
print "VDSQ= VDD-IDQ*(RL+RF)= %0.2f"%(VDSQ)," volts" # Drain voltage for n-channel EMOSFET
# note: in the textbook author has given KF = .375 but I have work with KF = .375*10**-3A/V**2
```

In [25]:

```
from math import sqrt
from sympy import symbols,solve
from __future__ import division
RF=6*10**(3)
print "RF= %0.2f"%(RF)+ " ohm" # feedback resistance
VDD=(20)
print "VDD= %0.2f"%(VDD)," volts" # Drain voltage supply
print "part(i) "# part(i) of this question
VT=(2)
print "VT= %0.2f"%(VT)," volts" # Threshold voltage for EMOSFET
KF=0.25*10**(-3)
print "KF= %0.2f"%(KF)," A/V**2" # Constant for EMOSFET
ID=1*10**(-3)
print "ID = %0.2f"%(ID)," A" # drain current EMOSFET in Ampere
RL=(VDD-VT-sqrt(ID/KF))/ID # Using formulae ID=KF*(VDD-ID*RL-VT)
print "RL=[VDD-VT-sqrt(ID/KF)]/ID= %0.2f"%(RL)+ " ohm" #Load resistance
print "part(ii) "# part(ii) of this question
VT=(3)
print "VT= %0.2f"%(VT)," volts" # Threshold voltage for EMOSFET
KF=0.375*10**(-3)
print "KF= %0.2f"%(KF)," A/V**2" # Constant for EMOSFET
print "Quadratic equation =(256)*ID**(2)-(546.67)*ID+289=0"#IDS=KF*(VGS-VT)**2 =KF*(VDS-VT)**2 and VDS=VDD-ID*RL,so Quadratic equation is:IDS=KF*(VDD-ID*RL-VT)**2 ,where ID in mA
p = [256, -546.66 , 289]
P=symbols('P')
ID=solve(p[0]*P**2+p[1]*P+p[2])[0]*10**(-3)#values of ID converted into Ampere by multiplying by 10**(-3)
print "ID = %0.2f"%(ID)," A" # drain current EMOSFET in Ampere
VDS=VDD-ID*RL# Drain voltage for ID = 1.173 mA and ID = 0.962 mA
print "VDS =VDD-ID*RL = %0.2f"%(VDS)," volts" # Drain voltage
IDQ=0.962*10**(-3)
print "IDQ =%0.2f"%(IDQ)," A"#Since VDS < VT for ID=1.173 mA, hence ID = 1.173 mA cannot be chosen, so we chose ID= 0.962 mA as operating drain current IDQ
Percentage_change=((1-0.962)*100)/(1)
print "Percentage change= %0.2f"%(Percentage_change)," percent"# Percent change in IDQ value from 1 mA(part(i)) to its value ( of part(ii))IDQ=0.91mA
# NOTE: part(ii):the values of ID = 1.173 mA or ID = 0.962 mA but in book given as ID= 1.197 mA and ID = 0.939 mA .Hence (correct) Percentage_change in ID= 3.8 % but in book given as 6.1 %
# ANS is not correct check &correct
```

In [15]:

```
from __future__ import division
VDD=(5)
print "VDD= %0.2f"%(VDD)," volts" # Drain voltage supply
RL1=125*10**(3)
print "RL1= %0.2e"%(RL1)+ " ohm" #Load resistance
RL2=200*10**(3)
print "RL2= %0.2e"%(RL2)+ " ohm" #Load resistance
IDON1=34.88*10**(-6)
print "IDON1 =%0.2f"%(IDON1)," A"#Drain current for load line 1 from fig.
IDON2=22.5*10**(-6)
print "IDON2 =%0.2f"%(IDON2)," A"#Drain current for load line 2 from fig.
VDON1=VDD-IDON1*RL1
print "VDON1=VDD-IDON1*RL1= %0.2f"%(VDON1)," volts" # output voltage at drain terminal for IDON1
VDON2=VDD-IDON2*RL2
print "VDON2=VDD-IDON2*RL2= %0.2f"%(VDON2)," volts" # output voltage at drain terminal for IDON2
```

In [28]:

```
from __future__ import division
IDSS=10*10**(-3)
print "IDSS = %0.2f"%(IDSS)," ampere" # maximum drain current for n-channel DEMOSFET
ID=IDSS # since VGS=0V, so ID=maximum
VP=(-4)
print "VP= %0.2f"%(VP)," volts" # pinch off voltage
VGS=(0)
print "VGS= %0.2f"%(VGS)," volts" # Gate to source voltage
VDD=(10)
print "VDD= %0.2f"%(VDD)," volts" # Drain supply voltage
RL=0.5*10**(3)
print "RL= %0.2f"%(RL)+ " ohm" #Load resistance
VDS=VDD-ID*RL
print "VDS=VDD-ID*RL= %0.2f"%(VDS)," volts" # Drain to source voltage ,since VDS>VP DEMOSFET is in pinch off
print "VDS>VP,so pinch off region"
RL=0.75*10**(3)
print "RL= %0.2f"%(RL)+ " ohm" # New Load resistance value
VDS=VDD-ID*RL
print "VDS=VDD-ID*RL= %0.2f"%(VDS)," volts" # New Drain to source voltage for RL=750 ohm
print "VDS<VP,so ohmic region"# since VDS < VP DEMOSFET is in ohmic region for RL=750 ohm and hence will not operate as a current source
```

In [2]:

```
from math import sqrt
from __future__ import division
KF1=0.25*10**(-3)
print "KF1 = %0.2e"%(KF1)," A/V**2" # Scale factor
KF2=KF1
print "KF2 = %0.2e"%(KF2)," A/V**2" # Scale factor
IQ=1*10**(-3)
print "IQ= %0.2e"%(IQ)," ampere" # constant current source value
VT1=2
print "VT1 = %0.2f"%(VT1)," volts"# Threshold voltage
VT2=VT1
print "VT2 = %0.2f"%(VT2)," volts"# Threshold voltage
VDD=(15)
print "VDD= %0.2f"%(VDD)," volts" # Drain supply voltage
IREF=IQ
print "IREF =IQ= %0.2e"%(IREF)," ampere" # Reference current value
VGS=VT1+sqrt(2*IREF/KF1) # Formulae
print "VGS= VT1+sqrt(2*IREF/KF1)=%0.2f"%(VGS)," volts" # Gate to source voltage
R=(VDD-VGS)/IREF
print "R= (VDD-VGS)/IREF=%0.2f"%(R)+ " ohm" # resistance value to obtain constant current
# ERROR NOTE:values of VGS and R (correct) are 4.8284271 volts and 10171.573 ohm respectively but given in book are VGS=4V and R=11 kilo ohms
```

In [17]:

```
from math import log10
from __future__ import division
RON=100
print "RON= %0.2f"%(RON)+ " ohm" #ON resistance of analog series switch
ROFF=10**(10)
print "ROFF= %0.2e"%(ROFF)+ " ohm" #OFF resistance analog series switch
Vip=1
print "Vip= %0.2f"%(Vip)," volts"# Peak amplitude of analog voltage
Rs=100
print "Rs= %0.2f"%(Rs)+ " ohm" #Voltage source resistance
RL=10*10**(3)
print "RL= %0.2f"%(RL)+ " ohm" #Load resistance
print "part(i) "# part(i) of this question
Vo=(Vip*RL)/(RL+RON+Rs)
print "Vo=(Vip*RL)/(RL+RON+Rs)= %0.2f"%(Vo)," volts"# ON voltage
ErON=(Vip*(RON+Rs)/(RL+RON+Rs))*100
print "ErON=[Vip*(RON+Rs)/(RL+RON+Rs)]*100= %0.2f"%(ErON)," percent"# Output voltage error
vOFF=(Vip*RL)/ROFF
print "vOFF=(Vip*RL)/ROFF= %0.2f"%(vOFF)," volts"# Output voltage in OFF state
OFF_isolation=20*log10(Vip/vOFF)
print "OFF_isolation=20*log10(Vip/vOFF)= %0.2f"%(OFF_isolation)," dB" # OFF_isolation=20*log10(Vip/vOFF) in dB# Thus ON error and OFF isolation decrease with increasing values of RL.
print "part(ii) "# part(ii) of this question
vOFF=(Vip*RON)/(Rs+RON)
print "vOFF=(Vip*RON)/(Rs+RON)= %0.2f"%(vOFF)," volts"# Output voltage in OFF state for analog shunt switch
OFF_isolation=20*log10((Rs+RON)/RON)# OFF_isolation of shunt switch
print "OFF_isolation=20*log10((Rs+RON)/RON)= %0.2f"%(OFF_isolation)," dB"# Thus shunt switch is inferior to series switch in its OFF isolation property
# ERROR NOTE: in question the author has given RL = 10K but in solution he has used RL = 1 k ... I have done programming using RL = 10 K.
```