import math
#initialisation of variables
v11=50.0 #in microV
v21=-50.0 #in microV
#Second Set of Input Signal
v12=1050.0 #in microV
v22=950.0 #in microV
p=100.0 #Common Mode Rejection Ratio
#Required Formulae
#vo = Ad*vd*(1+vc/p*vd) .... p = commom mode rejection ratio
#Ad will be same for both case, So let us write Vo = vo/Ad = Ad*(1+vc/p*vd)
#Calculations
#First Set of Values
vd1=v11-v21#in microV
vc1=(v11+v21)/2#in microV
Vo1 = vd1*(1+vc1/(p*vd1))
#Second Set of Values
vd2=v12-v22#in microV
vc2=(v12+v22)/2#in microV
Vo2 = vd2*(1+vc2/(p*vd2))
#Results
print("Percentage difference in output signal = %.2f v " %(100*(Vo2-Vo1)/Vo1))
import math
#initialisation of variables
v11=50.0 #in microV
v21=-50.0 #in microV
#Second Set of Input Signal
v12=1050.0 #in microV
v22=950.0 #in microV
p=100.0 #Common Mode Rejection Ratio
#Required Formulae
#vo = Ad*vd*(1+vc/p*vd) .... p = commom mode rejection ratio
#Ad will be same for both case, So let us write Vo = vo/Ad = Ad*(1+vc/p*vd)
#Calculations
#First Set of Values
vd1=v11-v21#in microV
vc1=(v11+v21)/2#in microV
Vo1 = vd1*(1+vc1/(p*vd1))
#Second Set of Values
vd2=v12-v22#in microV
vc2=(v12+v22)/2#in microV
Vo2 = vd2*(1+vc2/(p*vd2))
#Now we have to calculate the same thing with common mode rejection ratio = 10000
p=10000#Common Mode Rejection Ratio
#First Set of Values
vd1=v11-v21#in microV
vc1=(v11+v21)/2#in microV
Vo1 = vd1*(1+vc1/(p*vd1))
#Second Set of Values
vd2=v12-v22#in microV
vc2=(v12+v22)/2#in microV
Vo2 = vd2*(1+vc2/(p*vd2))
#Results
print("Percentage difference in output signal = %.2f v " %(100*(Vo2-Vo1)/Vo1))
import math
#initialisation of variables
Vbe1=0.7
Vce3=0.2
I3=5.0
R3=0.4
Vee=5
Vcc=5
Ic1=2.5
Rc=1.0
#Calculations
Vcmmin=Vbe1+Vce3+(I3*R3)-Vee
Vcmmax=Vcc-(Ic1*Rc)+0.6
#Results
print("The Vcm can vary from = %.2f v to " %Vcmmin)
print("%.2f v " %Vcmmax)
import math
#initialisation of variables
Vbe2=0.7
Vce1=0.2
I1=0.99
R1=2.2
Vee=6
Vcc=6
Ic2=0.495
R2=7.75
Vbc2=0.6
#Calculations
Vcmmin=Vbe2+Vce1+(I1*R1)-Vee
Vcmmax=Vcc-(Ic2*R2)+0.6
#Results
print("The Vcm can vary from = %.2f v to " %Vcmmin)
print("%.2f v " %Vcmmax)
import math
#initialisation of variables
f=32.0 #feedback in dB
#from the Bodes plot we get that Avo = 2510
Avo = 2510.0 #gain
print('The parameters are R , r (for Rdash), C (for Cdash)')
#Desensivity D = B*Rmo = Avo*(R/(R+r))
#20log10(D ) = f
#Calculations
k = f - (20*math.log(Avo,10))
#Let (R+r)/R = l
l = 1.0/(10**(k/20))
#R/(R+r) = fp/fz
#For 45degree phase margin and 32dB of low frequency feedback we find by trial and error method from the graph
fz = 10#in MHz
fp = fz*l
#to determine c we can arbitrarily choose R
R = 1000.0 #in ohm
#Results
print("R = %.2f ohm " %R)
r = (l-1)*R
print("r = %.2f ohm " %r)
C = 1/(2*math.pi*fz*r*10**-6)
print("C = %.2f pF " %C)