%matplotlib inline
import math
# variable declaration
V_p=50; #Peak value is 50V
#calculation
V_avg=V_p/math.pi;
#result
print "average value of half wave rectifier = %.2f volts" %V_avg
import math
f=1; #frequency
V_p_in=5; #peak input
#calculation
V_pout=V_p_in-0.7; #output voltage
t_d=(math.asin(0.7/V_p_in))/(2*math.pi*f);
#result
print "half wave rectifier output = %.2f volts" %V_pout;
import math
f=1; #frequency
T=1/f; #time period
V_p_in=100; #peak input voltage
#calculation
V_pout=(V_p_in-0.7); #peak output
t_d=(math.asin(0.7/V_p_in))/(2*math.pi*f)
#result
print "output of half wave rectifier = %.2f volts" %V_pout
import math
# variable declaration
V_p_in=156; #Peak input voltage
V_p_pri=156; #Peak voltage of primary of transformer
n=0.5; #Turn ratio is 2:1
#calculation
V_p_sec=n*V_p_pri;
V_p_out=(V_p_sec-0.7); #Peak output voltage
#result
print "peak output voltage of half wave rectifier = %.1f volts" %V_p_out
import math
# variable declaration
V_p=15; #Peak voltage in volt
#calculation
V_avg=(2*V_p)/math.pi;
#result
print "Average value of output of full wave rectifier = %.2f volts" %V_avg
V_p_pri=100.0; #Peak voltage across primary winding
n=1.0/2; #tun ratio is 2:1
V_p_sec=n*V_p_pri;
V_sec=V_p_sec/2; #voltage across each secondary is half the total voltage
V_pout=V_sec-0.7;
print('full wave rectifier output voltage = %f V'%V_pout)
PIV=2*V_pout+0.7;
print('PIV = %fV'%PIV)
import math
# variable declaration
V_rms=12.0; #rms secondary voltage
#calculation
V_p_sec=math.sqrt(2)*V_rms; #peak secondary voltage
V_th=0.7; #knee voltage of diode
V_p_out=V_p_sec-2*V_th; #in one cycle, 2 diodes conduct
PIV=V_p_out+V_th; #applying KVL
#result
print "Peak output voltage = %.2f volt" %V_p_out
print "PIV across each diode = %.2f volt" %PIV
import math
# variable declaration
R_l=2200; #load resistance in Ohm
C=50*10**-6; #capacitance in Farad
V_rms=115; #rms of primary
#calculation
V_p_pri=math.sqrt(2)*V_rms; #peak voltage across primary
n=0.1; #turn ratio is 10:1
V_p_sec=n*V_p_pri; #primary voltage across secondary
V_p_rect=V_p_sec-1.4 #unfiltered peak rectified voltage
#we subtract 1.4 because in each cycle 2 diodes conduct & 2 do not
f=120; #frequency of full wave rectified voltage
V_r_pp=(1/(f*R_l*C))*V_p_rect; #peak to peak ripple voltage
V_DC=(1-(1/(2*f*R_l*C)))*V_p_rect;
r=V_r_pp/V_DC;
#result
print "Ripple factor = %.3f " %r
import math
# variable declaration
V_REF=1.25; #in volts
V_R1=V_REF; #voltage in volt
R1=220.0; #in ohms
I_ADJ=50*10**-6 #in amperes
#calculation
# MAX VALUE OF R2=5000 Ohms
R2_min=0.0; #min resistance
V_out_min=V_REF*(1+(R2_min/R1))+I_ADJ*R2_min;
R2_max=5000.0; #max value of resistance
V_out_max=V_REF*(1+(R2_max/R1))+I_ADJ*R2_max;
#result
print "minimum output voltage = %.2f volt" %V_out_min
print "maximum output voltage = %.2f volt" %V_out_max
V_NL=5.18 #No load output voltage
V_FL=5.15 #Full load output voltage
load_reg=((V_NL-V_FL)/V_FL)*100 #In percentage
print('load regulation percent = %.2f%% '%load_reg)
import pylab as py
import numpy as np
#let input wave be V_in=V_p_in*sin(2*%pi*f*t)
f=1.0; #Frequency is 1Hz
T=1/f;
R_1=100.0; #Resistances in ohms
R_L=1000.0; #Load
V_p_in=10.0; #Peak input voltage
V_th=0.7; #knee voltage of diode
V_p_out=V_p_in*(R_L/(R_L+R_1)); #peak output voltage
print('peak output voltage = %.2f V'%V_p_out)
t = np.arange(0, 3.5 , 0.0005)
z=V_p_in*np.sin(2*np.pi*f*t)*(R_L/(R_L+R_1))
subplot(211)
plot(t,z)
ylim(-9.09,9.09)
title('Input Voltage Waveform')
subplot(212)
plot(t,z)
ylim(-0.07,9.09)
title('Output Voltage Waveform')
#from pylab import figure, show
#from numpy import arange, sin, pi,bool
#import numpy as np
import pylab as py
import numpy as np
#let input wave be V_in=V_p_in*sin(2*%pi*f*t)
f=1.0; #Frequency is 1Hz
T=1/f;
V_p_in=10; #Peak input voltage
V_th=0.7; #knee voltage of diode
print('max output voltage is 5.7V')
print('min output voltage is -5.7V')
###############GRAPH Plotting#################################
t = arange(0.0,4.5,0.0005)
V_in=V_p_in*sin(2*pi*f*t);
Vout=V_in;
#fig = figure(2)
subplot(211)
plot(t,V_in)
#ax2.grid(True)
ylim( (-10,10) )
title('Input to the +ve and -ve diode limiter ')
subplot(212)
plot(t,V_in)
#ax1.grid(True)
ylim( (-5.7,5.7) )
title('Output of +ve and -ve diode limiter')
#variable declaration
V_p_in=18.0; #peak input voltage is 18V
V_supply=12.0;
R2=100.0;
R3=220.0; #resistances in ohms
#calculation
V_bias=V_supply*(R3/(R2+R3));
#result
print('diode limiting the voltage at this voltage =%fV'%V_bias)
V_p_in=24.0;
V_DC=-(V_p_in-0.7); #DC level added to output
print('V_DC = %.1fV'%V_DC)