# Chapter 3 : Applications of diodes¶

## Example 3.4: Page No 116¶

In [7]:
from math import sqrt, pi
from __future__ import division
#              (a) DC load current
#              (b) DC power in load
#              (c) Rectification efficiency
#              (d) Percentage regulation
#              (e) PIV of each diode
Vrms=40# # Input in volts
Rf=1# # Forward conduction resistance of diodes in ohms
RL=29# # Load resistance in ohms
Vmax=Vrms*sqrt(2)# # in volts
Imax=Vmax/(Rf+RL)# # in amperes

print "Part (a)"
Idc=2*Imax/pi# # DC load current in amperes
print "DC load current = %0.2f A"%Idc

print "Part (b)"
Pdc=Idc**2*RL# # DC power in load in watts
print "DC power in load = %0.3f W"%Pdc

print "Part (c)"
Pac=Vrms**2/(Rf+RL)# # AC power in load
eta=Pdc/Pac# # Rectification efficiency
print "Rectification efficiency = %0.4f "%eta

print "Part (d)"
reg=Rf*100/RL# # Percentage regulation
print "Percentage regulation = %0.2f %%"%reg

print "Part (e)"
PIV=2*Vmax# # in volts
print "PIV for each diode = %0.2f V"%PIV

Part (a)
DC load current = 1.20 A
Part (b)
DC power in load = 41.789 W
Part (c)
Rectification efficiency = 0.7836
Part (d)
Percentage regulation = 3.45 %
Part (e)
PIV for each diode = 113.14 V


## Example 3.5: Page No 118¶

In [8]:
from math import sqrt, pi
from __future__ import division

#              (a) DC voltage at load
#              (b) PIV rating of each diode
#              (c) Maximum current through each diode
#              (d) Required power rating
Vrms=120# # Input voltage in volts
RL=1e3# # Load resistance in ohms
Vy=0.7# # Cut-in voltage in volts

print "Part (a)"
Vmax=Vrms*sqrt(2)# # in volts
Imax=(Vmax-2*Vy)/RL# # in amperes
Idc=2*Imax/pi# # in amperes
Vdc=Idc*RL# # in volts
print "DC voltage at load = %0.2f V"%Vdc

print "Part (b)"
print "PIV rating of each diode = %0.2f V"%Vmax

print "Part (c)"
Imax=Imax*1e3# # in miliamperes
print "Maximum current through each diode = %0.2f mA"%Imax

print "Part (d)"
Pmax=Vy*Imax# # Required power rating in mili-watts
print "Required power rating = %0.2f mW"%Pmax

Part (a)
DC voltage at load = 107.15 V
Part (b)
PIV rating of each diode = 169.71 V
Part (c)
Maximum current through each diode = 168.31 mA
Part (d)
Required power rating = 117.81 mW


## Example 3.6: Page No 119¶

In [9]:
from math import sqrt, pi
from __future__ import division

#              (a) Peak value of current
#              (b) DC value of current
#              (c) Ripple factor
#              (d) Rectification efficiency
# From the Fig. 2.16
RL=1e3# # Load resistance in ohms
rd=10# # Forward bias dynamic resistance of diodes in ohms
Vmax=220# # Amplitude of input voltage in volts

print "Part (a)"
Imax=Vmax/(rd+RL)# # Peak value of current in amperes
print "Peak value of current = %0.4f A"%Imax

print "Part (b)"
Idc=2*Imax/pi# # DC value of current in amperes
print "DC value of current = %0.5f A"%Idc

print "Part (C)"
ripl=sqrt((Imax/(Idc*sqrt(2)))**2-1)#
print "Ripple factor = %0.3f "%ripl

print "Part (d)"
eta=8/(pi**2*(1+(rd/RL)))# # Rectification efficiency
print "Rectification efficiency = %0.3f "%eta

Part (a)
Peak value of current = 0.2178 A
Part (b)
DC value of current = 0.13867 A
Part (C)
Ripple factor = 0.483
Part (d)
Rectification efficiency = 0.803


## Example 3.7: Page No 121¶

In [10]:
from math import pi, sqrt
#Full scale reading
Idc=1e-3# # in amperes
Rf=10# # in ohms
RL=5e3# # in ohms
Vrms=Idc*(RL+Rf)*pi/(2*sqrt(2))# # Full-scale deflection in volts
print "Full-scale deflection = %0.4f V"%Vrms

Full-scale deflection = 5.5647 V


## Example 3.8: Page No 122¶

In [11]:
from math import sqrt, pi
from __future__ import division

#Full-scale reading
Idc=5e-3# # in amperes
Rf=40# # in ohms
RL=20e3# # in ohms
Vrms=Idc*(RL+Rf)*pi/(2*sqrt(2))# # Full-scale deflection in volts
print "Full-scale deflection = %0.3f V"%Vrms

Full-scale deflection = 111.294 V


## Example 3.10: Page No 133¶

In [12]:
#Minimum and maximum value of zener diode current
# From the Fig. 3.33
Vsmin=120# # in volts
Vsmax=170# # in volts
Vz=50# # in volts
Rs=5e3# # in ohms
RLmin=5e3# # in ohms
RLmax=10e3# # in ohms
ILmin=Vz/RLmax# # in amperes
ILmax=Vz/RLmin# # in amperes
Izmin=((Vsmin-Vz)/Rs)-ILmax# # Minimum value of zener diode current in amperes
Izmin=Izmin*1e3# # Minimum value of zener diode current in miliamperes
Izmax=((Vsmax-Vz)/Rs)-ILmin# # Maximum value of zener diode current in amperes
Izmax=Izmax*1e3# # Maximum value of zener diode current in miliamperes
print "Minimum value of zener diode current = %0.2f mA"%Izmin
print "Maximum value of zener diode current = %0.2f mA"%Izmax

Minimum value of zener diode current = 4.00 mA
Maximum value of zener diode current = 19.00 mA


## Example 3.11: Page No 134¶

In [13]:
#               (a) V
#               (b) Voltage range of V

Vz=50# # Zener voltage in volts
Izmin=1e-3# # in amperes
Izmax=5e-3# # in amperes

print "Part (a)"
ILmin=0#
Rs=5e3# # in ohms
V=Vz+Rs*(Izmax+ILmin)# # in volts
print "V = %0.2f V"%V

print "Part (b)"
IL=(50/15)*1e-3# # in amperes
Vmin=Vz+Rs*(Izmin+IL)# # in volts
Vmax=Vz+Rs*(Izmax+IL)# # in volts
print "Vmin = %0.2f V"%Vmin
print "Vmax = %0.2f V"%Vmax

Part (a)
V = 75.00 V
Part (b)
Vmin = 71.67 V
Vmax = 91.67 V


## Example 3.12: Page No 135¶

In [14]:
#Zener diode current, Power dissipation in zener diode and resistor
# In the Fig. 3.35
Vz=6.8# # in volts
R=100# # in ohms

print "Normal situation"
Vs=9# # in volts
I=(Vs-Vz)/R# # in amperes
Pzener=I*Vz# # in watts
Presistor=I**2*R# # in watts
I=I*1e3# # in miliamperes
Pzener=Pzener*1e3# # in miliwatts
Presistor=Presistor*1e3# # in miliwatts
print "Zener diode current = %0.2f mA"%I
print "Power dissipation in zener diode = %0.2f mW"%Pzener
print "Power dissipation in resistor = %0.2f mW"%Presistor

print "Aberrant situation"
Vs=15# # in volts
I=(Vs-Vz)/R# # in amperes
Pzener=I*Vz# # in watts
Presistor=I**2*R# # in watts
I=I*1e3# # in miliamperes
Pzener=Pzener*1e3# # in miliwatts
Presistor=Presistor*1e3# # in miliwatts
print "Zener diode current = %0.2f mA"%I
print "Power dissipation in zener diode = %0.2f mW"%Pzener
print "Power dissipation in resistor = %0.2f mW"%Presistor

Normal situation
Zener diode current = 22.00 mA
Power dissipation in zener diode = 149.60 mW
Power dissipation in resistor = 48.40 mW
Aberrant situation
Zener diode current = 82.00 mA
Power dissipation in zener diode = 557.60 mW
Power dissipation in resistor = 672.40 mW


## Example 3.13: Page No 136¶

In [15]:
#Range of load current
Vz=5# # in volts
Izmin=50e-3# # in amperes
Izmax=1# # in amperes
Vmin=7.5# # in volts
Vmax=10# # in volts
Rs=4.75# # in ohms
ILmin=((Vmax-Vz)/Rs)-Izmax# # in amperes
ILmin=ILmin*1e3# # in miliamperes
ILmax=((Vmin-Vz)/Rs)-Izmin# # in amperes
ILmax=ILmax*1e3# # in miliamperes
print "ILmin = %0.2f mA"%ILmin
print "ILmax = %0.2f mA"%ILmax

ILmin = 52.63 mA
ILmax = 476.32 mA


## Example 3.14: Page No 136¶

In [6]:
from math import sqrt, pi
from __future__ import division

## Load-current range, Series resistance in redesigned circuit
# In Fig. 3.37
Vz=6.8# # in volts
Izk=0.1e-3# # in amperes
Vs=10# # in volts
Rs=1e3# # in ohms
ILmax=((Vs-Vz)/Rs)-Izk# # in amperes
ILmax=ILmax*1e3# # in miliamperes
print "ILmin = %0.2f A"%0
print "ILmax = %0.2f mA"%ILmax

print "Redesigned Part"
RL=1e3# # in ohms
Izk=Izk*10# # in amperes
I=Izk+(Vz/RL)# # in amperes
R=(Vs-Vz)/I# # in ohms
print "Series resistance = %0.2f Î©"%R

ILmin = 0.00 A
ILmax = 3.10 mA
Redesigned Part
Series resistance = 410.26 Î©


## Example 3.15: Page No 137¶

In [47]:
#               (a) Series resistance
#               (b) Power dissipation rating of zener diode
# In Fig. 3.38
Vz=6# # in volts
ILmin=0#
ILmax=0.5# # in amperes
Vmin=8# # in volts
Vmax=10# # in volts
Izmin=0#

print "Part (a)"
Rs=(Vmin-Vz)/(ILmax+Izmin)# # Series resistance in ohms
print "Series resistance = %0.2f Î©"%Rs

print "Part (b)"
Izmax=((Vmax-Vz)/Rs)-ILmin# # in amperes
Pzmax=Vz*Izmax# # in watts
print "Power dissipation rating of zener diode = %0.2f W"%Pzmax

Part (a)
Series resistance = 4.00 Î©
Part (b)
Power dissipation rating of zener diode = 6.00 W


## Example 3.16: Page No 138¶

In [48]:
#Series resistance R, Maximum zener current
# In Fig. 3.39
Vz=7.2# # in volts
ILmin=12e-3# # in amperes
ILmax=100e-3# # in amperes
Vs=20# # in volts
Izmin=10e-3# # in amperes
Rs=(Vs-Vz)/(ILmax+Izmin)# # Series resistance in ohms
print "Series resistance = %0.2f Î©"%Rs
# For ILmin=0
Izmax=((Vs-Vz)/Rs)# # in amperes
Izmax=Izmax*1e3# # in miliamperes
print "Maximum zener current = %0.2f mA"%Izmax

Series resistance = 116.36 Î©
Maximum zener current = 110.00 mA


## Example 3.17: Page No 139¶

In [49]:
#               (a) R, maximum possible value of load current
#               (b) Range of V
Vz=50# # Diode voltage in volts
Izmin=5e-3# # in amperes
Izmax=40e-3# # in amperes

print "Part (a)"
ILmin=0#
V=200# # Input voltage in volts
R=(V-Vz)/(Izmax-ILmin)# # in ohms
ILmax=((V-Vz)/R)-Izmin# # in amperes
Rk=R*1e-3# # in kilo-ohms
ILmax=ILmax*1e3# # in miliamperes
print "R = %0.2f kÎ©"%Rk
print "Maximum possible value of load current = %0.2f mA"%ILmax

print "Part (b)"
IL=25e-3#
Vmin=Vz+R*(Izmin+IL)# # in volts
Vmax=Vz+R*(Izmax+IL)# # in volts
print "Minimum value of V = %0.2f V"%Vmin
print "Maximum value of V = %0.2f V"%Vmax

Part (a)
R = 3.75 kÎ©
Maximum possible value of load current = 35.00 mA
Part (b)
Minimum value of V = 162.50 V
Maximum value of V = 293.75 V


## Example 3.18: Page No 140¶

In [50]:
#R, ILmax, Power rating of zener diode
# In Fig. 3.41
Vz=6# # in volts
V=22# # in volts
Izmin=10e-3# # in amperes
Izmax=40e-3# # in amperes
ILmin=0#
R=(V-Vz)/(Izmax-ILmin)# # in ohms
ILmax=((V-Vz)/R)-Izmin# # in amperes
P=Izmax*Vz# # Power rating of zener diode in watts
ILmax=ILmax*1e3# # in miliamperes
P=P*1e3# # Power rating of zener diode in mili-watts
print "R = %0.2f Î©"%R
print "ILmax = %0.2f mA"%ILmax
print "Power rating of zener diode = %0.2f mW"%P

R = 400.00 Î©
ILmax = 30.00 mA
Power rating of zener diode = 240.00 mW


## Example 3.19: Page No 141¶

In [51]:
from math import sqrt, pi
from __future__ import division
#               (a) VL,IL,Iz,IR
#               (b) RL for maximum power dissipation for zener diode
#               (c) Maximum value of RL for zener diode to remain ON
# From Fig. 3.42
Vs=25# # in volts
Rs=220# # in ohms
Vz=10# # in volts
Pzmax=400# # in mili-watts
Izmax=Pzmax/Vz# # in miliamperes
Izmin=Izmax*10/100# # in miliamperes

print "Part (a)"
RL=180# # in ohms
VL=Vz# # in volts
IL=Vz/RL# # in amperes
IL=IL*1e3# # in miliamperes
IR=(Vs-Vz)/Rs# # in amperes
IR=IR*1e3# # in miliamperes
Iz=IR-IL# # in miliamperes
print "VL = %0.2f V"%VL
print "IL = %0.2f mA"%IL
print "Iz = %0.2f mA"%Iz
print "IR = %0.2f mA"%IR

print "Part (b)"
RL=Vz*1e3/(IR-Izmax)# # in ohms
print "RL for maximum power dissipation for zener diode = %.2f Î©"%RL

print "Part (c)"
RL=Vz*1e3/(IR-Izmin)# # in ohms
print "Maximum value of RL for zener diode to remain ON = %0.2f Î©"%RL
print "If Izmin=0"
RL=Vz*1e3/IR# # in ohms
print "Maximum value of RL for zener diode to remain ON = %0.f Î©"%RL

Part (a)
VL = 10.00 V
IL = 55.56 mA
Iz = 12.63 mA
IR = 68.18 mA
Part (b)
RL for maximum power dissipation for zener diode = 354.84 Î©
Part (c)
Maximum value of RL for zener diode to remain ON = 155.81 Î©
If Izmin=0
Maximum value of RL for zener diode to remain ON = 147 Î©


## Example 3.20: Page No 141¶

In [1]:
#Range and average watage of Rs
# From Fig. 3.43
Vsmin=20# # in volts
Vsmax=30# # in volts
RLmin=1# # in ohms
RLmax=10# # in ohms
Izmin=10e-3# # in amperes
Pzmax=50# # in watts
Vz=10# # in volts
ILmin=Vz/RLmax# # in amperes
ILmax=Vz/RLmin# # in amperes
Izmax=Pzmax/Vz# # in amperes
Rs1=(Vsmin-Vz)/(ILmax+Izmin)# # in ohms
Rs2=(Vsmax-Vz)/(ILmin+Izmax)# # in ohms
print "Rs <= %0.2f "%Rs1
print "Rs >= %0.2f"%Rs2
print "To meet the load current variation from 1 A to 10 A a zener of specification Izmin = 0.01 A to Izmax = 5 A cannot meet the requirement for any value of Rs"
# Let
RLmin=1e3# # in ohms
RLmax=10e3# # in ohms
ILmin=Vz/RLmax# # in amperes
ILmax=Vz/RLmin# # in amperes
Rsmin=(Vsmax-Vz)/(ILmin+Izmax)# # in ohms
Rsmax=(Vsmin-Vz)/(ILmax+Izmin)# # in ohms
print "Minimum value of Rs = %0.2f Î©"%Rsmin
print "Maximum value of Rs = %0.2f Î©"%Rsmax
Rs=4# # in ohms
W=Rs*(ILmax+Izmax)**2# # in watts
print "Average wattage of Rs = %0.2f W"%W

Rs <= 1.00
Rs >= 3.00
To meet the load current variation from 1 A to 10 A a zener of specification Izmin = 0.01 A to Izmax = 5 A cannot meet the requirement for any value of Rs
Minimum value of Rs = 4.00 Î©
Maximum value of Rs = 500.00 Î©
Average wattage of Rs = 100.40 W


## Example 3.21: Page No 146¶

In [2]:
% matplotlib inline
from matplotlib.pyplot import plot, title, xlabel, ylabel, show
from numpy import arange
from math import sin, pi
#               (a) Transfer characteristics and output
#               (b) Transfer characteristics and output
Vy=0.6# # in volts
Rf=100# # in ohms

t=arange(-40,40,0.001)
vin=[]
for x in t:
vin.append(40*sin(2*pi*x/80)) # Input voltage in volts

# Part (a)
# From Fig. 3.49(a)
# Sketching of transfer characteristics
vo=[]
for i in range(0,len(vin)):

if vin[i]<5.6 :
vo.append(vin[i])# # in volts
else:
ID=(vin[i]-5.6)/(4.9e3+Rf)# # in amperes
vo.append(vin[i]-ID*4.9e3)# # in volts

plot(vin,vo)#
title("Part (a) - Transfer characteristics")
xlabel("vin")
ylabel("vo")
show()

# Sketching of output
plot(t,vin,"--")
plot(t,vo)#
title("Part (a) - Output voltage and input voltage")
xlabel("omega_t")
ylabel("vo,vin")
show()

# Part (b)
# From Fig. 3.49(b)
# Sketching of transfer characteristics
vo=[]
for i in range(0,len(vin)):

if vin[i]>-0.6:
vo.append(vin[i])# # in volts
else:
ID=(vin[i]+0.6)/(9.9e3+Rf)# # in amperes
vo.append(vin[i]-ID*9.9e3)# # in volts

plot(vin,vo)#
title("Part (b) - Transfer characteristics")
xlabel("vin")
ylabel("vo")
show()
# Sketching of output
plot(t,vin,"--")
plot(t,vo)
title("Part (b) - Output voltage and input voltage")
xlabel("omega_t")
ylabel("vo,vin")
show()


## Example 3.22: Page No 148¶

In [1]:
% matplotlib inline
from matplotlib.pyplot import plot, title, xlabel, ylabel, show
from numpy import arange

#               (a) Transfer characteristics
#               (b) Transfer characteristics

t=arange(0,20,0.1) # in mili-seconds
vin=[]
for x in t:
vin.append(30*x/10)# Input voltage in volts
# From Fig. 3.52(b)
# Part {a}
# Sketching of transfer characteristics
vo=[]
for i in range(0,len(vin)):
if vin[i]>25:
vo.append(5)# in volts
else:
IL=vin[i]/(200+50)# # in amperes
vo.append(IL*50) #in volts

#plot2d(vin,vo,rect=[0,0,60,6])#
plot(vin,vo)
title("Part (a) - Transfer characteristics")
xlabel("vin")
ylabel("vo")
show()
# Part (b)
# Sketching of transfer characteristics
Vy=0.5# # in volts
Rf=40# # in ohms
VA=5+0.5# # in volts
vo=[]
for i in range(0,len(vin)):
if vin[i]<27.5 :
IL=vin[i]/(200+50)# # in amperes
vo.append(IL*50)# # in volts
else:
IL=(vin[i]+27.5)/500# # in amperes
vo.append(IL*50)# # in volts

plot(vin,vo)#
title("Part (b) - Transfer characteristics")
xlabel("vin")
ylabel("vo")
show()


## Example 3.23: Page No 150¶

In [1]:
#Output voltage and transfer characteristic curve
% matplotlib inline
from matplotlib.pyplot import plot, title, xlabel, ylabel, show
from numpy import arange,sin,pi
t=arange(-6,6,0.001)
vin=[]
for x in t:
vin.append(6*sin(2*pi*x/12)) #Input voltage in volts
# Sketching of output voltage
vo=[]
for i in range(0,len(vin)):
if vin[i]>=2:
# From Fig. 3.54(b), D1 ON and D2 OFF
I1=(vin[i]-2)/(10e3+10e3)# # in amperes
vo.append(vin[i]-I1*10e3) # in volts
elif vin[i]>=-4:
# both D1 and D2 OFF
vo.append(vin[i])#
else:
# From Fig. 3.54(c), D1 OFF and D2 ON
vo.append(-4)# # in volts

plot(t,vin,"--")
plot(t,vo)
title("Output voltage and input voltage")
xlabel("omega_t")
ylabel("vo,vin")
show()
# Sketching of transfer characteristic curve
plot(vin,vo)
title("Transfer characteristic curve")
xlabel("vin")
ylabel("vo")
show()


## Example 3.24: Page No 152¶

In [1]:
% matplotlib inline
from matplotlib.pyplot import plot, title, xlabel, ylabel, show
from numpy import arange

#Voltage transfer characteristics
vin=arange(-2.5,2.5,0.25)# # Input voltage in volts
# Obtaining thevnin's equivalent circuit on LHS of XX'
V_th=[]
for v in vin:
V_th.append(v*7.5e3/(7.5e3+15e3))# # in volts

R_th=15e3*7.5e3/(15e3+7.5e3)# # in ohms
# Sketching of voltage transfer characteristics
# From thevnin's equivalent circuit in Fig. 3.55(b)
vo=[]
for i in range(0,len(vin)):
if vin[i]>1.8:
I1=(V_th[i]-0.6)/(5e3+R_th)# # in amperes
vo.append(I1*5e3)# in volts
elif vin[i]>-1.8:
vo.append(0)#
else:
I2=(V_th[i]+0.6)/(4e3+R_th)# # in amperes
vo.append(I2*5e3)# # in volts

plot(vin,vo)#
title("Voltage transfer characteristics")
xlabel("vin")
ylabel("vo")
show()


## Example 3.25: Page No 153¶

In [1]:
% matplotlib inline
from matplotlib.pyplot import plot, title, xlabel, ylabel, show
from numpy import arange,sin,pi

#               (a) Output voltage waveform
#               (b) Transfer curve
t=arange(0,12,0.001)
vin=[]
for tt in t:
vin.append(15*sin(2*pi*tt/12)) # Input voltage in volts
# From Fig. 3.56(a)

# Sketching of output voltage waveform
vo=[]
for i in range(0,len(vin)):
if vin[i]<16/3:
# D1 OFF and D2 ON
I2=(10-3)/(20e3+10e3)# # in amperes
vo.append(10-I2*20e3)# # in volts
elif vin[i]<=10:
# both D1 and D2 ON
vo.append(vin[i])#
else:
# D1 ON and D2 OFF
vo.append(10)# # in volts

plot(t,vin,"--")
plot(t,vo)#
title("Output voltage and input voltage")
xlabel("omega_t")
ylabel("vo,vin")
show()
# Sketching of transfer curve
plot(vin,vo)
title("Transfer characteristic curve")
xlabel("vin")
ylabel("vo")
show()


## Example 3.26: Page No 155¶

In [58]:
% matplotlib inline
from matplotlib.pyplot import plot, title, xlabel, ylabel, show
from numpy import arange
#Transfer characteristics and output and input voltage
T=60# # Let T = 60 seconds
t=range(0,T)#
vin=[]
for tt in t:
vin.append(120*tt/T) # Input voltage in volts
# From Fig. 3.57(a)
# Sketching of transfer characteristics
vo=[]
for i in range(0,len(vin)):
if vin[i]<=15:
# Both D1 and D2 OFF
vo.append(15)# # in volts
elif vin[i]<=105:
# D1 OFF and D2 ON
I2=(vin[i]-15)/(100e3+200e3)# # in amperes
vo.append(vin[i]-I2*100e3)# # in volts
else :
# Both D1 and D2 ON
vo.append(75)# # in volts

plot(vin,vo)#
title("Transfer characteristics")
xlabel("vin")
ylabel("vo")
show()
# Sketching of output
plot(t,vin,"--")
plot(t,vo)#
title("Output voltage and input voltage")
xlabel("omega_t")
ylabel("vo,vin")
show()


## Example 3.27: Page No 156¶

In [59]:
% matplotlib inline
from matplotlib.pyplot import plot, title, xlabel, ylabel, show
from numpy import arange
#vo vs vin
vin=range(0,500) # Input voltage in volts
# Sketching of vo vs vin
vo=[]
for i in range(0,len(vin)):
if vin[i]<3 :
# From Fig. 3.58(b), D1 ON, D2 and D3 OFF
I1=6/(5e3+5e3)# # in amperes
vo.append(I1*5e3) # in volts
elif vin[i]<9 :
# From Fig. 3.58(c), D1 and D3 ON, D2 OFF
# Applying Kirchoff's laws
vo.append(0.5*vin[i]+1.5) # in volts
elif vin[i]<30:
# From Fig. 3.58(d), D3 ON, D1 and D2 OFF
I3=vin[i]/(2.5e3+5e3) # in amperes
vo.append(I3*5e3) # in volts
else:
# From Fig. 3.58(e), D2 and D3 ON, D1 OFF
# Applying Kirchoff's laws
vo.append(4*vin[i]/7+20/7)# # in volts

plot(vin,vo)#
title("Voltage transfer characteristics")
xlabel("vin")
ylabel("vo")
show()


## Example 3.28: Page No 164¶

In [60]:
% matplotlib inline
from matplotlib.pyplot import plot, title, xlabel, ylabel, show
from numpy import arange
#Output voltage
t=range(0,5)# # in seconds
vs=[]
for tt in t:
vs.append(10*tt/5) # Input voltage in volts
# Output voltage
vo=[]
for i in range(0,len(vs)):
if vs[i]<6 :
# Diode is OFF
vo.append(6)# in volts
else:
# From Fig. 3.65(c), Diode is ON
I=(vs[i]-6)/(200+200)# # in amperes
vo.append(6+I*200)# in volts

plot(t,vo)
title("Output voltage")
xlabel("t in ms")
ylabel("vo(t)")
show()


## Example 3.29: Page No 165¶

In [61]:
% matplotlib inline
from matplotlib.pyplot import plot, title, xlabel, ylabel, show
from numpy import arange
#Output voltage
Vy=0.5# # in volts
Rf=50# # in ohms
t=range(0,5) # in seconds
vs=[]
for tt in t:
vs.append(10*tt/5) # Input voltage in volts
# Output voltage
vo=[]
for i in range(0,len(vs)):
if vs[i]<6.5:
# Diode is OFF
vo.append(6)# # in volts
else:
# From Fig. 3.66(a), Diode is ON
I=(vs[i]-6.5)/(200+Rf+200)# # in amperes
vo.append(6+I*2000) # in volts

plot(t,vo)
title("Output voltage")
xlabel("t in ms")
ylabel("vo(t)")
show()


## Example 3.30: Page No 166¶

In [62]:
% matplotlib inline
from matplotlib.pyplot import plot, title, xlabel, ylabel, show
from numpy import arange,sin,pi

#               (a) Output waveform
#               (b) Output waveform
t=arange(0,12,0.001)
vin =[]
for tt in t:
vin.append(15*sin(2*pi*tt/12))# # Input voltage in volts

# Part (a), From Fig. 3.67(a)
vo=[]
for v in vin:
vo.append(v-15)# # in volts
plot(t,vo)#
title("Part (a) - Output voltage")
xlabel("t")
ylabel("vo")
show()

# Part(b), From Fig. 3.67(b)
vo=[]
for v in vin:
vo.append(v-10)# # in volts
plot(t,vo)#
title("Part (b) - Output voltage")
xlabel("t")
ylabel("vo")
show()


## Example 3.31: Page No 167¶

In [2]:
% matplotlib inline
from matplotlib.pyplot import plot, title, xlabel, ylabel, show
from numpy import arange,pi
from scipy.signal import square
#Output voltage
t=arange(0,9*pi,0.1)
vin =[]
for tt in t:
vin.append(15*square(tt)-5) # Input wave in volts
vo =[]
for v in vin:
vo.append(v+25) # in volts
plot(t,vo)
title("Output voltage")
xlabel("t")
ylabel("vo")
show()


## Example 3.32: Page No 168¶

In [1]:
%matplotlib inline
from matplotlib.pyplot import plot, xlabel, ylabel, show, title
#Output voltage

t1=range(0,20)
vin1=range(0,20)
t2=range(20,60)
vin2 =[]
for t in t2:
vin2.append(40-t)

t3=range(60,80)
vin3 =[]
for t in t3:
vin3.append(-80+t)
t=t1+t2+t3#
vin=vin1+vin2+vin3# Input wave in volts
vo=[]
for x in vin:
vo.append(x+25) # in volts

plot(t,vo)#
title("Output voltage")
xlabel("t")
ylabel("vo")
show()


## Example 3.33: Page No 169¶

In [1]:
#vo
%matplotlib inline
from matplotlib.pyplot import plot, xlabel, ylabel, show, title
from numpy import arange, sin, pi
t=arange(0,12,0.001)
vin =[]
for tt in t:
vin.append(10*sin(2*pi*tt/4)) # Input voltage in volts
# From Fig. 3.73
vint=[]
for v in vin:
vint.append(v+5)
vo =[]
for i in range(0,len(vint)):
if vint[i]>0 :
# Diode is OFF
vo.append(vint[i]) # in volts
else:
break#

for i in range(i,len(vint)):
if vint[i]==-5:
break#
else:
# Diode is ON
vo.append(0)#

for i in range(i,len(vint)):
# Capacitor is charged to 5 V
vo.append(vint[i]+5)# # in volts

plot(t,vo)
title("Output voltage")
xlabel("t")
ylabel("vo")
show()