#example 2.23 page no.81 #Repeated example with silicon diode import math #initialization of variables v=4 #v in Volt Vi=[16,-16] #peak voltage in Volt VT=0.7 #thresold voltage #calculation print "+16V dc supply is pressuring the diode to stay in the short circuit state" print "But for any Vi < v,it will result in short circuted diode" print "But for any Vi > v,it will result in open circuted diode" print "If the diode voltage is 0.7V" v = v-VT print "resulting battery input voltage = %.1fV" %(v) print "For open circuit state" if (Vi[0] >= v): V0=Vi[0] print "V0 =%dV " %(V0) print "for the negative region of the input signal,the diode will be in the 'on' state" if [Vi[1]==-16]: V0 = v print "V0 = %.2fV" %(V0)