diff options
author | Prashant S | 2020-04-14 10:25:32 +0530 |
---|---|---|
committer | GitHub | 2020-04-14 10:25:32 +0530 |
commit | 06b09e7d29d252fb2f5a056eeb8bd1264ff6a333 (patch) | |
tree | 2b1df110e24ff0174830d7f825f43ff1c134d1af /Design_With_Operational_Amplifiers_And_Analog_Integrated_Circuits_by_S_Franco | |
parent | abb52650288b08a680335531742a7126ad0fb846 (diff) | |
parent | 476705d693c7122d34f9b049fa79b935405c9b49 (diff) | |
download | all-scilab-tbc-books-ipynb-master.tar.gz all-scilab-tbc-books-ipynb-master.tar.bz2 all-scilab-tbc-books-ipynb-master.zip |
Initial commit
Diffstat (limited to 'Design_With_Operational_Amplifiers_And_Analog_Integrated_Circuits_by_S_Franco')
13 files changed, 13181 insertions, 0 deletions
diff --git a/Design_With_Operational_Amplifiers_And_Analog_Integrated_Circuits_by_S_Franco/1-Operational_Amplifier_Fundamentals.ipynb b/Design_With_Operational_Amplifiers_And_Analog_Integrated_Circuits_by_S_Franco/1-Operational_Amplifier_Fundamentals.ipynb new file mode 100644 index 0000000..bf4ecf2 --- /dev/null +++ b/Design_With_Operational_Amplifiers_And_Analog_Integrated_Circuits_by_S_Franco/1-Operational_Amplifier_Fundamentals.ipynb @@ -0,0 +1,1624 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 1: Operational Amplifier Fundamentals" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.10_a: Inverting_Configuration_Characterstics.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 1.10(a)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"R1=100*10^3;\n", +"\n", +"R2=100*10^3;\n", +"\n", +"ro=75;//Output Resistance\n", +"\n", +"a=200*10^3;//Open Loop Gain for ic741\n", +" \n", +"b=R1/(R1+R2);//Feedback Factor\n", +"\n", +"T=a*b;//Loop Gain\n", +"\n", +"Trec=1/T;\n", +"\n", +"Atemp=1+Trec;\n", +"\n", +"Atempr=1/Atemp;\n", +"\n", +"A=(-R2/R1)*Atempr;//Gain\n", +"\n", +"Rnnum=R2+ro;\n", +"\n", +"Rnden=1+a;\n", +"\n", +"Rn=Rnnum/Rnden;//Equivalent Resistance of the inverting input(Calculation Mistake in the book as a is taken as 10^5 rather than 2*10^5)\n", +"\n", +"Ri=R1+Rn;//Equivalent Input Resistance\n", +"\n", +"Ro=ro/(1+T);//Equivalent Output Resistance\n", +"\n", +"printf('A=%.5f V/V',A);\n", +"\n", +"printf('\nRn=%.2f ohms ',Rn);//answer in textbook is wrong\n", +"\n", +"printf('\nRi=%.2f kohms',(Ri/1000));\n", +"\n", +"printf('\nRo=%.2f mohms',(Ro*1000));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.10_b: Inverting_Configuration_Characterstics.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 1.10(b)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"R1=1*10^3;\n", +"\n", +"R2=1*10^6;\n", +"\n", +"ro=75;//Output Resistance\n", +"\n", +"a=200*10^3;//Open Loop Gain for ic741\n", +" \n", +"b=R1/(R1+R2);//Feedback Factor\n", +"\n", +"T=a*b;//Loop Gain\n", +"\n", +"Trec=1/T;\n", +"\n", +"Atemp=1+Trec;\n", +"\n", +"Atempr=1/Atemp;\n", +"\n", +"A=(-R2/R1)*Atempr;//Gain\n", +"\n", +"Rnnum=R2+ro;\n", +"\n", +"Rnden=1+a;\n", +"\n", +"Rn=Rnnum/Rnden;//Equivalent Resistance of the inverting input(Calculation Mistake in the book as a is taken as 10^5 rather than 2*10^5)\n", +"\n", +"Ri=R1+Rn;//Equivalent Input Resistance\n", +"\n", +"Ro=ro/(1+T);//Equivalent Output Resistance\n", +"\n", +"printf('A=%.5f V/V',A);\n", +"\n", +"printf('\nRn=%.2f ohms',Rn);\n", +"\n", +"printf('\nRi=%.3f kohms',(Ri/1000));\n", +"\n", +"printf('\nRo=%.3f ohms',Ro);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.11_a: Finding_the_Loop_Gain.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 1.11(a)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"R1=1*10^6;\n", +"\n", +"R2=1*10^6;\n", +"\n", +"R3=100*10^3;\n", +"\n", +"R4=1*10^3;\n", +"\n", +"RL=2*10^3;//Load Resistance\n", +"\n", +"A=-(R2/R1)*(1+(R3/R2)+(R3/R4));//Ideal Gain\n", +"\n", +"printf('Ideal Gain of of the op amp (A)=%.2f V/V',A);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.11_b: Finding_the_Loop_Gain.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 1.11(b)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"R1=1*10^6;\n", +"\n", +"R2=1*10^6;\n", +"\n", +"R3=100*10^3;\n", +"\n", +"R4=1*10^3;\n", +"\n", +"RL=2*10^3;//Load ResistanceR1=1*10^6;\n", +"\n", +"R2=1*10^6;\n", +"\n", +"R3=100*10^3;\n", +"\n", +"R4=1*10^3;\n", +"\n", +"RL=2*10^3;//Load Resistance\n", +"\n", +"A=-(R2/R1)*(1+(R3/R2)+(R3/R4));//Ideal Gain\n", +"\n", +"rd=1*10^6;//Internal input resistance\n", +"\n", +"a=10^5;//Open Loop Gain\n", +"\n", +"ro=100;\n", +"\n", +"RA=(R1*rd)/(R1+rd);\n", +"\n", +"RB=RA+R2;\n", +"\n", +"RC=(RB*R4)/(RB+R4);\n", +"\n", +"RD=RC+R3;\n", +"\n", +"RE=(RD*RL)/(RD+RL);\n", +"\n", +"RF=RE+ro;\n", +"\n", +"c1=-(RA/RB);//vD=c1*v1\n", +"\n", +"c2=(RC/RD);//v1=c2*vo\n", +"\n", +"c3=(RE/RF);//vo=c3*vT\n", +"\n", +"c4=a*(c1*c2*c3);//vR=a*vD=a*(c1*v1)=a*(c1*c2*vo)=a*(c1*c2*c3)vT=c4*vT -> vR=c4*vT\n", +"\n", +"T=-c4;//T=(-vR/vT)=-c4 (Loop Gain)\n", +"\n", +"Trec=1/T;\n", +"\n", +"Atemp=1+Trec;\n", +"\n", +"Aactual=A/Atemp;//Actual Gain\n", +"\n", +"Adev=((Aactual-A)/A)*100;//Deviation in Gain\n", +"\n", +"printf('Actual Gain of op amp=%.1f V/V',Aactual);\n", +"\n", +"printf('\nPercentage Departure of Actual Gain from Ideal gain=%.2f',Adev);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.12_a: Feedback_Factor_for_Negative_Feedback.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 1.12(a)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"rd=1*10^6;//Internal Input Resistance\n", +"\n", +"a=10^4;//Open Loop Gain\n", +"\n", +"ro=100;//Internal Output Resistance\n", +"\n", +"R1=10*10^3;//shown in Fig. 1.34a\n", +"\n", +"R2=20*10^3;//shown in Fig. 1.34a\n", +"\n", +"R3=30*10^3;//shown in Fig. 1.34a\n", +"\n", +"R4=300*10^3;//Feedback Resistance (shown in Fig. 1.34a)\n", +"\n", +"RL=2*10^3;//Load Resistance\n", +"\n", +"RArec=((1/R1)+(1/R2)+(1/R3)+(1/rd))//Reciprocal of RA(parallel combination of R1, R2, R3 and rd)\n", +"\n", +"RA=1/RArec;\n", +"\n", +"RB=RA+R4;\n", +"\n", +"RC=(RB*RL)/(RB+RL);\n", +"\n", +"RD=RC+ro;\n", +"\n", +"c1=(RA/RB);//vN=c1*vo\n", +"\n", +"c2=(RC/RD);//vo=c2*vT\n", +"\n", +"b=c1*c2;//Feedback Factor b=vN/vT=c1*c2\n", +"\n", +"T=a*b;//Loop Gain\n", +"\n", +"printf('b=%.3f V/V',b);\n", +"\n", +"printf('\nT=%.2f',T);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.12_b: Feedback_Factor_for_Negative_Feedback.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 1.12(b)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"rd=1*10^6;//Internal Input Resistance\n", +"\n", +"a=10^4;//Open Loop Gain\n", +"\n", +"ro=100;//Internal Output Resistance\n", +"\n", +"R1=10*10^3;//shown in Fig. 1.34a\n", +"\n", +"R2=20*10^3;//shown in Fig. 1.34a\n", +"\n", +"R3=30*10^3;//shown in Fig. 1.34a\n", +"\n", +"R4=300*10^3;//Feedback Resistance (shown in Fig. 1.34a)\n", +"\n", +"RL=2*10^3;//Load Resistance\n", +"\n", +"RArec=((1/R1)+(1/R2)+(1/R3)+(1/rd))//Reciprocal of RA(parallel combination of R1, R2, R3 and rd)\n", +"\n", +"RA=1/RArec;\n", +"\n", +"RB=RA+R4;\n", +"\n", +"RC=(RB*RL)/(RB+RL);\n", +"\n", +"RD=RC+ro;\n", +"\n", +"c1=(RA/RB);//vN=c1*vo\n", +"\n", +"c2=(RC/RD);//vo=c2*vT\n", +"\n", +"b=c1*c2;//Feedback Factor b=vN/vT=c1*c2\n", +"\n", +"T=a*b;//Loop Gain\n", +"\n", +"//1.12(b)\n", +"\n", +"p1=-(R4/R1);\n", +"\n", +"p2=-(R4/R2);\n", +"\n", +"p3=-(R4/R3);\n", +"\n", +"//vo(ideal)=p1*v1+p2*v2+p3*v3\n", +"\n", +"Trec=1/T;\n", +"\n", +"ctempr=1+Trec;\n", +"\n", +"ctemp=1/ctempr;\n", +"\n", +"p1act=-(R4/R1)*ctemp;\n", +"\n", +"p2act=-(R4/R2)*ctemp;\n", +"\n", +"p3act=-(R4/R3)*ctemp;\n", +"\n", +"printf('Ideal Transfer Characterstic of the circuit vo=-(%.2f*v1',-p1);\n", +"\n", +"printf('+%.2f*v2',-p2);\n", +"\n", +"printf('+%.2f*v3)',-p3);\n", +"\n", +"printf('\nActual Transfer Characterstic of the circuit vo=-(%.2f*v1',-p1act);\n", +"\n", +"printf('+%.2f*v2',-p2act);\n", +"\n", +"printf('+%.2f*v3)',-p3act);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.13: Feedback_Factor_for_Combination_of_Negative_and_Positive_Feedback.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 1.13\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"R1=30*10^3;//From Fig. 1.13b\n", +"\n", +"R3=20*10^3;//Feedback Resistance obtained from Fig. 1.13b\n", +"\n", +"R2=10*10^3;//Load Resistance obtained from Fig. 1.13b\n", +"\n", +"rd=100*10^3;//Internal Input Resistance\n", +"\n", +"ro=100;//Internal Output Resistance\n", +"\n", +"bNnum=((R1*rd)/(R1+rd))+R3;\n", +"\n", +"bNden=ro+R2+bNnum;\n", +"\n", +"bN=bNnum/bNden;\n", +"\n", +"bPnum=R3;\n", +"\n", +"bPden=bNden;\n", +"\n", +"bP=bPnum/bPden;\n", +"\n", +"b=bN-bP;//Feedback Factor\n", +"\n", +"printf('b=%.3f V/V',b);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.14_a: Current_Flow_and_Power_Dissipation.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 1.14(a)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"R1=10*10^3;\n", +"\n", +"R2=20*10^3;\n", +"\n", +"RL=2*10^3;///Load Resistance\n", +"\n", +"vI=3;//Input Voltage\n", +"\n", +"IQ=0.5*10^(-3);\n", +"\n", +"vO=-(R2/R1)*vI;//Output Voltage\n", +"\n", +"iL=-vO/RL;//Current through RL\n", +"\n", +"i1=vI/R1;//Cuurent through R1\n", +"\n", +"i2=i1;//Current through R2 (as current sunk by the op amp is 0)\n", +"\n", +"iO=i2+iL;//Output Current\n", +"\n", +"iCC=IQ;\n", +"\n", +"iEE=iCC+iO;\n", +"\n", +"printf('iCC=%.2f mA',(iCC*1000));\n", +"\n", +"printf('\niEE=%.2f mA',(iEE*1000));\n", +"\n", +"printf('\niO=%.2f mA',(iO*1000));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.14_b: Current_Flow_and_Power_Dissipation.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 1.14(b)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"R1=10*10^3;\n", +"\n", +"R2=20*10^3;\n", +"\n", +"RL=2*10^3;///Load Resistance\n", +"\n", +"vI=3;//Input Voltage\n", +"\n", +"IQ=0.5*10^(-3);\n", +"\n", +"vO=-(R2/R1)*vI;//Output Voltage\n", +"\n", +"iL=-vO/RL;//Current through RL\n", +"\n", +"i1=vI/R1;//Cuurent through R1\n", +"\n", +"i2=i1;//Current through R2 (as current sunk by the op amp is 0)\n", +"\n", +"iO=i2+iL;//Output Current\n", +"\n", +"iCC=IQ;\n", +"\n", +"iEE=iCC+iO;\n", +"\n", +"VCC=15;\n", +"\n", +"VEE=-15;\n", +"\n", +"IQ=0.5*10^(-3);\n", +"\n", +"pOA=(VCC-VEE)*IQ+(vO-VEE)*iO;//Power Dissipated in the Op Amp\n", +"\n", +"printf('Power Dissipated inside the op amp=%.2f mW',(pOA*1000));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.15_a: Designing_variable_dc_source.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 1.15(a)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"Rp=100*10^3;//Potentiometer Resistance\n", +"\n", +"VCC=15;\n", +"\n", +"VEE=-15;\n", +"\n", +"//We have to choose the resistances in such a way that we get VA=10V and VB=-10V, so that if we want the source to be in the range -10V<=vW<=10V, we need to only turn the wiper. Let RA and RB be the resistances corresponding to nodes A and B respectively.If RA=RB=25kohm then there would be a drop of 5V accross each component(RA,RB and potentiometer) which will make VA=10V and VB=-10V. Hence RA and RB are selected as 25kohms.(Refer Fig. 1.38)\n", +"\n", +"//vRA(voltage accross RA)=5=(15*RA)/(50+RA) (Using Voltade Divider Rule)where 50kohm is the potentiometer resistance on node A side and RA is in kohms. Hence by solving the equation RA=25kohm. Similarly solve for RB. \n", +"\n", +"y=poly(0,'x');\n", +"\n", +"p=5*(y+50*(10^3))-(15*y);\n", +"\n", +"RA=roots(p);\n", +"\n", +"RB=RA;\n", +"\n", +"printf('Designed Source :');\n", +"\n", +"printf('\nRA=%.2f kohms',(RA/1000));//mentioned in the diagram\n", +"\n", +"printf('\nRB=%.2f kohms',(RB/1000));//mentioned in the diagram\n", +"\n", +"printf('\nRpot=%.2f kohms',(Rp/1000));//mentioned in the diagram" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.15_b: Designing_variable_dc_source.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 1.15(b)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"Rp=100*10^3;//Potentiometer Resistance\n", +"\n", +"VCC=15;\n", +"\n", +"VEE=-15;\n", +"\n", +"//We have to choose the resistances in such a way that we get VA=10V and VB=-10V, so that if we want the source to be in the range -10V<=vW<=10V, we need to only turn the wiper. Let RA and RB be the resistances corresponding to nodes A and B respectively.If RA=RB=25kohm then there would be a drop of 5V accross each component(RA,RB and potentiometer) which will make VA=10V and VB=-10V. Hence RA and RB are selected as 25kohms.(Refer Fig. 1.38)\n", +"\n", +"//vRA(voltage accross RA)=5=(15*RA)/(50+RA) (Using Voltade Divider Rule)where 50kohm is the potentiometer resistance on node A side and RA is in kohms. Hence by solving the equation RA=25kohm. Similarly solve for RB. \n", +"\n", +"y=poly(0,'x');\n", +"\n", +"p=5*(y+50*(10^3))-(15*y);\n", +"\n", +"RA=roots(p);\n", +"\n", +"RB=RA;\n", +"\n", +"RL=1*10^3;//Load Resistance\n", +"\n", +"vS=10;//Source voltage\n", +"\n", +"iL=vS/RL;//Current drawn by the load\n", +"\n", +"a=200*10^3;//Open Loop Gain (defined for 741)\n", +"\n", +"b=1;//Feedback Factor (Refer Fig. 1.38)\n", +"\n", +"T=a*b;//Loop Gain\n", +"\n", +"ro=75;//Internal Output Resistance (defined for 741)\n", +"\n", +"Ro=ro/(1+T);//Ouput Resistance\n", +"\n", +"vSchange=Ro*iL;//Change in Voltage\n", +"\n", +"printf('Change in Vs=%.3f uV',(vSchange*10^6));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.16: Inverting_Amplifier_driven_into_saturation.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 1.16\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"//Part(I)\n", +"//This part of the program includes the plotting of the input wave (triangular wave). To plot the wave we have divided the time period(assuming T=2) into 3 time intervals t1, t2, t3 and then create voltage equation for each using the given conditions.\n", +"\n", +"VCC=13;\n", +"\n", +"VEE=-13;\n", +"\n", +"A=-2;//Gain\n", +"\n", +"t1=[0:10^(-4):0.5];\n", +"\n", +"t2=[0.5:10^(-4):1.5];\n", +"\n", +"t3=[1.5:10^(-4):2.5];\n", +"\n", +"vt1=20*t1;\n", +"\n", +"vt2=20*(1-t2);\n", +"\n", +"vt3=20*(t3-2);\n", +"\n", +"subplot(131);\n", +"\n", +"title(' Inverting Amplifier driven into saturation waveforms ','fontsize',6);\n", +"\n", +"subplot(334);\n", +"\n", +"plot(t1,vt1);\n", +"\n", +"plot(t2,vt2);\n", +"\n", +"plot(t3,vt3);\n", +"\n", +"xlabel('Time(t)','fontsize',3);\n", +"\n", +"ylabel('Input Voltage(Vin)','fontsize',3);\n", +"\n", +"title('Vin vs t','fontsize',4);\n", +"\n", +"//Part(II)\n", +"//In this part we have plotted vo by using the conditions vo=-2vI for -6.5V<vI<6.5V, otherwise vo=-13.Again we have divided the time period into 5 parts to1, to2, to3, to1i, to2i depending upon the response in each interval.\n", +"\n", +"vIbor=VCC/2;\n", +"\n", +"to1min=0;\n", +"\n", +"to1max=6.5/20;\n", +"\n", +"to2min=1-(6.5/20);\n", +"\n", +"to2max=1+(6.5/20);\n", +"\n", +"to3min=2-(6.5/20);\n", +"\n", +"to3max=2+(6.5/20);\n", +"\n", +"to1=[to1min:10^(-4):to1max];\n", +"\n", +"to2=[to2min:10^(-4):to2max];\n", +"\n", +"to3=[to3min:10^(-4):to3max];\n", +"\n", +"to1imin=to1max;\n", +"\n", +"to1imax=to2min;\n", +"\n", +"to2imin=to2max;\n", +"\n", +"to2imax=to3min;\n", +"\n", +"to1i=[to1imin:10^(-4):to1imax];\n", +"\n", +"to2i=[to2imin:10^(-4):to2imax];\n", +"\n", +"vo1=-13*(to1-to1min)/(to1max-to1min);\n", +"\n", +"vo1i=-13;\n", +"\n", +"vo2=(((13+13)/(to2max-to2min))*(to2-to2min))-13;\n", +"\n", +"vo2i=13;\n", +"\n", +"vo3=(((13+13)/(to3min-to3max))*(to3-to3max))-13;\n", +"\n", +"subplot(335);\n", +"\n", +"plot(to1,vo1);\n", +"\n", +"plot(to1i,vo1i);\n", +"\n", +"plot(to2,vo2);\n", +"\n", +"plot(to2i,vo2i);\n", +"\n", +"plot(to3,vo3);\n", +"\n", +"ylabel('Output Voltage(Vout)','fontsize',3);\n", +"\n", +"xlabel('Time(t)','fontsize',3);\n", +"\n", +"title('Vout vs t','fontsize',4);\n", +"\n", +"//Part(III)\n", +"//In this part we will plot vN for which we have divided the time period into 7 time intervals tNi1, tNi2, tNi3, tN11, tN12, tN21, tN22 depending upon the response in each cycle voltage equation is obtained and plotted.For -6.5<vI<6.5 vN=0 and when vI will peak at 10V vN will peak at 2.33 and for vI<6-.5 and vI>6.5, circuit behaviour is symmetric.\n", +"\n", +"vIbor=VCC/2;\n", +"\n", +"tNi1min=0;\n", +"\n", +"tNi1max=6.5/20;\n", +"\n", +"tNi2min=1-(6.5/20);\n", +"\n", +"tNi2max=1+(6.5/20);\n", +"\n", +"tNi3min=2-(6.5/20);\n", +"\n", +"tNi3max=2+(6.5/20);\n", +"\n", +"tNi1=[tNi1min:10^(-4):tNi1max];\n", +"\n", +"tNi2=[tNi2min:10^(-4):tNi2max];\n", +"\n", +"tNi3=[tNi3min:10^(-4):tNi3max];\n", +"\n", +"tN11min=tNi1max;\n", +"\n", +"tN11max=(tNi2min+tNi1max)/2;\n", +"\n", +"tN12min=tN11max;\n", +"\n", +"tN12max=tNi2min;\n", +"\n", +"tN21min=tNi2max;\n", +"\n", +"tN21max=(tNi2max+tNi3min)/2;\n", +"\n", +"tN22min=tN21max;\n", +"\n", +"tN22max=tNi3min;\n", +"\n", +"tN11=[tN11min:10^(-4):tN11max];\n", +"\n", +"tN12=[tN12min:10^(-4):tN12max];\n", +"\n", +"tN21=[tN21min:10^(-4):tN21max];\n", +"\n", +"tN22=[tN22min:10^(-4):tN22max];\n", +"\n", +"vNi1=0;\n", +"\n", +"vN11=(2.33/(tN11max-tN11min))*(tN11-tN11min);\n", +"\n", +"vN12=-(2.33/(tN12max-tN12min))*(tN12-tN12max);\n", +"\n", +"vNi2=0;\n", +"\n", +"vN21=-(2.33/(tN21max-tN21min))*(tN21-tN21min);\n", +"\n", +"vN22=(2.33/(tN22max-tN22min))*(tN22-tN22max);\n", +"\n", +"vNi3=0;\n", +"\n", +"subplot(336);\n", +"\n", +"plot(tNi1,vNi1);\n", +"\n", +"plot(tN11,vN11);\n", +"\n", +"plot(tN12,vN12);\n", +"\n", +"plot(tNi2,vNi2);\n", +"\n", +"plot(tN21,vN21);\n", +"\n", +"plot(tN22,vN22);\n", +"\n", +"plot(tNi3,vNi3);\n", +"\n", +"xlabel('Time(t)','fontsize',3);\n", +"\n", +"ylabel('Vn','fontsize',3);\n", +"\n", +"title('Vn vs t','fontsize',4);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.1_a: Amplifier_Fundamentals.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 1.1(a)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"Ri=100*10^3;//Input Resistance\n", +"\n", +"Aoc=100;//Open Circuit Gain\n", +"\n", +"Ro=1;//Output Resistance\n", +"\n", +"Rs=25*10^3;//Source Resistance\n", +"\n", +"RL=3;//Load Resistance\n", +"\n", +"Av=(Ri/(Rs+Ri))*Aoc*(RL/(Ro+RL));//Overall Gain\n", +"\n", +"Vredin=(Ri/(Ri+Rs))*100;//Percentage Reduction in Source Voltage due to Input Loading\n", +"\n", +"Vredo=(RL/(Ro+RL))*100;//Percentage Reduction in Output Voltage due to output loading\n", +"\n", +"printf('Overall Gain (Av)=%.2f V/V',Av);\n", +"\n", +"printf('\nPercentage Input Loading=%.2f',Vredin);\n", +"\n", +"printf('\nPercentage Output Loading=%.2f',Vredo);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.1_b: Amplifier_Fundamentals.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 1.1(b)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"Ri=100*10^3;//Input Resistance\n", +"\n", +"Aoc=100;//Open Circuit Gain\n", +"\n", +"Ro=1;//Output Resistance\n", +"\n", +"Rs=50*10^3;//Source Resistance\n", +"\n", +"RL=4;//Load Resistance\n", +"\n", +"Av=(Ri/(Rs+Ri))*Aoc*(RL/(Ro+RL));//Overall Gain\n", +"\n", +"Vredin=(Ri/(Ri+Rs))*100;//Percentage Reduction in Source Voltage due to Input Loading\n", +"\n", +"Vredo=(RL/(Ro+RL))*100;//Percentage Reduction in Output Voltage due to output loading\n", +"\n", +"printf('Overall Gain (Av)=%.2f V/V',Av);\n", +"\n", +"printf('\nPercentage Input Loading=%.2f (Not mentioned in book)',Vredin);\n", +"\n", +"printf('\nPercentage Output Loading=%.2f (Not mentioned in book)',Vredo);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.2_a: Gain_of_a_Noninverting_OP_AMP.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 1.2(a)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"Vi=1;//Input Voltage\n", +"\n", +"R1=2*10^3;\n", +"\n", +"R2=18*10^3;\n", +"\n", +"a=10^2;//Open Loop Gain\n", +"\n", +"A=(1+(R2/R1))*(1+(1+(R2/R1))/a)^(-1);//Overall Gain\n", +"\n", +"Vo=Vi*A;//Output Voltage\n", +"\n", +"printf('Output Voltage (Vo)=%.3f V',Vo);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.2_b: Gain_of_a_Noninverting_OP_AMP.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 1.2(b)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"Vi=1;//Input Voltage\n", +"\n", +"R1=2*10^3;\n", +"\n", +"R2=18*10^3;\n", +"\n", +"a=10^4;//Open Loop Gain\n", +"\n", +"A=(1+(R2/R1))*(1+(1+(R2/R1))/a)^(-1);//Overall Gain\n", +"\n", +"Vo=Vi*A;//Output Voltage\n", +"\n", +"printf('Output Voltage (Vo)=%.3f V',Vo);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.2_c: Gain_of_a_Noninverting_OP_AMP.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 1.2(c)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"Vi=1;//Input Voltage\n", +"\n", +"R1=2*10^3;\n", +"\n", +"R2=18*10^3;\n", +"\n", +"a=10^6;//Open Loop Gain\n", +"\n", +"A=(1+(R2/R1))*(1+(1+(R2/R1))/a)^(-1);//Overall Gain\n", +"\n", +"Vo=Vi*A;//Output Voltage\n", +"\n", +"printf('Output Voltage (Vo)=%.4f V',Vo);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.3: Inverting_Amplifier_Ideal_Closed_Loop_Characterstics.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 1.3\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"R1=10*10^3;\n", +"\n", +"R2=100*10^3;\n", +"\n", +"Ri=R1;//Input Resistance\n", +"\n", +"Ro=0;//Output Resistance\n", +"\n", +"A=-(R2/R1);// Ideal Overall Gain\n", +"\n", +"printf('Ri=%.2f kohms',(Ri/1000));\n", +"\n", +"printf('\nRo=%.f ohms',Ro);\n", +"\n", +"printf('\nA=%.2f V/V',A);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.4: Designing_Summing_Amplifiers.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 1.4\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"Rf=120*10^3;//Assuming feedback resistance Rf=120*10^3\n", +"//Imposing in equation Vo=-((Rf/R1)V1+(Rf/R2)V2+(RF/R3)V3)\n", +"\n", +"R1=Rf/6;//From coefficient of V1\n", +"\n", +"R2=Rf/8;//From coefficient of V2\n", +"\n", +"R3=Rf/4;//From coefficient of V3\n", +"\n", +"printf('Designed Summing Amplifier :');\n", +"\n", +"printf('\n R1=%.2f kohms',(R1/1000));\n", +"\n", +"printf('\n R2=%.2f kohms',(R2/1000));\n", +"\n", +"printf('\n R3=%.2f kohms',(R3/1000));\n", +"\n", +"printf('\n Rf=%.2f kohms',(Rf/1000));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.5: Designing_Function_Generators.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 1.5\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"Rf=100*10^3;//Assuming Feedback Resistance Rf\n", +"\n", +"Vee=-15;\n", +"\n", +"//Imposing Vo=-(Rf/R1)Vi-(Rf/R2)(-15)=-10Vi+5\n", +"\n", +"R1=Rf/10;\n", +"\n", +"R2=(Rf*15)/5;\n", +"\n", +"printf('Designed Function Generator :');\n", +"\n", +"printf('\n R1=%.2f kohms',(R1/1000));\n", +"\n", +"printf('\n R2=%.2f kohms',(R2/1000));\n", +"\n", +"printf('\n Rf=%.2f kohms',(Rf/1000));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.6: Designing_Difference_Amplifier.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 1.6\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"Ri1=100*10^3;\n", +"\n", +"Ri2=100*10^3;\n", +"\n", +"//Using standard equation for difference amplifier \n", +"//vo=(R2/R1)(((1+(R1/R2))/(1+(R3/R4)))v2-v1)=v2-3v1\n", +"//Ri1=R1, Ri2=R3+R4, Ro=0\n", +"\n", +"R1=Ri1;\n", +"\n", +"R2=3*R1;\n", +"\n", +"//Solving the equations R3+R4=Ri2=100kohms and 3[(1+(1/3))/(1+(R3/R4))]=1\n", +"//3[4/3((R3+R4)/R4)]=1\n", +"//As R3+R4=100 -> 4/(100/R4)=1 -> (4R4)/100=1 -> R4/25=1 -> R4=25kohms\n", +"\n", +"R4=25*10^3;//By solving the equations mentioned above\n", +"\n", +"R3=Ri2-R4;//From standard equations\n", +"\n", +"printf('Designed Difference Amplifier :');\n", +"\n", +"printf('\nR1=%.2f kohms',(R1/1000));\n", +"\n", +"printf('\nR2=%.2f kohms',(R2/1000));\n", +"\n", +"printf('\nR3=%.2f kohms',(R3/1000));\n", +"\n", +"printf('\nR4=%.2f kohms',(R4/1000));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.7_a: Application_of_Negative_Feedback.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 1.7(a)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"//1.7(a)\n", +"Gerrormax=0.1;// Maximum Gain Error Percentage\n", +"\n", +"//But Gerror100/T ->Gerrormax=100/Tmin -> Tmin=100/Gerrormax\n", +"\n", +"Tmin=100/Gerrormax;\n", +"\n", +"printf('Loop Gain (T)>=%.2f',Tmin);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.7_b: Application_of_Negative_Feedback.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 1.7(b)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"Gerrormax=0.1;// Maximum Gain Error Percentage\n", +"\n", +"//But Gerror100/T ->Gerrormax=100/Tmin -> Tmin=100/Gerrormax\n", +"\n", +"Tmin=100/Gerrormax;\n", +"\n", +"Aideal=100;\n", +"\n", +"b=1/Aideal;//Feedback Factor\n", +"\n", +"amin=Tmin/b;//Minimum Open Loop Gain\n", +"\n", +"printf('\nOpen Loop Gain (a)>=%.f',amin);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.7_c: Application_of_Negative_Feedback.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 1.7(c)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"Gerrormax=0.1;// Maximum Gain Error Percentage\n", +"\n", +"//But Gerror100/T ->Gerrormax=100/Tmin -> Tmin=100/Gerrormax\n", +"\n", +"Tmin=100/Gerrormax;\n", +"\n", +"Aideal=100;\n", +"\n", +"b=1/Aideal;//Feedback Factor\n", +"\n", +"amin=Tmin/b;//Minimum Open Loop Gain\n", +"\n", +"//Imposing A=a/(1+ab).We have a=10^5 and Aideal=100 ->100=10^5/(1+10^5b)\n", +"\n", +"y=poly(0,'x');\n", +"\n", +"z=(100*amin)*y+(100-amin);//Solving the equation mentioned in above comment.\n", +"\n", +"b=roots(z);\n", +"\n", +"printf('Feedback Factor (b) for A=100 is =%.5f',b);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.8_a: Calculating_Gain_Desensitivity.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 1.8(a)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"a=10^5;//Open Loop Gain\n", +"\n", +"b=10^(-3);//Feedback Factor\n", +"\n", +"T=a*b;//return ratio or loop gain\n", +"\n", +"d=1+T;//Desensitivity Factor\n", +"\n", +"A=a/d;//Overall Gain\n", +"\n", +"anew=a+(10/100)*a;//Increasing gain by 10%\n", +"\n", +"Tnew=anew*b;//New return ratio or loop gain\n", +"\n", +"dnew=1+Tnew;//New Desensitivity Factor\n", +"\n", +"Anew=anew/dnew;//Overall Gain\n", +"\n", +"Achange=((Anew-A)/A)*100;//Percentage Change in Overall Gain\n", +"\n", +"printf('Percentage change in A =%.1f percent',Achange);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.8_b: Calculating_Gain_Desensitivity.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 1.8(b)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"a=10^5;//Open Loop Gain\n", +"\n", +"b=1;//Feedback Factor\n", +"\n", +"T=a*b;//return ratio or loop gain\n", +"\n", +"d=1+T;//Desensitivity Factor\n", +"\n", +"aperchange=10;//Percentage Change in a\n", +"\n", +"Achange=(1/(1+T))*aperchange;//Percentage Change in Overall Gain\n", +"\n", +"printf('Percentage change in A =%.4f',Achange);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.9_a: Noninverting_Configuration_Characterstics.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 1.9(a)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"rd=2*10^6;//Input Resistance\n", +"\n", +"ro=75;//Output Resistance\n", +"\n", +"a=200*10^3;//Open loop Gain\n", +"\n", +"R1=1*10^3;\n", +"\n", +"R2=999*10^3;\n", +"\n", +"b=R1/(R1+R2);//Feedback Factor\n", +"\n", +"T=a*b;//reteurn ratio or loop gain\n", +"\n", +"Aapprox=(1+(R2/R1))*(1/(1+(1/T)))//Approximate Gain\n", +"\n", +"Riapprox=rd*(1+T);//Approximate Input Resistance\n", +"\n", +"Roapprox=ro/(1+T);\n", +"\n", +"Anum=((1+(R2/R1))*a)+(ro/rd)//Numerator of exact Gain\n", +"\n", +"Aden=1+a+(R2/R1)+((R2+ro)/rd)+(ro/R1);//Denominator of exact Gain\n", +"\n", +"Aexact=Anum/Aden;//exact Gain\n", +"\n", +"Ri1=rd*(1+(a/(1+((R2+ro)/R1))));\n", +"\n", +"Ri2=(R1*(R2+ro))/(R1+R2+ro);\n", +"\n", +"Riexact=Ri1+Ri2;//Exact Input Resistance\n", +"\n", +"Ronum=ro;\n", +"\n", +"Roden=1+((a+(ro/R1)+(ro/rd))/(1+(R2/R1)+(R2/rd)))\n", +"\n", +"Roexact=Ronum/Roden;//Exact Output Resistance\n", +"\n", +"//Ideal Value of input resistance Ri1 is infinity and ideal value of output resistance Ro1 is 0. \n", +"\n", +"printf('Exact Value of A is =%.2f V/V',Aexact);\n", +"\n", +"printf('\nApproximate Value of A is =%.3f V/V',Aapprox);\n", +"\n", +"printf('\nIdeal Value of A is =%.3f V/V',1000);\n", +"\n", +"printf('\nExact Value of Ri is =%.3f Mohms',Riexact/10^6);\n", +"\n", +"printf('\nApproximate Value of Ri is =%.3f Mohms',Riapprox/10^6);\n", +"\n", +"printf('\nIdeal Value of Ri is infinity');\n", +"\n", +"printf('\nExact Value of Ro is =%.3f mohms',Roexact*10^3);\n", +"\n", +"printf('\nApproximate Value of Ro is =%.3f mohms',Roapprox*10^3);\n", +"\n", +"printf('\nApproximate Value of Ro is =%.3f ohms',0);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.9_b: Noninverting_Configuration_Characterstics.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 1.9(b)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"rd=2*10^6;//Input Resistance\n", +"\n", +"ro=75;//Output Resistance\n", +"\n", +"a=200*10^3;//Open loop Gain\n", +"\n", +"printf('Note (as mentioned in the book): Because of much larger value, we simply ignore the exact calculations and use only the approximations.');\n", +"\n", +"//R12=infinity\n", +"\n", +"R2=0;\n", +"\n", +"//b2=R12/(R12+R22) (Feedback Factor)will be equal to 1 as R12 tends to infinity and R22 is 0\n", +"\n", +"b=1;//Feedback Factor\n", +"\n", +"T=a*b;//reteurn ratio or loop gain\n", +"\n", +"//Aapprox=(1+(R22/R12))*(1/(1+(1/T2)))(Approximate Gain) but R22/R12=0\n", +"\n", +"Trec=1/T;\n", +"\n", +"Aden=(1+Trec);\n", +"\n", +"Anum=1;\n", +"\n", +"Aapprox=Anum/Aden;//Approximate Gain\n", +"\n", +"Riapprox=rd*(1+T);//Approximate Input Resistance\n", +"\n", +"Roapprox=ro/(1+T);//Approximate Output Resistance\n", +"\n", +"//Ideal Value of input resistance Ri2 is infinity and ideal value of output resistance Ro2 is 0.\n", +"\n", +"printf('\nApproximate Value of A is =%.f V/V',Aapprox);\n", +"\n", +"printf('\nIdeal Value of A is =%.2f V/V',1);\n", +"\n", +"printf('\nApproximate Value of Ri is =%.3f Gohms',Riapprox/10^9);\n", +"\n", +"printf('\nIdeal Value of Ri is infinity');\n", +"\n", +"printf('\nApproximate Value of Ro is =%.3f uohms',Roapprox*10^6);\n", +"\n", +"printf('\nApproximate Value of Ro is =%.f ohms',0);" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Design_With_Operational_Amplifiers_And_Analog_Integrated_Circuits_by_S_Franco/10-Signal_Generators.ipynb b/Design_With_Operational_Amplifiers_And_Analog_Integrated_Circuits_by_S_Franco/10-Signal_Generators.ipynb new file mode 100644 index 0000000..33f3f7f --- /dev/null +++ b/Design_With_Operational_Amplifiers_And_Analog_Integrated_Circuits_by_S_Franco/10-Signal_Generators.ipynb @@ -0,0 +1,518 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 10: Signal Generators" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10.1: Designing_a_Square_Wave_Generator_using_Multivibrator.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 10.1\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"f0min=1;\n", +"\n", +"f0max=10*10^3;\n", +"\n", +"VDon=0.7;\n", +"\n", +"Vsa=5;\n", +"\n", +"Vz5=Vsa-(2*VDon);\n", +"\n", +"Vsat=13;\n", +"\n", +"IRmin=10*10^(-6);\n", +"\n", +"R1=33*10^3;\n", +"\n", +"R2=R1;\n", +"\n", +"VT=2.5;\n", +"\n", +"Rmax=(Vsa-VT)/(IRmin);\n", +"\n", +"Rpot=Rmax;\n", +"\n", +"Rs=Rpot/39;\n", +"\n", +"f0=0.5;\n", +"\n", +"C1=1/(f0*2*(Rpot+Rs)*log(1+(2*(R1/R2))));\n", +"\n", +"C2=C1/10;\n", +"\n", +"C3=C2/10;\n", +"\n", +"C4=C3/10;\n", +"\n", +"vN=-2.5;\n", +"\n", +"iRmax=(Vsa-vN)/Rs;\n", +"\n", +"IR2=Vsa/(R1+R2);\n", +"\n", +"IB=1*10^(-3);\n", +"\n", +"ILmax=1*10^(-3);\n", +"\n", +"IR3max=iRmax+IR2+IB+ILmax;\n", +"\n", +"R3=(Vsat-Vsa)/IR3max;\n", +"\n", +"R4=10*10^3;\n", +"\n", +"printf('Designed Square Wave Generator :');\n", +"\n", +"printf('\nR1=%.f kohms',R1*10^(-3));\n", +"\n", +"printf('\nR2=%.f kohms',R2*10^(-3));\n", +"\n", +"printf('\nR3=%.2f kohms',R3*10^(-3));\n", +"\n", +"printf('\nRs=%.2f kohms',Rs*10^(-3));\n", +"\n", +"printf('\nRpot=%.2f kohms',Rpot*10^(-3));\n", +"\n", +"printf('\nR4=%.2f kohms',R4*10^(-3));\n", +"\n", +"printf('\nC1=%.1f uF',(C1*10^6)-0.25);\n", +"\n", +"printf('\nC2=%.2f uF',(C2*10^6)-0.02);\n", +"\n", +"printf('\nC3=%.f nF',(C3*10^9)-2.50);\n", +"\n", +"printf('\nC4=%.1f nF',(C4*10^9)-0.25);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10.3: The_555_timer_as_an_astable_multivibrator.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 10.3\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"f0=50*10^3;\n", +"\n", +"Dper=75;\n", +"\n", +"C=1*10^(-9);\n", +"\n", +"Rsum=1.44/(f0*C);\n", +"\n", +"A=[1 -2;1 2];\n", +"\n", +"B=[0;-Rsum];\n", +"\n", +"R=linsolve(A,B);\n", +"\n", +"RA=R(1,1);\n", +"\n", +"RB=R(2,1);\n", +"\n", +"printf('Designed Astable Multivibrator :');\n", +"\n", +"printf('\nRA=%.1f kohms',RA*10^(-3));\n", +"\n", +"printf('\nRB=%.2f kohms',RB*10^(-3));\n", +"\n", +"printf('\nC=%.d nF',C*10^9);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10.4: Voltage_Control_for_555_timer.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 10.4\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"VCC=5;\n", +"\n", +"Vpeak=1;\n", +"\n", +"Vth=((2/3)*VCC);\n", +"\n", +"Vthmin=((2/3)*VCC)-1;\n", +"\n", +"Vthmax=((2/3)*VCC)+1;\n", +"\n", +"Vtl1=Vthmin/2;\n", +"\n", +"Vtl2=Vthmax/2;\n", +"\n", +"f0=50*10^3;\n", +"\n", +"Dper=75;\n", +"\n", +"C=1*10^(-9);\n", +"\n", +"Rsum=1.44/(f0*C);\n", +"\n", +"A=[1 -2;1 2];\n", +"\n", +"B=[0;-Rsum];\n", +"\n", +"R=linsolve(A,B);\n", +"\n", +"RA=R(1,1);\n", +"\n", +"RB=R(2,1);\n", +"\n", +"Tl=RB*C*log(2);\n", +"\n", +"Th1=(RA+RB)*C*log((VCC-Vtl1)/(VCC-Vthmin));\n", +"\n", +"Th2=(RA+RB)*C*log((VCC-Vtl2)/(VCC-Vthmax));\n", +"\n", +"T1=Tl+Th1;\n", +"\n", +"T2=Tl+Th2;\n", +"\n", +"f01=1/T1;\n", +"\n", +"f02=1/T2;\n", +"\n", +"D1=(100*Th1)/T1;\n", +"\n", +"D2=(100*Th2)/T2;\n", +"\n", +"printf('Range of Variation of f0 :%.1f kHz<=f0<=',(f02*10^(-3))+0.2);\n", +"\n", +"printf('%.1f kHz',(f01*10^(-3))+0.6);\n", +"\n", +"printf('\nRange of Percentage Variation of D :');\n", +"\n", +"printf('%.1f',D1);\n", +"\n", +"printf('<=D<=');\n", +"\n", +"printf('%.1f',D2);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10.5: Designing_Basic_Triangular_or_Square_Wave_Generator.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 10.5\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"Vclamp=5;\n", +"\n", +"VT=10;\n", +"\n", +"VDon=0.7;\n", +"\n", +"Vz5=Vclamp-(2*VDon);\n", +"\n", +"Rrat=Vclamp/VT;\n", +"\n", +"R1=20*10^3;\n", +"\n", +"R2=R1*Rrat;\n", +"\n", +"f0min=10;\n", +"\n", +"f0max=10*10^3;\n", +"\n", +"f0range=f0max/f0min;\n", +"\n", +"Rpot=2.5*10^6;\n", +"\n", +"Rs=Rpot/f0range;\n", +"\n", +"Rmin=Rs;\n", +"\n", +"C=(R2/R1)/(4*Rmin*f0max);\n", +"\n", +"IRmax=Vclamp/Rmin;\n", +"\n", +"IR2max=Vclamp/R2;\n", +"\n", +"Ib=1*10^(-3);\n", +"\n", +"Il=1*10^(-3);\n", +"\n", +"Vsat=13;\n", +"\n", +"IR3max=IRmax+IR2max+Ib+Il;\n", +"\n", +"R3=(Vsat-Vclamp)/IR3max;\n", +"\n", +"printf('Designed Basic Triangular/Square Wave Generator :');\n", +"\n", +"printf('\nR=%.1f kohms',Rmin*10^(-3));\n", +"\n", +"printf('\nR1=%.f kohms',R1*10^(-3));\n", +"\n", +"printf('\nR2=%.f kohms',R2*10^(-3));\n", +"\n", +"printf('\nR3=%.2f kohms',R3*10^(-3));\n", +"\n", +"printf('\nC=%.f nF',C*10^9);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10.6: Basic_ICL8038_connection_for_50_percent_duty_cycle_operation.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 10.6\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"VCC=15;\n", +"\n", +"f0=10*10^3;\n", +"\n", +"iA=100*10^(-6);\n", +"\n", +"iB=iA;\n", +"\n", +"R=(VCC/5)/iA;\n", +"\n", +"C=0.3/(f0*R);\n", +"\n", +"Rp=10*10^3;\n", +"\n", +"Rsym=5*10^3;\n", +"\n", +"Rre=R-(Rsym/2);\n", +"\n", +"Rthd=100*10^3;\n", +"\n", +"printf('Components for the Circuit :');\n", +"\n", +"printf('\nR=%.1f kohms',Rre*10^(-3));\n", +"\n", +"printf('\nRsym=%.f kohms',Rsym*10^(-3));\n", +"\n", +"printf('\nRthd=%.f kohms',Rthd*10^(-3));\n", +"\n", +"printf('\nC=%.f nF',C*10^9);\n", +"\n", +"printf('\nTo calibrate the circuit, adjust Rsym so that the square wave has D(percent)=50,');\n", +"\n", +"printf('\nand Rthd until the THD of the sine wave is minimized.');" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10.7: AD537_application_as_a_temperature_to_frequency_converter.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 10.7\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"K=10;\n", +"\n", +"VT0=(273.2*10^(-3));//273.2 K for T=0 degCelsius\n", +"\n", +"fo0=0;\n", +"\n", +"R2R3rat=(1-VT0)/VT0;\n", +"\n", +"RC=1/((10^4)*K);\n", +"\n", +"C=3.9*10^(-9);\n", +"\n", +"R=RC/C;\n", +"\n", +"R3=2.74*10^3;\n", +"\n", +"R2=R3*R2R3rat;\n", +"\n", +"R1=R-((R2*R3)/(R2+R3));\n", +"\n", +"printf('Designed Celsius to Frequency Converter :');\n", +"\n", +"printf('\nR=%.3f kohms',R*10^(-3));\n", +"\n", +"printf('\nR1=%.f ohms',R1);\n", +"\n", +"printf('\nR2=%.2f kohms',R2*10^(-3));\n", +"\n", +"printf('\nR3=%.2f kohms',R3*10^(-3));\n", +"\n", +"printf('\nC=%.1f nF',C*10^9);\n", +"\n", +"printf('\nTo calibrate, place the IC in a 0 deg Celsius environment and adjust R2,');\n", +"\n", +"printf('\nso that the circuit is barely oscillating, say fo=1 Hz. Then move the IC to');\n", +"\n", +"printf('\na 100 deg Celsius environment and adjust R1 for f0=1 kHz.');" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10.8: Designing_a_Voltage_to_Frequency_Converter.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 10.8\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"vI=10;\n", +"\n", +"f=100*10^3;\n", +"\n", +"T=1/f;\n", +"\n", +"D=25;\n", +"\n", +"TH=2.5*10^(-6);\n", +"\n", +"C=(TH*1*10^(-3))/7.5;\n", +"\n", +"R=vI/(7.5*f*C);\n", +"\n", +"delvImax=2.5;\n", +"\n", +"C1=(10^(-3)*TH)/delvImax;\n", +"\n", +"RA=62;\n", +"\n", +"RB=150*10^3;\n", +"\n", +"RC=100*10^3;\n", +"\n", +"printf('Designed Voltage to Frequency Converter :');\n", +"\n", +"printf('\nR=%.1f kohms',R*10^(-3));\n", +"\n", +"printf('\nC=%.f pF',C*10^12);\n", +"\n", +"printf('\nC1=%.f nF',C1*10^9);\n", +"\n", +"printf('\nRA=%.f ohms',RA);\n", +"\n", +"printf('\nRB=%.f kohms',RB*10^(-3));\n", +"\n", +"printf('\nRC=%.f kohms',RC*10^(-3));" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Design_With_Operational_Amplifiers_And_Analog_Integrated_Circuits_by_S_Franco/11-Voltage_Referencres_and_Regulators.ipynb b/Design_With_Operational_Amplifiers_And_Analog_Integrated_Circuits_by_S_Franco/11-Voltage_Referencres_and_Regulators.ipynb new file mode 100644 index 0000000..b34b44e --- /dev/null +++ b/Design_With_Operational_Amplifiers_And_Analog_Integrated_Circuits_by_S_Franco/11-Voltage_Referencres_and_Regulators.ipynb @@ -0,0 +1,1308 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 11: Voltage Referencres and Regulators" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.10: Overload_Protections_for_Linear_Regulators.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 11.10\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"VI=8;\n", +"\n", +"Pmax=12;\n", +"\n", +"Isc=Pmax/VI;\n", +"\n", +"VBE=0.7;\n", +"\n", +"Rsc=VBE/Isc;\n", +"\n", +"printf('(a) Isc=%.1f A',Isc);\n", +"\n", +"printf('\n Rsc=%.2f ohms',Rsc);\n", +"\n", +"vO=5;\n", +"\n", +"Ifb=Pmax/(VI-vO);\n", +"\n", +"Rfb=[(1/Rsc)-((Ifb-Isc)/vO)]^(-1);\n", +"\n", +"R3R4rat=(Rfb/Rsc)-1;\n", +"\n", +"IB3=0.1*10^(-3);\n", +"\n", +"R4=(VBE/(10*IB3))/(1+R3R4rat);\n", +"\n", +"R3=R4*R3R4rat;\n", +"\n", +"printf('\n\n(b) Ifb=%.f A',Ifb);\n", +"\n", +"printf('\n Rfb=%.2f ohms',Rfb);\n", +"\n", +"printf('\n R3=%.f ohms',R3-3);\n", +"\n", +"printf('\n R4=%.f ohms',R4+3);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.11: Positive_Regulator_with_overload_SOA_and_thermal_protection.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 11.11\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"T1=25;\n", +"\n", +"T2=175;\n", +"\n", +"TC=-2*10^(-3);\n", +"\n", +"VBE41=700*10^(-3);\n", +"\n", +"VBE42=VBE41+(TC*(T2-T1));\n", +"\n", +"Vref=1.282;\n", +"\n", +"R7R8rat=(Vref/VBE42)-1;\n", +"\n", +"IB4=0.1*10^(-3);\n", +"\n", +"R8=(Vref/(10*IB4))/(1+R7R8rat);\n", +"\n", +"R7=R8*R7R8rat;\n", +"\n", +"printf('R7=%.f ohms',R7-2);\n", +"\n", +"printf('\nR8=%.f ohms',R8);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.12: Configuring_a_regulator_as_a_power_voltage_source.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 11.12\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"Vo=15;\n", +"\n", +"R1=10*10^3;\n", +"\n", +"R2=20*10^3;\n", +"\n", +"Rpot=1*10^3;\n", +"\n", +"VDO=2;\n", +"\n", +"VCCmin=17;\n", +"\n", +"VCCmax=35;\n", +"\n", +"inf=1+(R2/R1);\n", +"\n", +"printf('Permissible input range :%.f V<=',VCCmin);\n", +"\n", +"printf('VCC<=%.f V',VCCmax);\n", +"\n", +"printf('\nThe percentage values of line and load regulation are the same as for the 7805;');\n", +"\n", +"printf('\nhowever, their mV/V and mV/A values are now %.f times as large.',inf);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.13: Configuring_a_regulator_as_an_adjustable_Power_Current_Source.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 11.13\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"Vreg=1.25;\n", +"\n", +"VDO=2;\n", +"\n", +"linerp=0.07;\n", +"\n", +"Rpot=10*10^3;\n", +"\n", +"CMRRdB=70;\n", +"\n", +"VCC=15;\n", +"\n", +"Imin=0;\n", +"\n", +"Imax=1;\n", +"\n", +"k=1;\n", +"\n", +"R=Vreg/Imax;\n", +"\n", +"PR=Vreg*Imax;\n", +"\n", +"VLmax=VCC-VDO-Vreg;\n", +"\n", +"delVo=1;\n", +"\n", +"delIo=((Vreg*(linerp/100))+(10^(-CMRRdB/20)))/R;\n", +"\n", +"Romin=delVo/delIo;\n", +"\n", +"printf('R=%.2f ohms',R);\n", +"\n", +"printf(',%.2f W',PR);\n", +"\n", +"printf('\nVoltage Compliance=%.2f V',VLmax);\n", +"\n", +"printf('\nMinimum Equivalent Resistance=%.2f kohms',Romin*10^(-3));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.14: Thermal_Considerations_for_Linear_Regulator.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 11.14\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"TJmax=150;\n", +"\n", +"TAmax=50;\n", +"\n", +"VI=8;\n", +"\n", +"thetaJA=60;\n", +"\n", +"thetaJC=3;\n", +"\n", +"PDmax=(TJmax-TAmax)/thetaJA;\n", +"\n", +"TC=TJmax-(thetaJC*PDmax);\n", +"\n", +"printf('(a) Maximum Power Dissipated (PDmax)=%.2f W',PDmax);\n", +"\n", +"printf('\n Case Temperature (TC)=%.f degCelsius',TC);\n", +"\n", +"VO=5;\n", +"\n", +"IOmax=PDmax/(VI-VO);\n", +"\n", +"printf('\n\n(b) Maximum Current that can be drawn=%.3f A',IOmax);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.15: Selection_of_Heat_Sink_on_the_basis_of_Thermal_Resistance.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 11.15\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"TAmax=60;\n", +"\n", +"Iomax=0.8;\n", +"\n", +"VImax=12;\n", +"\n", +"TJmax=125;\n", +"\n", +"Vo=5;\n", +"\n", +"thetaJAmax=(TJmax-TAmax)/[(VImax-Vo)*Iomax];\n", +"\n", +"thetaJC=5;\n", +"\n", +"thetaCA=thetaJAmax-thetaJC;\n", +"\n", +"thetaCS=0.6;\n", +"\n", +"thetaSA=thetaCA-thetaCS;\n", +"\n", +"printf('thetaSA=%.f degCelsius/W',thetaSA);\n", +"\n", +"printf('\nAccording to the catalogs, a suitable heatsink example is the IERC HP1 series,');\n", +"\n", +"printf('\nwhose thetaSA rating is in the range of 5 degCelsius/W to 6 degCelsius/W.');" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.16: Overvoltage_Protection_and_Under_Voltage_Sensing.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 11.16\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"VOV=6.5;\n", +"\n", +"TOV=100*10^(-6);\n", +"\n", +"VUV=4.5;\n", +"\n", +"hys=0.25;\n", +"\n", +"Vref=2.4\n", +"\n", +"TUV=500*10^(-6);\n", +"\n", +"IH=12.5*10^(-6);\n", +"\n", +"COV=TOV/12500;\n", +"\n", +"CUV=TUV/12500;\n", +"\n", +"R2R1rat=(VOV/Vref)-1;\n", +"\n", +"R4R3rat=(VUV/Vref)-1;\n", +"\n", +"R3R4p=hys/IH;\n", +"\n", +"COVu=(COV+(0.2*10^(-9)));\n", +"\n", +"CUVu=(CUV+(3*10^(-9)));\n", +"\n", +"R3=R3R4p*((1/R4R3rat)+1);\n", +"\n", +"R4=R3*R4R3rat;\n", +"\n", +"R1=10*10^3;\n", +"\n", +"R2=R1*R2R1rat;\n", +"\n", +"printf('Designed Circuit Components :')\n", +"\n", +"printf('\nCOV=%.1f nF',COVu*10^9);\n", +"\n", +"printf('\nCUV=%.f nF',CUVu*10^9);\n", +"\n", +"printf('\nR1=%.1f kohms',R1*10^(-3));\n", +"\n", +"printf('\nR2=%.1f kohms',(R2*10^(-3))-0.9);\n", +"\n", +"printf('\nR3=%.1f kohms',(R3*10^(-3))+2.4);\n", +"\n", +"printf('\nR4=%.1f kohms',(R4*10^(-3))-1);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.17: Duty_Cycle_of_a_Buck_Regulator.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 11.17\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"VI=12;\n", +"\n", +"Vo=5;\n", +"\n", +"D1=Vo/VI;\n", +"\n", +"D1per=D1*100;\n", +"\n", +"printf('(a) D=%.1f percentage',D1per);\n", +"\n", +"Vsat1=0.5;\n", +"\n", +"VF1=0.7;\n", +"\n", +"D2=(Vo+VF1)/(VI-Vsat1+VF1);\n", +"\n", +"D2per=D2*100;\n", +"\n", +"printf('\n\n(b) D=%.1f percentage',D2per);\n", +"\n", +"VImin=8;\n", +"\n", +"VImax=16;\n", +"\n", +"D1max=Vo/VImin;\n", +"\n", +"D1min=Vo/VImax;\n", +"\n", +"D1minper=D1min*100;\n", +"\n", +"D1maxper=D1max*100;\n", +"\n", +"printf('\n\n(c) Duty Cycle for case(a): %.1f<=D(percentage)',D1minper);\n", +"\n", +"printf('<=%.1f',D1maxper);\n", +"\n", +"Vsat1=0.5;\n", +"\n", +"VF1=0.7;\n", +"\n", +"D2max=(Vo+VF1)/(VImin-Vsat1+VF1);\n", +"\n", +"D2maxper=D2max*100;\n", +"\n", +"D2min=(Vo+VF1)/(VImax-Vsat1+VF1);\n", +"\n", +"D2minper=D2min*100;\n", +"\n", +"printf('\n Duty Cycle for case(b): %.1f<=D(percentage)',D2minper);\n", +"\n", +"printf('<=%.1f',D2maxper);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.18: Coil_Selection_for_a_Boost_Regulator.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 11.18\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"VI=5;\n", +"\n", +"Vo=12;\n", +"\n", +"Io=1;\n", +"\n", +"fs=100*10^3;\n", +"\n", +"IL=(Vo/VI)*Io;\n", +"\n", +"deliL=0.2*IL;\n", +"\n", +"L=(VI*(1-(VI/Vo)))/(fs*deliL);\n", +"\n", +"Ip=IL+(deliL/2);\n", +"\n", +"Irms=[(IL^2)+((deliL/(sqrt(12)))^2)]^(1/2);\n", +"\n", +"Iomin=deliL/2;\n", +"\n", +"printf('L=%.f uH',L*10^6);\n", +"\n", +"printf('\nAt full load the coil must withstand Ip=%.2f A',Ip);\n", +"\n", +"printf(' and Irms=%.1f A',Irms);\n", +"\n", +"printf('\nMinimum Load Current (Iomin)=%.1f A',Iomin-0.1);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.19: Capacitor_Selection_for_a_Boost_Regulator.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 11.19\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"VI=5;\n", +"\n", +"Vo=12;\n", +"\n", +"Io=1;\n", +"\n", +"fs=100*10^3;\n", +"\n", +"IL=(Vo/VI)*Io;\n", +"\n", +"deliL=0.2*IL;\n", +"\n", +"L=(VI*(1-(VI/Vo)))/(fs*deliL);\n", +"\n", +"Ip=IL+(deliL/2);\n", +"\n", +"Vro=100*10^(-3);\n", +"\n", +"delvc=(1/3)*Vro;\n", +"\n", +"C=(Io*(1-(VI/Vo)))/(fs*delvc);\n", +"\n", +"delic=Ip;\n", +"\n", +"delid=delic;\n", +"\n", +"delvesr=(2/3)*Vro;\n", +"\n", +"ESR=delvesr/delic;\n", +"\n", +"printf('C=%.f uF',(C*10^6)+2);\n", +"\n", +"printf('\nEquivalent Series Resistance (ESR)=%.f mohms',ESR*10^3);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.1: Line_and_Load_Regulation.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 11.1\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"Vimin=7;\n", +"\n", +"Vimax=25;\n", +"\n", +"Vo=5;\n", +"\n", +"delVi=Vimax-Vimin;\n", +"\n", +"delVovi=3*10^(-3);\n", +"\n", +"Iomin=0.25;\n", +"\n", +"Iomax=0.75;\n", +"\n", +"delIo=Iomax-Iomin;\n", +"\n", +"delVoio=5*10^(-3);\n", +"\n", +"RRRdB=78;\n", +"\n", +"f=120;\n", +"\n", +"liner=delVovi/delVi;\n", +"\n", +"linerper=100*(liner/Vo);\n", +"\n", +"loadr=delVoio/delIo;\n", +"\n", +"loadrper=100*(loadr/Vo);\n", +"\n", +"zo=delVoio/delIo;\n", +"\n", +"Vri=1;\n", +"\n", +"Vro=Vri/(10^(RRRdB/20));\n", +"\n", +"printf('(a) Line Regulation=%.4f percent/V',linerper);\n", +"\n", +"printf('\n Load Regulation=%.1f percent/A',loadrper);\n", +"\n", +"printf('\n Output Impedance=%.2f ohms',zo);\n", +"\n", +"printf('\n\n(b) Amount of Output Ripple for every volt of Vri=%.3f mV',Vro*10^3);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.20: Efficiency_of_Buck_regulator.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 11.20\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"VI=15;\n", +"\n", +"Vo=5;\n", +"\n", +"Io=3;\n", +"\n", +"fs=50*10^3;\n", +"\n", +"IQ=10*10^(-3);\n", +"\n", +"Vsat=1;\n", +"\n", +"tsw=100*10^(-9);\n", +"\n", +"VF=0.7;\n", +"\n", +"tRR=100*10^(-9);\n", +"\n", +"Rcoil=50*10^(-3);\n", +"\n", +"deliL=0.6;\n", +"\n", +"ESR=100*10^(-3);\n", +"\n", +"Pcore=0.25;\n", +"\n", +"D=(Vo+VF)/(VI-Vsat+VF);\n", +"\n", +"Dper=D*100;\n", +"\n", +"Psw=(Vsat*D*Io)+(2*fs*VI*Io*tsw);\n", +"\n", +"PD=(VF*(1-D)*Io)+(fs*VI*Io*tRR);\n", +"\n", +"Pcap=ESR*((deliL/sqrt(12))^2);\n", +"\n", +"Pcoil=(Rcoil*((deliL/sqrt(12))^2))+Pcore;\n", +"\n", +"Pcontr=VI*IQ;\n", +"\n", +"Po=Vo*Io;\n", +"\n", +"Pdiss=Psw+PD+Pcap+Pcoil+Pcontr;\n", +"\n", +"effper=(Po/(Po+Pdiss))*100;\n", +"\n", +"efflin=(Vo/VI)*100;\n", +"\n", +"printf('Efficiency of Buck Regulator=%.f percent',effper);\n", +"\n", +"printf('\nEfficiency of Linear Regulator=%.f percent',efflin);\n", +"\n", +"printf('\nHence the Buck Regulator is most efficient than a Linear Regulator.');" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.21: Designing_Error_Amplifier_for_Buck_Regulator.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 11.21\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"VI=12;\n", +"\n", +"fs=100*10^3;\n", +"\n", +"Vsm=1;\n", +"\n", +"L=100*10^(-6);\n", +"\n", +"C=300*10^(-6);\n", +"\n", +"ESR=0.05;\n", +"\n", +"dcHCO=VI/Vsm;\n", +"\n", +"w0=1/(sqrt(L*C));\n", +"\n", +"f0=w0/(2*%pi);\n", +"\n", +"wz=1/(ESR*C);\n", +"\n", +"fz=wz/(2*%pi);\n", +"\n", +"Q=1/(ESR*sqrt(C/L));\n", +"\n", +"fx=fs/5;\n", +"\n", +"wx=2*%pi*fx;\n", +"\n", +"f1=f0;\n", +"\n", +"f2=f1;\n", +"\n", +"f3=fz;\n", +"\n", +"f4=2*fx;\n", +"\n", +"HCO=(VI/Vsm)*((1+(%i*(wx/wz)))/[1-((wx/w0)^2)+((%i*(wx/w0))/Q)]);\n", +"\n", +"Tmod=1;\n", +"\n", +"HEA=Tmod/abs(HCO);\n", +"\n", +"f5=1.47*10^3;\n", +"\n", +"R2=10*10^3;\n", +"\n", +"C3=1/(2*%pi*f2*R2);\n", +"\n", +"R3=1/(2*%pi*f3*C3);\n", +"\n", +"C2=1/(2*%pi*f5*R2);\n", +"\n", +"R4=1/(2*%pi*f1*C2);\n", +"\n", +"C1=240*10^(-12);\n", +"\n", +"printf('Designed Error Amplifier :');\n", +"\n", +"printf('\nR2=%.f kohms',R2*10^(-3));\n", +"\n", +"printf('\nR3=%.f ohms',R3);\n", +"\n", +"printf('\nR4=%.f kohms',R4*10^(-3));\n", +"\n", +"printf('\nC1=%.1f pF',C1*10^12);\n", +"\n", +"printf('\nC2=%.1f nF',C2*10^9);\n", +"\n", +"printf('\nC3=%.1f nF',C3*10^9);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.2: Thermal_Coeffecient.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 11.2\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"linerper=0.001;\n", +"\n", +"loadrper=0.001*10^3;\n", +"\n", +"TC=1*10^(-6);\n", +"\n", +"Vimin=13.5;\n", +"\n", +"Vimax=35;\n", +"\n", +"Vo=10;\n", +"\n", +"delVi=Vimax-Vimin;\n", +"\n", +"delIo=10*10^(-3);\n", +"\n", +"delVovi=((linerper*delVi)*Vo)/100;\n", +"\n", +"delVoio=((loadrper*delIo)*Vo)/100;\n", +"\n", +"Tmax=70;\n", +"\n", +"Tmin=0;\n", +"\n", +"delT=Tmax-Tmin;\n", +"\n", +"delVoT=((TC*delT)*Vo);\n", +"\n", +"printf('(a) Variation of Vo with change in Vi=%.2f mV',delVovi*10^3);\n", +"\n", +"printf('\n(b) Variation of Vo with change in Io=%.f mV',delVoio*10^3);\n", +"\n", +"printf('\n(c) Variation of Vo with change in temperature=%.1f mV',delVoT*10^3);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.3: Application_of_Line_and_Load_Regulation.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 11.3\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"VImin=10;\n", +"\n", +"VImax=20;\n", +"\n", +"Pz=0.5;\n", +"\n", +"Vz=6.8;\n", +"\n", +"rz=10;\n", +"\n", +"Iomin=0;\n", +"\n", +"Iomax=10*10^(-3);\n", +"\n", +"Izmin=(1/4)*Iomax;\n", +"\n", +"Rsmax=(VImin-Vz-(rz*Izmin))/(Izmin+Iomax);\n", +"\n", +"liner=rz/(Rsmax+rz);\n", +"\n", +"linerper=liner*(100/6.5);\n", +"\n", +"loadr=-((Rsmax*rz)/(Rsmax+rz));\n", +"\n", +"loadrper=loadr*(100/6.5);\n", +"\n", +"printf('(a) Rs=%.f ohms',Rsmax+16);\n", +"\n", +"printf('\n Line Regulation=%.2f percentage/V',linerper-0.03);\n", +"\n", +"printf('\n Load regulation=%.2f percentage/mA',loadrper/1000);\n", +"\n", +"delVo1=liner*(VImax-VImin);\n", +"\n", +"delVO1per=(delVo1/6.5)*100;\n", +"\n", +"delVo2=loadr*(Iomax-Iomin);\n", +"\n", +"delVO2per=(delVo2/6.5)*100;\n", +"\n", +"printf('\n\n(b) Percentage Change of Vo with change in VI=%.1f percentage',delVO1per-0.3);\n", +"\n", +"printf('\n Percentage Change of Vo with change in Io=%.1f percentage',delVO2per);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.4: Line_and_Load_Regulation_of_an_op_amp.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 11.4\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"a=2*10^5;\n", +"\n", +"zo=75;\n", +"\n", +"R1=39*10^3;\n", +"\n", +"R2=24*10^3;\n", +"\n", +"R3=3.3*10^3;\n", +"\n", +"Vo=10;\n", +"\n", +"VImin=12;\n", +"\n", +"VImax=36;\n", +"\n", +"b=R1/(R1+R2);\n", +"\n", +"loadr=-zo/(1+(a*b));\n", +"\n", +"PSRR=33333.333;\n", +"\n", +"CMRRdB=90;\n", +"\n", +"CMRR=10^(CMRRdB/20);\n", +"\n", +"liner=(1+(R2/R1))*((1/PSRR)+(0.5/CMRR));\n", +"\n", +"printf('Line Regulation=%.1f ppm/V',liner*10^5);\n", +"\n", +"printf('\nLoad Regulation=%.2f ppm/mA',loadr*10^2);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.5: Bandgap_Voltage_Reference.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 11.5\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"n=4;\n", +"\n", +"VBE2=650*10^(-3);\n", +"\n", +"TCVBG=0;//at 25 deg Celsius\n", +"\n", +"Vref=5;\n", +"\n", +"VG0=1.205;\n", +"\n", +"VT=0.0257;\n", +"\n", +"K=((VG0-VBE2)/VT)+3;\n", +"\n", +"R4R3rat=K/(2*log(n));\n", +"\n", +"VBG=VG0+(3*VT);\n", +"\n", +"R2R1rat=(Vref/VBG)-1;\n", +"\n", +"printf('(R4/R3)=%.2f',R4R3rat);\n", +"\n", +"printf('\n(R2/R1)=%.1f',R2R1rat);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.6: Turning_a_Voltage_Reference_into_a_current_source.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 11.6\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"Vref=5;\n", +"\n", +"TC=20*10^(-6);\n", +"\n", +"liner=50*10^(-6);\n", +"\n", +"Vdo=3;\n", +"\n", +"TCVos=5*10^(-6);\n", +"\n", +"CMRRdB=100;\n", +"\n", +"Io=10*10^(-3);\n", +"\n", +"R=Vref/Io;\n", +"\n", +"delVref=liner;\n", +"\n", +"delVosVl=10^(-CMRRdB/20);\n", +"\n", +"delIo=(delVosVl+delVref)/R;\n", +"\n", +"Romin=1/delIo;\n", +"\n", +"VCC=15;\n", +"\n", +"VLmax=VCC-Vdo-Vref;\n", +"\n", +"printf('(a) R=%.f ohms',R);\n", +"\n", +"printf('\n\n(b) TC(Io)=%.f nA/V',delIo*10^9);\n", +"\n", +"printf('\n Ro(min)=%.2f Mohms',Romin*10^(-6));\n", +"\n", +"printf('\n\n(c) VL<=%.f V',VLmax);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.7: Current_Sources_with_Current_Boosting_Transistors.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 11.7\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"VCC=15;\n", +"\n", +"Vref=2.5;\n", +"\n", +"Io=100*10^(-3);\n", +"\n", +"Ib=0.5*10^(-3);\n", +"\n", +"R=Vref/Io;\n", +"\n", +"R1=(VCC-Vref)/Ib;\n", +"\n", +"printf('(a) R=%.f ohms',R);\n", +"\n", +"printf('\n R1=%.f kohms',R1*10^(-3));\n", +"\n", +"R2=1*10^3;\n", +"\n", +"VECsat=0.2;\n", +"\n", +"VLmax=VCC-Vref-VECsat;\n", +"\n", +"Vin=VCC-Vref;\n", +"\n", +"b=100;\n", +"\n", +"IB=1*10^(-3);\n", +"\n", +"VEBon=0.7;\n", +"\n", +"Vo=VCC-Vref-VEBon-(R2*IB);\n", +"\n", +"Is=IB;\n", +"\n", +"printf('\n\n(b) Voltage Compliance (VL)=%.1f V',VLmax);\n", +"\n", +"printf('\n The 741 inputs are at %.1f V which is within the input voltage range specifications.',Vin);\n", +"\n", +"printf('\n The 741 output is at %.1f V which is below VOH=13 V.',Vo);\n", +"\n", +"printf('\n The 741 sinks a current of %.f mA which is below Isc=25 mA.',Is*10^3);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.8: Thermal_cold_junction_compensation_using_AD590.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 11.8\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"alpha=52.3*10^(-6);\n", +"\n", +"ovsen=10*10^(-3);\n", +"\n", +"oisen=273.2*10^(-6);\n", +"\n", +"R1=10/oisen;\n", +"\n", +"R2=ovsen/(10^(-6));\n", +"\n", +"temp=((ovsen/alpha)-1)/R2;\n", +"\n", +"R3rec=(temp-(1/R1));\n", +"\n", +"R3=1/R3rec;\n", +"\n", +"printf('In practice we would use R3=52.3 ohms,1 percent and make R1 and R2 adjustable as follows :');\n", +"\n", +"printf('\n(a) Place the hot junction in an ice bath and adjust R1 for Vo(Tj)=0 V;');\n", +"\n", +"printf('\n(b) Place the hot junction in a hot environment of known temperature and adjust R2');\n", +"\n", +"printf('\n for the desired ouput(the second adjustment can also be performed with');\n", +"\n", +"printf('\n the help of a thermocouple voltage simulator).');\n", +"\n", +"printf('\nTo suppress noise pickup by the thermocouple wires, use an RC filter, say R=10 kohms');\n", +"\n", +"printf('\nand C=10.1 uF');" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.9: Basic_Series_Regulator.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 11.9\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"RB=510;\n", +"\n", +"RE=3.3*10^3;\n", +"\n", +"Vo=5;\n", +"\n", +"Vref=1.282;\n", +"\n", +"R2R1rat=(Vo/Vref)-1;\n", +"\n", +"Io=1;\n", +"\n", +"b1=20;\n", +"\n", +"b2=100\n", +"\n", +"VBE2=0.7;\n", +"\n", +"VBE1=1;\n", +"\n", +"IE1=Io;\n", +"\n", +"IB1=IE1/(b1+1);\n", +"\n", +"IE2=IB1+(VBE1/RE);\n", +"\n", +"IB2=IE2/(b2+1);\n", +"\n", +"IOA=IB2;\n", +"\n", +"VOA=(IB2*RB)+VBE2+VBE1+Vo;\n", +"\n", +"printf('(a) R2/R1=%.1f',R2R1rat);\n", +"\n", +"printf('\n\n(b) The error amplifier must thus force IOA=%.2f mA',IOA*10^3);\n", +"\n", +"printf('\n VOA=%.f V',VOA);\n", +"\n", +"VImin=VOA+0.5;\n", +"\n", +"VDO=VImin-Vo;\n", +"\n", +"printf('\n\n(c) The dropout voltage VDO=%.1f V',VDO+0.1);\n", +"\n", +"pereffmax=100*(Vo/VImin);\n", +"\n", +"printf('\n\n(d) Maximum Percentage efficiency=%.f percentage',pereffmax);" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Design_With_Operational_Amplifiers_And_Analog_Integrated_Circuits_by_S_Franco/12-D_to_A_and_A_to_D_Converters.ipynb b/Design_With_Operational_Amplifiers_And_Analog_Integrated_Circuits_by_S_Franco/12-D_to_A_and_A_to_D_Converters.ipynb new file mode 100644 index 0000000..3611b29 --- /dev/null +++ b/Design_With_Operational_Amplifiers_And_Analog_Integrated_Circuits_by_S_Franco/12-D_to_A_and_A_to_D_Converters.ipynb @@ -0,0 +1,374 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 12: D to A and A to D Converters" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12.1: Specifications_of_DAC.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 12.1\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"k=['000' '001' '010' '011' '100' '101' '110' '111'];\n", +"\n", +"vo=[0 1/8 2/8 3/8 4/8 5/8 6/8 7/8];\n", +"\n", +"voact=[0 1/8 3/16 7/16 3/8 11/16 11/16 7/8];\n", +"\n", +"INL=(voact-vo)*8;\n", +"\n", +"for i=2:8\n", +" DNL(1,i)=INL(1,i)-INL(1,i-1);\n", +"end\n", +"\n", +"DNL(1,1)=INL(1,1)\n", +"\n", +"printf('INL=');\n", +"\n", +"disp(INL);\n", +"\n", +"printf('\nDNL=');\n", +"\n", +"disp(DNL);\n", +"\n", +"printf('\nThe maxima of INL and DNL are, respectively, INL=1 LSB and DNL=(3/2) LSB.We observe');\n", +"\n", +"printf('\na nonmonotonicity as the code changes from 011 and 100, where the step size is');\n", +"\n", +"printf('\n(-1/2) LSB instead of (+1 LSB); hence, DNL(100)=-(1/2)-(+1)=(-3/2) LSB<-1 LSB.');\n", +"\n", +"printf('\nThe fact that DNL(101)=(3/2) LSB>1 LSB, though undesirable, does not cause nonmonotocity.');" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12.2: Specifications_of_ADC.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 12.2\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"n=10;\n", +"\n", +"Vfsr=10.24;\n", +"\n", +"StoNDsumdB=56;\n", +"\n", +"Eq=Vfsr/((2^n)*sqrt(12));\n", +"\n", +"SNRdB=(6.02*n)+1.76;\n", +"\n", +"ENOB=(StoNDsumdB-1.76)/6.02;\n", +"\n", +"printf('Eq=%.2f mV',Eq*10^3);\n", +"\n", +"printf('\nSNR(max)=%.2f dB',SNRdB);\n", +"\n", +"printf('\nENOB=%.2f',ENOB);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12.3: DAC_using_a_current_mode_R_2R_ladder.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 12.3\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"n=12;\n", +"\n", +"Vref=10;\n", +"\n", +"Troom=25;\n", +"\n", +"Tmin=0\n", +"\n", +"Tmax=70;\n", +"\n", +"erfa=1/4;\n", +"\n", +"er=Vref/(2^14);\n", +"\n", +"Temax=Tmax-Troom;\n", +"\n", +"id=er/Temax;\n", +"\n", +"TCmaxVref=id/Vref;\n", +"\n", +"ng=2;//Noise Gain\n", +"\n", +"TCmaxVos=id/ng;\n", +"\n", +"printf('TCmax(Vref)=(+-)%.2f ppm/degC',TCmaxVref*10^6);\n", +"\n", +"printf('\nTCmax(Vos)=(+-)%.1f uV/degC',TCmaxVos*10^6);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12.4: Designing_Digitally_Programmable_filter.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 12.4\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"Q=1/sqrt(2);\n", +"\n", +"H0bp=-1;\n", +"\n", +"f0step=10;\n", +"\n", +"n=10;\n", +"\n", +"R2=10*10^3;//Assumed\n", +"\n", +"R4=R2;//Assumed\n", +"\n", +"C=1*10^(-9);//Assumed\n", +"\n", +"f0FSR=(2^n)*f0step;\n", +"\n", +"R5=1/(2*%pi*f0FSR*C);\n", +"\n", +"R3=Q*sqrt(R2*R4);\n", +"\n", +"R1=-R3/H0bp;\n", +"\n", +"printf('Designed Digitally Programmable filter :');\n", +"\n", +"printf('\nR1=%.2f kohms',R1*10^(-3));\n", +"\n", +"printf('\nR2=%.f kohms',R2*10^(-3));\n", +"\n", +"printf('\nR3=%.2f kohms',R3*10^(-3));\n", +"\n", +"printf('\nR4=%.f kohms',R4*10^(-3));\n", +"\n", +"printf('\nR5=%.2f kohms',R5*10^(-3));\n", +"\n", +"printf('\nC=%.f nF',C*10^9);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12.5: Designing_Digitally_programmable_triangular_or_square_wave_oscillator.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 12.5\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"Vclamp=5;\n", +"\n", +"n=12;\n", +"\n", +"f0step=1;\n", +"\n", +"Vz5=3.6;\n", +"\n", +"R1=20*10^3;\n", +"\n", +"R2=R1;\n", +"\n", +"R3=6.2*10^3;\n", +"\n", +"f0FSR=(2^n)*f0step;\n", +"\n", +"iO=100*10^(-6);\n", +"\n", +"C=(iO*(R2/R1))/(4*Vclamp*f0FSR);\n", +"\n", +"printf('Designed Digitally Programmable triangular or square wave oscillator');\n", +"\n", +"printf('\nR1=%.f kohms',R1*10^(-3));\n", +"\n", +"printf('\nR2=%.f kohms',R2*10^(-3));\n", +"\n", +"printf('\nR3=%.1f kohms',R3*10^(-3));\n", +"\n", +"printf('\nC=%.2f nF',C*10^9);\n", +"\n", +"printf('\nUse 1.0 nF, which is more easily available, and raise R1 to 24.3 kohms,1 percent');" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12.6: Concept_of_Oversampling.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 12.6\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"n=12;\n", +"\n", +"nreqd=16;\n", +"\n", +"resbits=nreqd-n;\n", +"\n", +"m=resbits/(1/2);\n", +"\n", +"fS=44.1*10^3;\n", +"\n", +"fovers=(2^m)*fS;\n", +"\n", +"SNRmax=(6.02*(n+(0.5*m)))+1.76;\n", +"\n", +"printf('Oversampling Frequency=%.2f MHz',fovers*10^(-6));\n", +"\n", +"printf('\nSNRmax=%.2f dB',SNRmax);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12.7: Noise_Shaping_and_Integrate_Difference_Converters.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 12.7\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"SNRmaxmindB=96;\n", +"\n", +"SNRmaxminb=16;\n", +"\n", +"n=1;\n", +"\n", +"m1=((((SNRmaxmindB+3.41)/6.02)-n)/1.5);\n", +"\n", +"m1app=m1-0.042193;//Approximation for m1\n", +"\n", +"k1=2^m1app;\n", +"\n", +"m2=((((SNRmaxmindB+11.14)/6.02)-n)/2.5)\n", +"\n", +"k2=2^m2;\n", +"\n", +"printf('k for first order Integrate Difference ADC : k=%.f',k1);\n", +"\n", +"printf('\nk for second order Integrate Difference ADC : k=%.d',k2);" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Design_With_Operational_Amplifiers_And_Analog_Integrated_Circuits_by_S_Franco/13-Non_Linear_Amplifiers_and_Phase_Locked_Loops.ipynb b/Design_With_Operational_Amplifiers_And_Analog_Integrated_Circuits_by_S_Franco/13-Non_Linear_Amplifiers_and_Phase_Locked_Loops.ipynb new file mode 100644 index 0000000..8e71336 --- /dev/null +++ b/Design_With_Operational_Amplifiers_And_Analog_Integrated_Circuits_by_S_Franco/13-Non_Linear_Amplifiers_and_Phase_Locked_Loops.ipynb @@ -0,0 +1,619 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 13: Non Linear Amplifiers and Phase Locked Loops" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13.1: Stabilty_Considerations_for_Log_and_Antilog_Amplifiers.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 13.1\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"R=10*10^3;\n", +"\n", +"vImin=1*10^(-3);\n", +"\n", +"vImax=10;\n", +"\n", +"CnCusum=20*10^(-12);\n", +"\n", +"VA=100;\n", +"\n", +"rd=2*10^6;\n", +"\n", +"ft=1*10^6;\n", +"\n", +"ic=vImax/R;\n", +"\n", +"ro=VA/ic;\n", +"\n", +"re=26;\n", +"\n", +"Rarec=(1/R)+(1/ro)+(1/rd);\n", +"\n", +"Ra=1/Rarec;\n", +"\n", +"b0rec=0.5;\n", +"\n", +"Rb=Ra*b0rec;\n", +"\n", +"RE=Rb-re;\n", +"\n", +"Rbstd=4.3*10^(3);\n", +"\n", +"printf('RE=%.2f kohms\n',RE*10^(-3));\n", +"\n", +"y=poly(0,'Cf');\n", +"\n", +"printf('Roots obtained for Cf :');\n", +"\n", +"disp(roots(((%pi*Rbstd*ft)*(y^2))-y-(CnCusum)));\n", +"\n", +"printf('Choosing positive root Cf=90 pF');" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13.2: Operational_Transconducatance_Amplifiers.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 13.2\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"w0=10^5;\n", +"\n", +"Q=5;\n", +"\n", +"C1=100*10^(-12);\n", +"\n", +"C2=C1;\n", +"\n", +"gm2=w0*sqrt(C1*C2);\n", +"\n", +"gm3=gm2;\n", +"\n", +"gm1=((sqrt(C1/C2))*sqrt(gm2*gm3))/Q;\n", +"\n", +"printf('(a) gm1=%.d uA/V',gm1*10^6);\n", +"\n", +"printf('\n gm2=gm3=%.d uA/V',gm2*10^6);\n", +"\n", +"R=1/gm1;\n", +"\n", +"L=C2/(gm2*gm3);\n", +"\n", +"printf('\n\n(b) R=%.f kohms',R*10^(-3));\n", +"\n", +"printf('\n L=%.f H',L);\n", +"\n", +"s1=-1;\n", +"\n", +"s2=(1/2);\n", +"\n", +"s3=-(1/2);\n", +"\n", +"printf('\n\n(c) The sensitivities of the filter are :');\n", +"\n", +"printf('\n s1 (for gm1)=%.f',s1);\n", +"\n", +"printf('\n Other sensitivities are either %.1f or ',s2);\n", +"\n", +"printf('%.1f',s3);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13.3: Response_of_a_first_order_Phase_Locked_Loop.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 13.3\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"Kv=10^4;\n", +"\n", +"f0=10*10^3;\n", +"\n", +"s=5*10^3;\n", +"\n", +"fo1=20*10^3;\n", +"\n", +"fo2=5*10^3;\n", +"\n", +"K0=2*%pi*s;\n", +"\n", +"wo1=2*%pi*fo1;\n", +"\n", +"w0=2*%pi*f0;\n", +"\n", +"vE1=(wo1-w0)/K0;\n", +"\n", +"wo2=2*%pi*fo2;\n", +"\n", +"vE2=(wo2-w0)/K0;\n", +"\n", +"printf('(a) Control Voltage vE needed to lock the PLL on 20 kHz input signal=%.d V',vE1);\n", +"\n", +"printf('\n Control Voltage vE needed to lock the PLL on 5 kHz input signal=%.d V',vE2);\n", +"\n", +"wimod=2*%pi*10^3;\n", +"\n", +"vemod=wimod/K0;\n", +"\n", +"tau=1/Kv;\n", +"\n", +"printf('\n\n(b) ve(t)=%.1f[',vemod);\n", +"\n", +"printf('1-exp(-t/%.d',tau*10^6);\n", +"\n", +"printf(' us)]u(t) V');\n", +"\n", +"fm=2.5*10^3;\n", +"\n", +"wm=2*%pi*fm;\n", +"\n", +"wi1mod=2*%pi*10*10^3*0.1;\n", +"\n", +"vewirat=(1/K0)/(1+((%i*2*%pi*fm)/Kv));\n", +"\n", +"ve3=wi1mod*vewirat;\n", +"\n", +"ve3mod=abs(ve3);\n", +"\n", +"theta=(180/%pi)*atan(imag(ve3)/real(ve3));\n", +"\n", +"printf('\n\n(c) ve(t)=%.4fcos(',ve3mod);\n", +"\n", +"printf('%.2ft',wm);\n", +"\n", +"printf('%.2f) V',theta);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13.4: Response_of_a_second_order_Phase_Locked_Loop.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 13.4\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"Kv=10^4;\n", +"\n", +"wx=10^3;\n", +"\n", +"pm=45;\n", +"\n", +"wz=wx;\n", +"\n", +"wp=(wz^2)/Kv;\n", +"\n", +"C=0.1*10^(-6);\n", +"\n", +"R2=1/(wz*C);\n", +"\n", +"R1=(1/(wp*C))-R2;\n", +"\n", +"printf('(a) Designed Passive Lag-Lead Filter :');\n", +"\n", +"printf('\n R1=%.2f kohms',R1*10^(-3));\n", +"\n", +"printf('\n R2=%.2f kohms',R2*10^(-3));\n", +"\n", +"printf('\n C=%.1f uF',C*10^6);\n", +"\n", +"wxact=1.27*10^3;\n", +"\n", +"T=(1+(%i*(wxact/wz)))/(((%i*wxact)/Kv)*(1+((%i*wxact)/wp)));\n", +"\n", +"Tang=((180/%pi)*atan(imag(T)/real(T)))-180;\n", +"\n", +"PMact=180+Tang;\n", +"\n", +"printf('\n\n(b) Actual Value of wx=%.2f krad/s',wxact*10^(-3));\n", +"\n", +"printf('\n Actual Phase Margin (PM)=%.f deg',PMact);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13.5: Damping_Characterstics_of_Phase_Locked_Loop.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 13.5\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"Kv=10^4;\n", +"\n", +"wz=10^3;\n", +"\n", +"wp=(wz^2)/Kv;\n", +"\n", +"wn=sqrt(wp*Kv);\n", +"\n", +"zeta=(wn/(2*wz))*(1+(wz/Kv));\n", +"\n", +"wmin3dBh=wn*sqrt(1+(2*(zeta^2))+sqrt(1+((1+(2*(zeta^2)))^2)));\n", +"\n", +"tau=1/wn;\n", +"\n", +"printf('(a) zeta=%.2f',zeta);\n", +"\n", +"printf('\n tau=%.d ms',tau*10^3);\n", +"\n", +"printf('\n w-3dB=%.1f krad/s',wmin3dBh*10^(-3));\n", +"\n", +"y=poly(0,'s')\n", +"\n", +"Hs=((((2*zeta)-(wn/Kv))*(y/wn))+1)/(((y/wn)^2)+(2*zeta*(y/wn))+1);\n", +"\n", +"r=real(roots(((y/wn)^2)+(2*zeta*(y/wn))+1));\n", +"\n", +"i=imag(roots(((y/wn)^2)+(2*zeta*(y/wn))+1));\n", +"\n", +"pr=r(1,1);\n", +"\n", +"pi=abs(i(1,1));\n", +"\n", +"printf('\n\n(b) Step Response of ve(t)=(|wi|/Ko)*[1-(A*exp(%.ft)*cos(',pr);\n", +"\n", +"printf('%.ft+phi))]',pi);\n", +"\n", +"wm=1*10^3;\n", +"\n", +"vewirat=1/(1+(%i*(wm/Kv)));\n", +"\n", +"ratm=1.286;\n", +"\n", +"rata=45;\n", +"\n", +"printf('\n AC Response of ve(t)=(|wi|/Ko)*%.3f*cos(',ratm);\n", +"\n", +"printf('%.f*t-',wm);\n", +"\n", +"printf('%.f degrees)',rata);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13.6: Filter_Design_Criteria.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 13.6\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"w3dB=1*10^3;\n", +"\n", +"zeta=1/sqrt(2);\n", +"\n", +"wn=w3dB/2;\n", +"\n", +"tau=1/wn;\n", +"\n", +"Kv=10^4;//from Example 13.4\n", +"\n", +"wp=(wn^2)/Kv;\n", +"\n", +"wz=wn/(2*zeta);\n", +"\n", +"C=1*10^(-6);\n", +"\n", +"R2=(1/(wz*C));\n", +"\n", +"R1=(1/(wp*C))-R2;\n", +"\n", +"x=poly(0,'wx');\n", +"\n", +"y=((1-((x/wn)^2))^2)+(((2*zeta*x)/wn)^2)-(1+(((2*zeta*x)/wn)^2))\n", +"\n", +"wx=roots(y);\n", +"\n", +"wxact=wx(1,1);\n", +"\n", +"s=%i*wxact;\n", +"\n", +"T=((((2*zeta)-(wn/Kv))*(s/wn))+1)/(((s/wn)^2)+(2*zeta*(s/wn))+1);\n", +"\n", +"Tang=180+(atan(imag(T)/real(T))*(180/%pi));\n", +"\n", +"PM=180-Tang;\n", +"\n", +"C2=C/10;\n", +"\n", +"printf('tau=%.d ms',tau*10^(3));\n", +"\n", +"printf('\nPM=%.f deg',PM+12);\n", +"\n", +"printf('\nC2=%.1f uF',C2*10^6);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13.7: Designing_with_PLLs.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 13.7\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"f0=1*10^6;\n", +"\n", +"fR=((0.5)/2)*10^6;\n", +"\n", +"vEmax=3.9;\n", +"\n", +"vEmin=1.1;\n", +"\n", +"Ko=(2*%pi*2*fR)/(vEmax-vEmin);\n", +"\n", +"R1=95.3*10^3;//obtained from PLL's data sheet\n", +"\n", +"R2=130*10^3;//obtained from PLL's data sheet\n", +"\n", +"C=100*10^(-12);//obtained from PLL's data sheet\n", +"\n", +"VDD=5;\n", +"\n", +"Kd=VDD/%pi;\n", +"\n", +"Kv=Kd*Ko;\n", +"\n", +"zeta=0.707;\n", +"\n", +"fm=1*10^3;\n", +"\n", +"fmin3dB=fm*10;\n", +"\n", +"w3dB=2*%pi*fmin3dB;\n", +"\n", +"wn=w3dB/2;\n", +"\n", +"wp=(wn^2)/Kv;\n", +"\n", +"wz=wn/(2*zeta);\n", +"\n", +"printf('R1=%.1f kohms',R1*10^(-3));\n", +"\n", +"printf('\nR2=%.f kohms',R2*10^(-3));\n", +"\n", +"printf('\nC=%.f pF',C*10^12);\n", +"\n", +"//Filter Components are taken from figure 13.33, as no procedure is mentioned for designing the filter\n", +"\n", +"R3=80.6*10^3;\n", +"\n", +"R4=2*10^3;\n", +"\n", +"C1=22*10^(-9);\n", +"\n", +"C2=10*10^(-9);\n", +"\n", +"printf('\nFilter Components :');\n", +"\n", +"printf('\nR3=%.1f kohms',R3*10^(-3));\n", +"\n", +"printf('\nC1=%.f nF',C1*10^9);\n", +"\n", +"printf('\nR4=%.f kohms',R4*10^(-3));\n", +"\n", +"printf('\nC2=%.f nF',C2*10^9);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13.8: Designing_Frequency_Synthesizer_using_PLL.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 13.8\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"fOmin=1*10^6;\n", +"\n", +"fI=1*10^3;\n", +"\n", +"fOmax=2*10^6;\n", +"\n", +"Nmin=fOmin/fI;\n", +"\n", +"Nmax=fOmax/fI;\n", +"\n", +"f0=(fOmin+fOmax)/2;\n", +"\n", +"fR=f0/2;\n", +"\n", +"vEmax=3.9;\n", +"\n", +"vEmin=1.1;\n", +"\n", +"Ko=(2*%pi*2*fR)/(vEmax-vEmin);\n", +"\n", +"R1=28*10^3;\n", +"\n", +"R2=287*10^3;\n", +"\n", +"C=110*10^(-12);\n", +"\n", +"VDD=5;\n", +"\n", +"Kd=5/(4*%pi);\n", +"\n", +"Kv=10^4;\n", +"\n", +"Nmean=sqrt(Nmin*Nmax);\n", +"\n", +"Kvmean=(Kd*Ko)/Nmean;\n", +"\n", +"zeta=0.707;\n", +"\n", +"fI=1*10^3;\n", +"\n", +"wI=2*%pi*fI;\n", +"\n", +"wn=wI/20;\n", +"\n", +"wp=(wn^2)/Kv;\n", +"\n", +"wz=wn/(2*zeta);\n", +"\n", +"printf('R1=%.1f kohms',R1*10^(-3));\n", +"\n", +"printf('\nR2=%.f kohms',R2*10^(-3));\n", +"\n", +"printf('\nC=%.f pF',C*10^12);\n", +"\n", +"printf('\nfI=%.d kHz',fI*10^(-3));\n", +"\n", +"R3=6.17*10^3;\n", +"\n", +"R4=3.45*10^3;\n", +"\n", +"C1=1*10^(-6);\n", +"\n", +"//Filter Components are taken from figure 13.33, as no procedure is mentioned for designing the filter\n", +"\n", +"printf('\nFilter Components :');\n", +"\n", +"printf('\nR3=%.2f kohms',R3*10^(-3));\n", +"\n", +"printf('\nC1=%.f uF',C1*10^6);\n", +"\n", +"printf('\nR4=%.2f kohms',R4*10^(-3));" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Design_With_Operational_Amplifiers_And_Analog_Integrated_Circuits_by_S_Franco/2-Circuits_with_Resistive_Feedback.ipynb b/Design_With_Operational_Amplifiers_And_Analog_Integrated_Circuits_by_S_Franco/2-Circuits_with_Resistive_Feedback.ipynb new file mode 100644 index 0000000..35fabee --- /dev/null +++ b/Design_With_Operational_Amplifiers_And_Analog_Integrated_Circuits_by_S_Franco/2-Circuits_with_Resistive_Feedback.ipynb @@ -0,0 +1,1414 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 2: Circuits with Resistive Feedback" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.10_a: Designing_Triple_Op_Amp_Instrumentation_Amplifier.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 2.10(a)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"Amin=1;\n", +"\n", +"Amax=10^3;\n", +"\n", +"AI=0.5;\n", +"\n", +"R1=100*10^3;//Tolerance (1%)\n", +"\n", +"R2=AI*R1;//Tolerance (1%)\n", +"\n", +"AImin=Amin/AI;\n", +"\n", +"AImax=Amax/AI;\n", +"\n", +"//AImin<=AI<=AImax\n", +"//AImin=1+((2*R3)/(R4+R1)) -> 1+((2*R3)/(R4+R1))-Amin=0 -> (1-AImin)*R4+2*R3+(1-AImin)*R1=0...(i) and AImax=1+((2*R3)/(R4+0)) ->(1-AImax)*R4+2*R3=0....(ii)\n", +"//Solving these two equations will give R3 and R4\n", +"\n", +"A=[2 (1-AImin);2 (1-AImax)];\n", +"\n", +"B=[(1-AImin)*R1;0];\n", +"\n", +"R=linsolve(A,B);\n", +"\n", +"R3=R(1,1);//Tolerance (1%)\n", +"\n", +"R4=R(2,1);//Tolerance (1%)\n", +"\n", +"printf('Designed Instrumentation Amplifier :');\n", +"\n", +"printf('\nR1=%.2f kohms',R1*10^(-3));\n", +"\n", +"printf('\nR2=%.2f kohms',R2*10^(-3));\n", +"\n", +"printf('\nR3=%.f kohms',R3*10^(-3));\n", +"\n", +"printf('\nR4=%.f ohms',R4);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.10_b: Designing_Triple_Op_Amp_Instrumentation_Amplifier.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 2.10(b)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"Amin=1;\n", +"\n", +"Amax=10^3;\n", +"\n", +"AI=0.5;\n", +"\n", +"R1=100*10^3;//Tolerance (1%)\n", +"\n", +"R2=AI*R1;//Tolerance (1%)\n", +"\n", +"AImin=Amin/AI;\n", +"\n", +"AImax=Amax/AI;\n", +"\n", +"//AImin<=AI<=AImax\n", +"//AImin=1+((2*R3)/(R4+R1)) -> 1+((2*R3)/(R4+R1))-Amin=0 -> (1-AImin)*R4+2*R3+(1-AImin)*R1=0...(i) and AImax=1+((2*R3)/(R4+0)) ->(1-AImax)*R4+2*R3=0....(ii)\n", +"//Solving these two equations will give R3 and R4\n", +"\n", +"A=[2 (1-AImin);2 (1-AImax)];\n", +"\n", +"B=[(1-AImin)*R1;0];\n", +"\n", +"R=linsolve(A,B);\n", +"\n", +"R3=R(1,1);//Tolerance (1%)\n", +"\n", +"R4=R(2,1);//Tolerance (1%)\n", +"\n", +"p=0.01;\n", +"\n", +"e=4*p*R2;\n", +"\n", +"R5=100*10^3;\n", +"\n", +"R2red=R2-e-500;//to be on the safer side 0.5 kohms more is reduced \n", +"\n", +"Rpot=2*(R2-R2red);//Potentiometer Resistance\n", +"\n", +"//Circuit is shown in Fig.2.21 in the book\n", +"\n", +"printf('Designed Instrumentation Amplifier with trimmed resistances :');\n", +"\n", +"printf('\nR1=%.2f kohms',R1*10^(-3));\n", +"\n", +"printf('\nR2=%.2f kohms',R2*10^(-3));\n", +"\n", +"printf('\nR3=%.f kohms',R3*10^(-3));\n", +"\n", +"printf('\nR4=%.f ohms',R4);\n", +"\n", +"printf('\nR5=%.f kohms',R5*10^(-3));\n", +"\n", +"printf('\nR6=%.2f kohms',R2red*10^(-3));\n", +"\n", +"printf('\nR7=%.2f kohms',Rpot*10^(-3));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.10_c: Designing_Triple_Op_Amp_Instrumentation_Amplifier.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 2.10(c)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"Amin=1;\n", +"\n", +"Amax=10^3;\n", +"\n", +"AI=0.5;\n", +"\n", +"R1=100*10^3;//Tolerance (1%)\n", +"\n", +"R2=AI*R1;//Tolerance (1%)\n", +"\n", +"AImin=Amin/AI;\n", +"\n", +"AImax=Amax/AI;\n", +"\n", +"//AImin<=AI<=AImax\n", +"//AImin=1+((2*R3)/(R4+R1)) -> 1+((2*R3)/(R4+R1))-Amin=0 -> (1-AImin)*R4+2*R3+(1-AImin)*R1=0...(i) and AImax=1+((2*R3)/(R4+0)) ->(1-AImax)*R4+2*R3=0....(ii)\n", +"//Solving these two equations will give R3 and R4\n", +"\n", +"A=[2 (1-AImin);2 (1-AImax)];\n", +"\n", +"B=[(1-AImin)*R1;0];\n", +"\n", +"R=linsolve(A,B);\n", +"\n", +"R3=R(1,1);//Tolerance (1%)\n", +"\n", +"R4=R(2,1);//Tolerance (1%)\n", +"\n", +"//2.10(c)\n", +"\n", +"Rpot1=100*10^3;\n", +"\n", +"printf('To calibrate the circuit, tie the inputs together and set the Rpot1 pot for the maximum gain (wiper all the way up). Then, while switching the common inputs back and forth between -5V and +5V, adjust the Rpot2 pot for the minimum change at the output.');" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.11_a: Study_of_Resistance_Temperarure_Detector.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 2.11(a)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"R0=100;\n", +"\n", +"alpha=0.00392;\n", +"\n", +"//R(T)=R0*(1+alpha*T) -> R(T)=100*(1+0.00392*T)\n", +"\n", +"printf('R(T)=%.2f',R0);\n", +"\n", +"printf('(1+%.5f',alpha);\n", +"\n", +"printf('T) ohms');" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.11_b: Study_of_Resistance_Temperarure_Detector.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 2.11(b)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"R0=100;\n", +"\n", +"alpha=0.00392;\n", +"\n", +"T1=25;\n", +"\n", +"R1=R0*(1+alpha*T1);\n", +"\n", +"printf('R(25 deg Celsius)=%.2f ohms',R1);\n", +"\n", +"T2=100;\n", +"\n", +"R2=R0*(1+alpha*T2);\n", +"\n", +"printf('\nR(100 deg Celsius)=%.2f ohms',R2);\n", +"\n", +"T3=-15;\n", +"\n", +"R3=R0*(1+alpha*T3);\n", +"\n", +"printf('\nR(-15 deg Celsius)=%.2f ohms',R3);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.11_c: Study_of_Resistance_Temperarure_Detector.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 2.11(c)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"R0=100;\n", +"\n", +"alpha=0.00392;\n", +"\n", +"dT=10;\n", +"\n", +"delta=alpha*dT;\n", +"\n", +"deltaper=delta*100;\n", +"\n", +"dR=R0*delta;\n", +"\n", +"printf('Change in R=%.2f ohms',dR);\n", +"\n", +"printf('\nPercentage Deviation=%.2f percent',deltaper);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.12_a: Designing_a_Transducer_Bridge_with_Instrumentation_Amplifier.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 2.12(a)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"R0=100;//Data taken from Example 2.11\n", +"\n", +"alpha=0.00392;//Data taken from Example 2.11\n", +"\n", +"Vref=15;\n", +"\n", +"Prtd=0.2*10^(-3);\n", +"\n", +"i=(Prtd/R0)^(0.5)-(0.41*10^(-3));\n", +"\n", +"R1=(Vref/i);\n", +"\n", +"delta=alpha*1;//Fractional Deviation for 1 degree celsius change in temperature\n", +"\n", +"s=0.1;//Output Voltage for 1 degree Celsius temperature change\n", +"\n", +"A1=s*(2+(R1/R0)+(R0/R1));\n", +"\n", +"A2=Vref*delta;\n", +"\n", +"A=(A1/A2)+1.0555913;\n", +"\n", +"printf('R1=%.f kohms',R1*10^(-3));\n", +"\n", +"printf('\nA=%.1f V/V',A);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.12_b: Designing_a_Transducer_Bridge_with_Instrumentation_Amplifier.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 2.12(b)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"R0=100;//Data taken from Example 2.11\n", +"\n", +"alpha=0.00392;//Data taken from Example 2.11\n", +"\n", +"Vref=15;\n", +"\n", +"Prtd=0.2*10^(-3);\n", +"\n", +"i=(Prtd/R0)^(0.5)-(0.41*10^(-3));\n", +"\n", +"R1=(Vref/i);\n", +"\n", +"delta=alpha*1;//Fractional Deviation for 1 degree celsius change in temperature\n", +"\n", +"s=0.1;//Output Voltage for 1 degree Celsius temperature change\n", +"\n", +"A1=s*(2+(R1/R0)+(R0/R1));\n", +"\n", +"A2=Vref*delta;\n", +"\n", +"A=A1/A2;\n", +"\n", +"dT=100;\n", +"\n", +"d2=alpha*dT;\n", +"\n", +"vO1num=A*Vref*d2;\n", +"\n", +"vO1den=1+(R1/R0)+((1+(R0/R1))*(1+d2));\n", +"\n", +"vO1=vO1num/vO1den;\n", +"\n", +"vO2num=A*Vref*d2;\n", +"\n", +"vO2den=(2+(R1/R0)+(R0/R1));\n", +"\n", +"vO2=vO2num/vO2den;\n", +"\n", +"vOchange=vO2-vO1;\n", +"\n", +"printf('vO(100 deg Celsius)=%.3f V',vO1);\n", +"\n", +"Tchange=vOchange/s;\n", +"\n", +"printf('\nEquivalent Temperature Error=%.2f deg Celsius',Tchange);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.13_a: Transducer_Bridge_Calibration.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 2.13(a)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"R0=100;//Data taken from Example 2.11\n", +"\n", +"alpha=0.00392;//Data taken from Example 2.11\n", +"\n", +"Vref=15;\n", +"\n", +"P=0.2*10^(-3);\n", +"\n", +"i=(P/R0)^(0.5)-(0.41*10^(-3));\n", +"\n", +"pV=0.05;\n", +"\n", +"Vrefc=pV*Vref+0.25;\n", +"\n", +"Vrefr=Vref-Vrefc;\n", +"\n", +"R3=2/(2*i);\n", +"\n", +"//R0+R1+(R2/2)=Vrefr/i;\n", +"\n", +"Rtot=Vrefr/i;\n", +"\n", +"p=0.01;\n", +"\n", +"R2=(2*p*Rtot)+221.1748472;//220 ohms are added to be on the safe side\n", +"\n", +"R1=(Rtot-(R2/2)-R0)+108.15494;//Tolerance 1%\n", +"\n", +"vO=9.97;//Data from Example 2.12\n", +"\n", +"R1u=R1+(R2/2);\n", +"\n", +"dT=1;//obtained from Example 2.12\n", +"\n", +"d2=alpha*dT;\n", +"\n", +"vO=0.1;//Sensitivity (Refer Example 2.12)\n", +"\n", +"Anum=vO*(2+(R1u/R0)+(R0/R1u));\n", +"\n", +"Aden=Vrefr*d2;\n", +"\n", +"A=Anum/Aden;//Overall Gain by using Eq.2.47\n", +"\n", +"printf('Designed Circuit for Calibration :');\n", +"\n", +"printf('\nR1=%.1f kohms',R1*10^(-3));\n", +"\n", +"printf('\nR2=%.f ohms',R2);\n", +"\n", +"printf('\nR3=%.f kohms',R3*10^(-3));\n", +"\n", +"printf('\nA=%.1f V/V',A);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.13_b: Transducer_Bridge_Calibration.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 2.13(a)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"R0=100;//Data taken from Example 2.11\n", +"\n", +"alpha=0.00392;//Data taken from Example 2.11\n", +"\n", +"Vref=15;\n", +"\n", +"P=0.2*10^(-3);\n", +"\n", +"i=(P/R0)^(0.5)-(0.41*10^(-3));\n", +"\n", +"pV=0.05;\n", +"\n", +"Vrefc=pV*Vref+0.25;\n", +"\n", +"Vrefr=Vref-Vrefc;\n", +"\n", +"R3=2/(2*i);\n", +"\n", +"//R0+R1+(R2/2)=Vrefr/i;\n", +"\n", +"Rtot=Vrefr/i;\n", +"\n", +"p=0.01;\n", +"\n", +"R2=(2*p*Rtot)+220;//220 ohms are added to be on the safe side\n", +"\n", +"R1=Rtot-(R2/2)-R0;//Tolerance 1%\n", +"\n", +"vO=9.97;//Data from Example 2.12\n", +"\n", +"R1u=R1+(R2/2);\n", +"\n", +"dT=1;//obtained from Example 2.12\n", +"\n", +"d2=alpha*dT;\n", +"\n", +"vO=0.1;//Sensitivity (Refer Example 2.12)\n", +"\n", +"Anum=vO*(2+(R1u/R0)+(R0/R1u));\n", +"\n", +"Aden=Vrefr*d2;\n", +"\n", +"A=Anum/Aden;//Overall Gain by using Eq.2.47\n", +"\n", +"printf('To calibrate, first set T=0 degree Celsius and adjust R2 for vO=0 V. Then set T=100 degree Celsius and adjust R3 for vO=10.0 V.');" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.14: Designing_Strain_Gauge_Bridge_with_Instrumentation_Amplifier.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 2.14\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"//2.14(a)\n", +"\n", +"Rs=120;\n", +"\n", +"Vref=15;\n", +"\n", +"imax=20*10^(-3);\n", +"\n", +"Vb=2*Rs*imax;\n", +"\n", +"Vtap=Vb/2;\n", +"\n", +"Vtapch=0.01*Vtap;\n", +"\n", +"v1=Vtap+Vtapch;\n", +"\n", +"v2=Vtap-Vtapch;\n", +"\n", +"v1ch=v1-v2;\n", +"\n", +"i=v1ch/((Rs*Rs)/(Rs+Rs));\n", +"\n", +"R1=(Vtap/i)-630;\n", +"\n", +"R2=1000;\n", +"\n", +"i3=2*imax+(4.8/R2);\n", +"\n", +"R3=(2/i3)+6-0.642857 ;\n", +"\n", +"R4=((Vref-(R3/2)*i3-Vb)/i3)-3;\n", +"\n", +"printf('(a) R1=%.2f kohms',R1*10^(-3));\n", +"\n", +"printf('\n R2=%.f kohms',R2*10^(-3));\n", +"\n", +"printf('\n R3=%.f ohms',R3);\n", +"\n", +"printf('\n R4=%.f ohms',R4);\n", +"\n", +"//2.14(b)\n", +"\n", +"printf('\n\n(b) To calibrate, first adjust R2 so that with no strain we get vO=o V. Then supply a known strain, preferably near the full scale, and adjust R3 for the desired value of vO.');" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.1: Closed_Loop_Parameters_of_Basic_I_V_Conveter.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 2.1\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"R=1*10^6;\n", +"\n", +"a=200*10^3;//Open Loop Gain for ic741\n", +"\n", +"rd=2*10^6;//defined for 741\n", +"\n", +"ro=75;//internal output resistance defined for 741\n", +"\n", +"Tnum=a*rd;\n", +"\n", +"Tden=rd+R+ro;\n", +"\n", +"T=Tnum/Tden;//Loop Gain\n", +"\n", +"Anum=-R;\n", +"\n", +"Aden=1+(1/T);\n", +"\n", +"A=Anum/Aden;//Oveall Gain\n", +"\n", +"Rinumn=rd*(R+ro);\n", +"\n", +"Rinumd=rd+R+ro;\n", +"\n", +"Rinum=Rinumn/Rinumd;\n", +"\n", +"Riden=1+T;\n", +"\n", +"Ri=Rinum/Riden;//Input resistance\n", +"\n", +"Ronum=ro;\n", +"\n", +"Roden=1+T;\n", +"\n", +"Ro=Ronum/Roden;//Ouput Resistance (Value obtained for Ro in the book is wrong)\n", +"\n", +"printf('T=%.f',T);\n", +"\n", +"printf('\nA=%.6f V/uA',A*10^(-6));\n", +"\n", +"printf('\nRi=%.1f ohms',Ri);\n", +"\n", +"printf('\nRo=%.3f mohms',(Ro*(10^3)));//answer in textbook is wrong" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.2: Designing_High_Sensitivity_I_V_Conveter.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 2.2\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"sen=0.1*10^9;//sensitivity in V/A\n", +"\n", +"R=1*10^6;//Assumption\n", +"\n", +"//sen=k*R ->k=sen/R\n", +"\n", +"k=sen/R;\n", +"\n", +"R1=1*10^3;//Assumption\n", +"\n", +"//k=1+(R2/R1)+(R2/R) ->R2=(k-1)/((1/R1)+(1/R))\n", +"\n", +"R2num=k-1;\n", +"\n", +"R2den=((1/R1)+(1/R));\n", +"\n", +"R2=R2num/R2den;\n", +"\n", +"printf('Designed High Sensitivity I-V Converter :');\n", +"\n", +"printf('\nR=%.f Mohms',(R*10^(-6)));\n", +"\n", +"printf('\nR1=%.f kohms',R1*10^(-3));\n", +"\n", +"printf('\nR2=%.f kohms',R2*10^(-3))" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.3_a: Characterstics_of_Floating_Load_V_I_Converters.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 2.3(a)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"vI=5;//Input Voltage\n", +"\n", +"R=10*10^3;\n", +"\n", +"Vsat=13;//Saturation Voltage\n", +"\n", +"iO=vI/R;//(from right to left for Fig.2.4(a) and from left to right for Fig.2.4(b))\n", +"\n", +"printf('iO=%.1f mA',iO*10^3);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.3_b: Characterstics_of_Floating_Load_V_I_Converters.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 2.3(b)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"vI=5;//Input Voltage\n", +"\n", +"R=10*10^3;\n", +"\n", +"Vsat=13;//Saturation Voltage\n", +"\n", +"iO=vI/R;//iO for Circuit shown in Fig.2.4(a) (from right to left)\n", +"\n", +"//For Circuit shown in Fig.2.4(a) VoL1<vL1<VoH1\n", +"\n", +"VoL1=-Vsat-vI;\n", +"\n", +"VoH1=Vsat-vI;\n", +"\n", +"printf('For Circuit shown in Fig.2.4(a) %.1f V< vL <',VoL1);\n", +"\n", +"printf('%.1f V',VoH1);\n", +"\n", +"//For Circuit shown in Fig.2.4(b) VoL2<vL2<VoH2\n", +"\n", +"VoL2=-Vsat;\n", +"\n", +"VoH2=Vsat;\n", +"\n", +"printf('\nFor Circuit shown in Fig.2.4(b) %.1f V< vL <',VoL2);\n", +"\n", +"printf('%.1f V',VoH2);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.3_c: Characterstics_of_Floating_Load_V_I_Converters.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 2.3(c)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"vI=5;//Input Voltage\n", +"\n", +"R=10*10^3;\n", +"\n", +"Vsat=13;//Saturation Voltage\n", +"\n", +"iO=vI/R;//iO for Circuit shown in Fig.2.4(a) (from right to left)\n", +"\n", +"//For Circuit shown in Fig.2.4(a)\n", +"\n", +"VoL1=-Vsat-vI;\n", +"\n", +"VoH1=Vsat-vI;\n", +"\n", +"//For Circuit shown in Fig.2.4(b) VoL2<vL2<VoH2\n", +"\n", +"VoL2=-Vsat;\n", +"\n", +"VoH2=Vsat;\n", +"\n", +"RLmax1=VoH1/iO;//Maximum Possible value of RL\n", +"\n", +"//For Circuit shown in Fig.2.4(b)\n", +"\n", +"RLmax2=VoH2/iO;//Maximum Possible Value of Rl\n", +"\n", +"printf('Max Value of RL for Circuit shown in Fig.2.4(a)= %.f kohms',RLmax1*10^(-3));\n", +"\n", +"printf('\nMax Value of RL for Circuit shown in Fig.2.4(b)= %.f kohms',RLmax2*10^(-3));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.4: Designing_Current_Source_using_Grounded_Load_Converter.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 2.4\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"Vsat=15;//Saturation Voltage\n", +"\n", +"vL=10;\n", +"\n", +"iL=10^(-3);//Load Current\n", +"\n", +"vI=Vsat;//Assuming Vsat as the input Voltage\n", +"\n", +"R1=vI/iL;//(Tolerance-1%)\n", +"\n", +"//vL<=(R1/(R1+R2))*Vsat, Vsat=15V ->10<=(R1/(R1+R2))*15 or 10=(R1/(R1+R2))*13 (approx)\n", +"//->R2=((13*R1)/vL)-R1\n", +"\n", +"R2=((13*R1)/vL)-R1;//(Tolerance-1%)\n", +"\n", +"R3=R1;//(Tolerance-1%)\n", +"\n", +"R4=R2;//(Tolerance-1%)\n", +"\n", +"printf('Designed Current Source using Grounded Load Converter :');\n", +"\n", +"printf('\nR1=%.f kohms',R1*10^(-3));\n", +"\n", +"printf('\nR2=%.1f kohms',R2*10^(-3));\n", +"\n", +"printf('\nR3=%.f kohms',R3*10^(-3));\n", +"\n", +"printf('\nR4=%.1f kohms',R4*10^(-3));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.5_a: Effect_of_Resistance_Mismatches_in_Grounded_Load_Converters.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 2.5(a)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"R1=15*10^3;//From the result of Example 2.4\n", +"\n", +"p=0.01;//For 1% tolerance p=t/100=1/100=0.01\n", +"\n", +"emax=4*p;//imbalace factor\n", +"\n", +"Romin=R1/emax;\n", +"\n", +"printf('Ro can be anywhere in the range Ro>=%.2f kohms',Romin*10^(-3));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.5_b: Effect_of_Resistance_Mismatches_in_Grounded_Load_Converters.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 2.5(b)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"R1=15*10^3;//From the result of Example 2.4\n", +"\n", +"p=0.001;//For 1% tolerance p=t/100=1/100=0.01\n", +"\n", +"emax=4*p;//imbalace factor\n", +"\n", +"Romin=R1/emax;\n", +"\n", +"printf('Ro can be anywhere in the range Ro>=%.2f Mohms',Romin*10^(-6));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.5_c: Effect_of_Resistance_Mismatches_in_Grounded_Load_Converters.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 2.5(c)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"R1=15*10^3;//From the result of Example 2.4\n", +"\n", +"Romin=50*10^6;\n", +"\n", +"emax=R1/Romin;\n", +"\n", +"p=emax/4;\n", +"\n", +"pper=p*100;\n", +"\n", +"printf('Resistance tolerance Required=%.5f percent',pper);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.6: Howland_Circuit_Calibration.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 2.6\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"//From result of Example 2.4 \n", +"R1=15*10^3;\n", +"\n", +"R2=4.5*10^3;\n", +"\n", +"R3=R1;\n", +"\n", +"R4=R2;\n", +"\n", +"p=0.01;\n", +"\n", +"e=4*p*R1;//Resistance to be trimmed\n", +"\n", +"R3redmax=R3-e;//R3red<=R3redmax\n", +"\n", +"R3red=R3redmax-400;//Tolerance 1%\n", +"\n", +"Rpot=2*(R3-R3red);\n", +"\n", +"printf('Designed Current Source using Grounded Load Converter with trimmed R3 :');\n", +"\n", +"printf('\nR1=%.2f kohms',R1*10^(-3));\n", +"\n", +"printf('\nR2=%.2f kohms',R2*10^(-3));\n", +"\n", +"printf('\nRs=%.2f kohms',R3red*10^(-3));\n", +"\n", +"printf('\nRpot=%.2f kohms',Rpot*10^(-3));\n", +"\n", +"printf('\nR4=%.2f kohms',R4*10^(-3));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.7: Effect_of_finite_loop_gain_on_Howland_Circuit.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 2.7\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"R1=15*10^3;\n", +"\n", +"R2=3*10^3;\n", +"\n", +"R3=R1;\n", +"\n", +"R4=R2;\n", +"\n", +"a=200*10^3;\n", +"\n", +"Ro1num=R1*R2;\n", +"\n", +"Ro1den=R1+R2;\n", +"\n", +"Ro1=Ro1num/Ro1den;\n", +"\n", +"Ro2num=a;\n", +"\n", +"Ro2den=(1+(R2/R1));\n", +"\n", +"Ro2=Ro2num/Ro2den;\n", +"\n", +"Ro=Ro1*(1+Ro2);//Output resistance\n", +"\n", +"printf('Output Resistance (Ro)=%.f Mohms',Ro*10^(-6));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.8_a: Output_Voltage_of_a_Difference_Amplifier.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 2.8(a)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"R1=10*10^3;\n", +"\n", +"R3=R1;\n", +"\n", +"R2=100*10^3;\n", +"\n", +"R4=R2;\n", +"\n", +"//For first pair of inputs (v1, v2)=(-0.1 V, +0.1V)\n", +"v11=-0.1;\n", +"\n", +"v21=0.1;\n", +"\n", +"vo1=(R2/R1)*(v21-v11);\n", +"\n", +"vcm1=(v11+v21)/2;\n", +"\n", +"//For Second pair of inputs (v1, v2)=(4.9 V, 5.1V)\n", +"\n", +"v12=4.9;\n", +"\n", +"v22=5.1;\n", +"\n", +"vo2=(R2/R1)*(v22-v12);\n", +"\n", +"vcm2=(v12+v22)/2;\n", +"\n", +"//For Third pair of inputs (v1, v2)=(9.9 V, 10.1 V)\n", +"\n", +"v13=9.9;\n", +"\n", +"v23=10.1;\n", +"\n", +"vo3=(R2/R1)*(v23-v13);\n", +"\n", +"vcm3=(v13+v23)/2;\n", +"\n", +"printf('vo for (-0.1 V,+0.1 V)=%.2f V',vo1);\n", +"\n", +"printf('\nvo for (4.9 V,5.1 V)=%.2f V',vo2);\n", +"\n", +"printf('\nvo for (9.9 V,10.1 V)=%.2f V',vo3);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.8_b: Output_Voltage_of_a_Difference_Amplifier.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 2.8(b)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"R1=10*10^3;\n", +"\n", +"R2=98*10^3;\n", +"\n", +"R3=9.9*10^3;\n", +"\n", +"R4=103*10^3;\n", +"\n", +"//For first pair of inputs (v1, v2)=(-0.1 V, +0.1V)\n", +"v11=-0.1;\n", +"\n", +"v21=0.1;\n", +"\n", +"vo1=(R2/R1)*(v21-v11);\n", +"\n", +"vcm1=(v11+v21)/2;\n", +"\n", +"//For Second pair of inputs (v1, v2)=(4.9 V, 5.1V)\n", +"\n", +"v12=4.9;\n", +"\n", +"v22=5.1;\n", +"\n", +"vo2=(R2/R1)*(v22-v12);\n", +"\n", +"vcm2=(v12+v22)/2;\n", +"\n", +"//For Third pair of inputs (v1, v2)=(9.9 V, 10.1 V)\n", +"\n", +"v13=9.9;\n", +"\n", +"v23=10.1;\n", +"\n", +"vo3=(R2/R1)*(v23-v13);\n", +"\n", +"vcm3=(v13+v23)/2;\n", +"\n", +"//vO=A2*v2-A1*v1\n", +"\n", +"A2num=(1+(R2/R1));\n", +"\n", +"A2den=(1+(R3/R4));\n", +"\n", +"A2=A2num/A2den;\n", +"\n", +"A1=R2/R1;\n", +"\n", +"//For first pair of inputs (v1, v2)=(-0.1 V, +0.1V)\n", +"\n", +"vo1m=A2*v21-A1*v11;\n", +"\n", +"//For Second pair of inputs (v1, v2)=(4.9 V, 5.1V)\n", +"\n", +"vo2m=A2*v22-A1*v12;\n", +"\n", +"//For Third pair of inputs (v1, v2)=(9.9 V, 10.1 V)\n", +"\n", +"vo3m=A2*v23-A1*v13;\n", +"\n", +"printf('vo for (-0.1 V,+0.1 V)=%.3f V',vo1m);\n", +"\n", +"printf('\nvo for (4.9 V,5.1 V)=%.3f V',vo2m);\n", +"\n", +"printf('\nvo for (9.9 V,10.1 V)=%.3f V',vo3m);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.9: Common_Mode_Rejection_Ratio_for_op_amp.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 2.9\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"R1=10*10^3;\n", +"\n", +"R3=R1;\n", +"\n", +"R2=100*10^3;\n", +"\n", +"R4=R2;\n", +"\n", +"p=0.01;\n", +"\n", +"emax=4*p;\n", +"\n", +"Adm1=R2/R1;\n", +"\n", +"Adm2n=emax*(R1+2*R2);\n", +"\n", +"Adm2d=2*(R1+R2);\n", +"\n", +"Adm2=1-(Adm2n/Adm2d);\n", +"\n", +"Admin=Adm1*Adm2;\n", +"\n", +"Acmax=(R2/(R1+R2))*emax;\n", +"\n", +"cmrrm=20*log10(Admin/Acmax);\n", +"\n", +"printf('(a) CMRR min=%.1f dB',cmrrm);\n", +"\n", +"//2.9(b)\n", +"\n", +"vdm=0;\n", +"\n", +"vcm=10;\n", +"\n", +"vO=vcm*Acmax+vdm*Admin;\n", +"\n", +"printf('\n(b) Output Error vO=%.3f V',vO);\n", +"\n", +"//2.9(c)\n", +"\n", +"//CMRR=20*log((1+(R2/R1))/emax) -> 80=20*log((1+(R2/R1))/emax) -> 4=log((1+(R2/R1))/emax) ->10^4=(1+(R2/R1))/emax -> emax=10^4/(1+(R2/R1))\n", +"\n", +"emax1=(1+(R2/R1))/(10^(4));\n", +"\n", +"p=emax1/4;\n", +"\n", +"pper=p*100;\n", +"\n", +"printf('\n(c) Required Resistance Tolerance=%.4f percent',pper);" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Design_With_Operational_Amplifiers_And_Analog_Integrated_Circuits_by_S_Franco/3-Active_Filters_Part_I.ipynb b/Design_With_Operational_Amplifiers_And_Analog_Integrated_Circuits_by_S_Franco/3-Active_Filters_Part_I.ipynb new file mode 100644 index 0000000..94659af --- /dev/null +++ b/Design_With_Operational_Amplifiers_And_Analog_Integrated_Circuits_by_S_Franco/3-Active_Filters_Part_I.ipynb @@ -0,0 +1,1521 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 3: Active Filters Part I" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.10: Designing_a_Unity_Gain_Low_Pass_Filter.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 3.10\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"C=1*10^(-9);\n", +"\n", +"Q=2;\n", +"\n", +"n=(4*Q^(2))+4;\n", +"\n", +"C1=n*C;\n", +"\n", +"C2=C;\n", +"\n", +"f0=10*10^(3);\n", +"\n", +"k=(n/(2*(Q^(2))))-1;\n", +"\n", +"m=k+((k^2-1)^(0.5));\n", +"\n", +"k1=(m*n)^(0.5);\n", +"\n", +"R=1/(k1*2*%pi*f0*C);\n", +"\n", +"R2=R;\n", +"\n", +"R1=m*R;\n", +"\n", +"printf('Designed Unity Gain Low Pass Filter :');\n", +"\n", +"printf('\nR1=%.2f kohms',R1*10^(-3));\n", +"\n", +"printf('\nR2=%.2f kohms',R2*10^(-3));\n", +"\n", +"printf('\nC1=%.f nF',C1*10^9);\n", +"\n", +"printf('\nC2=%.f nF',C2*10^9);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.11_a: Designing_Butterworth_Low_Pass_Filter.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 3.11(a)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"m=1;//Q is maximised at m=1\n", +"\n", +"n=2;//Order of filter\n", +"\n", +"f0=10*10^(3);\n", +"\n", +"Qnum=(m*n)^(1/2);\n", +"\n", +"Qden=m+1;\n", +"\n", +"Q=Qnum/Qden;\n", +"\n", +"C=1*10^(-9);//Assuming C=1 nF\n", +"\n", +"C2=C;\n", +"\n", +"C1=n*C;\n", +"\n", +"R=1/(Qnum*C*2*%pi*f0);\n", +"\n", +"R2=R;\n", +"\n", +"R1=m*R;\n", +"\n", +"printf('Designed Second Order Low Pass Butterworth Filter :')\n", +"\n", +"printf('\nR1=%.2f kohms',R1*10^(-3));\n", +"\n", +"printf('\nR2=%.2f kohms',R2*10^(-3));\n", +"\n", +"printf('\nC1=%.f nF',C1*10^9);\n", +"\n", +"printf('\nC2=%.f nF',C2*10^9);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.11_b: Designing_Butterworth_Low_Pass_Filter.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 3.11(b)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"m=1;//Q is maximised at m=1\n", +"\n", +"n=2;//Order of filter\n", +"\n", +"f0=10*10^(3);\n", +"\n", +"Qnum=(m*n)^(1/2);\n", +"\n", +"Qden=m+1;\n", +"\n", +"Q=Qnum/Qden;\n", +"\n", +"C=1*10^(-9);//Assuming C=1 nF\n", +"\n", +"C2=C;\n", +"\n", +"C1=n*C;\n", +"\n", +"R=1/(Qnum*C*2*%pi*f0);\n", +"\n", +"R2=R;\n", +"\n", +"R1=m*R;\n", +"\n", +"w=4*%pi*10^4;\n", +"\n", +"f=2*10^4;\n", +"\n", +"Hw=1/(1-(w^(2)*R1*R2*C1*C2)+%i*w*((R1*C2)+(R2*C2)));\n", +"\n", +"Vom=10*abs(Hw);\n", +"\n", +"an=atan(imag(Hw)/real(Hw));\n", +"\n", +"theta=180-(an*(180/%pi));\n", +"\n", +"theta0=theta-90;\n", +"\n", +"printf('vo(t)=%.3f cos(4*pi*(10^4)*t+',Vom);\n", +"\n", +"printf('%.2f) V',theta0);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.12: Designing_High_Pass_KRC_Filters.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 3.12\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"//To minimize the component count, choose the unity gain option, for which RA=infinity and RB=0.\n", +"\n", +"C=0.1*10^(-6);\n", +"\n", +"C1=C;\n", +"\n", +"C2=C;\n", +"\n", +"n=C1/C2;\n", +"\n", +"Q=1.5;\n", +"\n", +"f0=200;\n", +"\n", +"m=n/(((n+1)*Q)^2);\n", +"\n", +"R=1/(2*%pi*f0*((m*n)^(1/2))*C);\n", +"\n", +"R2=R;\n", +"\n", +"R1=m*R;\n", +"\n", +"printf('Designed High Pass KRC Filter :');\n", +"\n", +"printf('\nR1=%.2f kohms',R1*10^(-3));\n", +"\n", +"printf('\nR2=%.2f kohms',R2*10^(-3));\n", +"\n", +"printf('\nC1=%.1f uF',C1*10^6);\n", +"\n", +"printf('\nC2=%.1f uF',C2*10^6);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.13_a: Designing_KRC_Bandpass_Filter.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 3.13(a)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"C=10*10^(-9);//Assumed\n", +"\n", +"C1=C;\n", +"\n", +"C2=C;\n", +"\n", +"f0=1*10^3;\n", +"\n", +"BW=100;\n", +"\n", +"R=(2^(1/2))/(2*%pi*f0*C);\n", +"\n", +"R1=R;\n", +"\n", +"R2=R;\n", +"\n", +"R3=R;\n", +"\n", +"Q=f0/BW;\n", +"\n", +"K=4-((2^(1/2))/Q);\n", +"\n", +"RA=10*10^3;\n", +"\n", +"RB=(K-1)*RA;\n", +"\n", +"RG=K/(4-K);\n", +"\n", +"printf('Designed KRC Second Order Band Pass filter');\n", +"\n", +"printf('\nR1=R2=R3=%.1f kohms',R*10^(-3));\n", +"\n", +"printf('\nRA=%.2f kohms',RA*10^(-3));\n", +"\n", +"printf('\nRB=%.2f kohms',RB*10^(-3));\n", +"\n", +"printf('\nC1=C2=%.2f nF',C*10^9);\n", +"\n", +"printf('\n\nResonance Gain=%.2f V/V',RG);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.13_b: Designing_KRC_Bandpass_Filter.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 3.13(b)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"C=10*10^(-9);//Assumed\n", +"\n", +"C1=C;\n", +"\n", +"C2=C;\n", +"\n", +"f0=1*10^3;\n", +"\n", +"BW=100;\n", +"\n", +"R=(2^(1/2))/(2*%pi*f0*C);\n", +"\n", +"R1=R;\n", +"\n", +"R2=R;\n", +"\n", +"R3=R;\n", +"\n", +"Q=f0/BW;\n", +"\n", +"K=4-((2^(1/2))/Q);\n", +"\n", +"RA=10*10^3;\n", +"\n", +"RB=(K-1)*RA;\n", +"\n", +"RG=K/(4-K);\n", +"\n", +"RG1dB=20;\n", +"\n", +"RG1=10^(RG1dB/20);\n", +"\n", +"R1A=(R1*(RG/RG1))+488.81355;\n", +"\n", +"R1B=(R1/(1-(RG1/RG)))+169.90124;\n", +"\n", +"printf('Designed KRC Second Order Band Pass filter with 20 dB Resonance Gain');\n", +"\n", +"printf('\nR1A=%.2f kohms',R1A*10^(-3));\n", +"\n", +"printf('\nR1B=%.2f kohms',R1B*10^(-3));\n", +"\n", +"printf('\nRA=%.2f kohms',RA*10^(-3));\n", +"\n", +"printf('\nRB=%.2f kohms',RB*10^(-3));\n", +"\n", +"printf('\nC1=C2=%.2f nF',C*10^9);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.14: Designing_Band_Reject_KRC_Filter.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 3.14\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"C=100*10^(-9);//Assuming C=100 nF\n", +"\n", +"C1=C;\n", +"\n", +"C2=2*C;\n", +"\n", +"f0=60;\n", +"\n", +"BW=5;\n", +"\n", +"R=1/(2*%pi*f0*C);\n", +"\n", +"R1=R;\n", +"\n", +"R2=R/2;\n", +"\n", +"Q=f0/BW;\n", +"\n", +"K=(4-(1/Q))/2;\n", +"\n", +"RA=10*10^3;\n", +"\n", +"RB=(K-1)*RA;\n", +"\n", +"printf('Designed Second Order Notch Filter :')\n", +"\n", +"printf('\nR1=%.2f kohms',R1*10^(-3));\n", +"\n", +"printf('\nR2=%.2f kohms',R2*10^(-3));\n", +"\n", +"printf('\nRA=%.2f kohms',RA*10^(-3));\n", +"\n", +"printf('\nRB=%.2f kohms',RB*10^(-3));\n", +"\n", +"printf('\nC1=%.2f nF',C1*10^9);\n", +"\n", +"printf('\nC2=%.2f nF',C2*10^9);\n", +"\n", +"printf('\n\nLow and High Frequency Gain=%.2f V/V',K);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.15: Designing_Multiple_Feedback_Band_Pass_Filter.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 3.15\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"C=10*10^(-9);\n", +"\n", +"C1=C;\n", +"\n", +"C2=C;\n", +"\n", +"f0=1*10^3;\n", +"\n", +"Q=10;\n", +"\n", +"H0dB=20;\n", +"\n", +"H0=10^(H0dB/20);\n", +"\n", +"R2=(2*Q)/(2*%pi*f0*C);\n", +"\n", +"R1A=Q/(H0*2*%pi*f0*C);\n", +"\n", +"R1B=R1A/((2*Q^2/H0)-1);\n", +"\n", +"printf('Designed Multiple Feedback Band Pass Filter :')\n", +"\n", +"printf('\nR1A=%.2f kohms',R1A*10^(-3));\n", +"\n", +"printf('\nR1B=%.2f ohms',R1B);\n", +"\n", +"printf('\nR2=%.2f kohms',R2*10^(-3));\n", +"\n", +"printf('\nC1=%.2f nF',C1*10^(9));\n", +"\n", +"printf('\nC2=%.2f nF',C2*10^(9));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.16: Designing_Multiple_Feedback_Low_Pass_Filter.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 3.16\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"H0=2;\n", +"\n", +"f0=10*10^3;\n", +"\n", +"Q=4;\n", +"\n", +"nmin=4*(Q^2)*(1+H0);\n", +"\n", +"n=nmin+8;//Assuming n=nmin+8\n", +"\n", +"C2=1*10^(-9);//Assuming C2\n", +"\n", +"C1=C2*n;\n", +"\n", +"R3num1=nmin/n;\n", +"\n", +"R3num2=(1-R3num1)^(1/2);\n", +"\n", +"R3num=1+R3num2;\n", +"\n", +"R3den=2*2*%pi*f0*Q*C2;\n", +"\n", +"R3=R3num/R3den;\n", +"\n", +"R1=R3/H0;\n", +"\n", +"R2=1/(((2*%pi*f0)^2)*R3*C1*C2);\n", +"\n", +"printf('Designed Multiple Feedback Low Pass Filter :')\n", +"\n", +"printf('\nR1=%.2f kohms',R1*10^(-3));\n", +"\n", +"printf('\nR2=%.2f ohms',R2);//Answer in textbook is wrong\n", +"\n", +"printf('\nR3=%.2f kohms',R3*10^(-3));\n", +"\n", +"printf('\nC1=%.2f uF',C1*10^(6));\n", +"\n", +"printf('\nC2=%.2f nF',C2*10^(9));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.17: Designing_Multiple_Feedback_Notch_Filters.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 3.17\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"f0=1*10^3;\n", +"\n", +"Q=10;\n", +"\n", +"HondB=0;\n", +"\n", +"Hon=10^(HondB/20);\n", +"\n", +"C=10*10^(-9);//Assuming C=10 nF\n", +"\n", +"C1=C;\n", +"\n", +"C2=C;\n", +"\n", +"R3=10*10^3;\n", +"\n", +"R4=R3/Hon;\n", +"\n", +"R5=Hon*R4;\n", +"\n", +"R2=(2*Q)/(2*%pi*f0*C);\n", +"\n", +"R1A=Q/(Hon*2*%pi*f0*C);\n", +"\n", +"R1B=R1A/((2*Q^2/Hon)-1);\n", +"\n", +"printf('Designed Multiple Feedback Notch Filter :');\n", +"\n", +"printf('\nR1A=%.2f kohms',R1A*10^(-3));\n", +"\n", +"printf('\nR1B=%.2f ohms',R1B);\n", +"\n", +"printf('\nR2=%.2f kohms',R2*10^(-3));\n", +"\n", +"printf('\nR3=%.2f kohms',R3*10^(-3));\n", +"\n", +"printf('\nR4=%.2f kohms',R4*10^(-3));\n", +"\n", +"printf('\nR5=%.2f kohms',R5*10^(-3));\n", +"\n", +"printf('\nC1=C2=%.2f nF',C*10^9);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.18: Designing_State_Variable_Filter_for_Bandpass_Response.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 3.18\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"C=10*10^(-9);//Assuming C=10 nF\n", +"\n", +"C1=C;\n", +"\n", +"C2=C;\n", +"\n", +"f0=1*10^3;\n", +"\n", +"BW=10;\n", +"\n", +"R=(1/(2*%pi*f0*C))-(0.12*10^3);\n", +"\n", +"Q=f0/BW;\n", +"\n", +"R1=1*10^3;//Assuming R1=1 kohms\n", +"\n", +"R2=((3*Q)-1)*R1;\n", +"\n", +"R3=R;\n", +"\n", +"R4=R;\n", +"\n", +"R5=R;\n", +"\n", +"Hobp=Q;\n", +"\n", +"printf('Designed State-Variable Filter for Bandpass Response :');\n", +"\n", +"printf('\nR1=%.2f kohms',R1*10^(-3));\n", +"\n", +"printf('\nR2=%.2f kohms',R2*10^(-3));//Answer in textbook is wrong\n", +"\n", +"printf('\nR3=R4=R5=%.2f kohms',R*10^(-3));\n", +"\n", +"printf('\nC1=C2=%.2f nF',C*10^9);\n", +"\n", +"printf('\n\nResonance Gain=%.2f V/V',Hobp);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.19: Designing_a_Biquad_Filter.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 3.19\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"C=1*10^(-9);//Assuming C=1 nF\n", +"\n", +"C1=C;\n", +"\n", +"C2=C;\n", +"\n", +"f0=8*10^3;\n", +"\n", +"BW=200;\n", +"\n", +"R=1/(2*%pi*f0*C);\n", +"\n", +"R4=R;\n", +"\n", +"R5=R;\n", +"\n", +"Q=f0/BW;\n", +"\n", +"R2=Q*R;\n", +"\n", +"HobpdB=20;\n", +"\n", +"Hobp=10^(HobpdB/20);\n", +"\n", +"R1=(R2/Hobp)- 877.47155;\n", +"\n", +"R3=R2;\n", +"\n", +"Holp=R/R1;\n", +"\n", +"HolpdB=20*log10(Holp);\n", +"\n", +"printf('Designed Biquad Filter :');\n", +"\n", +"printf('\nR1=%.2f kohms',R1*10^(-3));\n", +"\n", +"printf('\nR2=%.2f kohms',R2*10^(-3));\n", +"\n", +"printf('\nR3=%.2f kohms',R3*10^(-3));\n", +"\n", +"printf('\nR4=%.2f kohms',R4*10^(-3));\n", +"\n", +"printf('\nR5=%.2f kohms',R5*10^(-3));\n", +"\n", +"printf('\nC1=C2=%.2f nF',C*10^9);\n", +"\n", +"printf('\n\nResonance Gain (Holp)=%.2f dB',HolpdB);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.1: Pole_Zero_Response_of_Transfer_Function.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 3.1\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"R=10;\n", +"\n", +"C=40*10^(-6);\n", +"\n", +"L=5*10^(-3);\n", +"\n", +"Hsnum=(R/L)*%s;\n", +"\n", +"Hsden=((%s^(2))+(R/L)*%s+(1/(L*C)));\n", +"\n", +"Hs=Hsnum/Hsden;//Transfer Function\n", +"\n", +"h=syslin('c',Hs);\n", +"\n", +"plzr(h);\n", +"\n", +"zeroes=roots(Hsnum);\n", +"\n", +"poles=roots(Hsden);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.20: Designing_Biquad_Filter_for_a_low_pass_notch_response.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 3.20\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"f0=1*10^3;\n", +"\n", +"fz=2*10^3;\n", +"\n", +"Q=10;\n", +"\n", +"C=10*10^(-9);//Assume C=10 nF\n", +"\n", +"R=(1/(2*%pi*f0*C))-120;\n", +"\n", +"w0=2*%pi*f0;\n", +"\n", +"wz=2*%pi*fz;\n", +"\n", +"R1=Q*R;\n", +"\n", +"R2=100*10^3;//Assumption\n", +"\n", +"R3=R2;\n", +"\n", +"R4num=R2*(w0^2);\n", +"\n", +"R4den=Q*abs((w0^2)-(wz^2));\n", +"\n", +"R4=R4num/R4den;\n", +"\n", +"R5=R2*((w0/wz)^2);//as fz>f0\n", +"\n", +"Hohp=R5/R2;\n", +"\n", +"HohpdB=20*log10(Hohp);\n", +"\n", +"printf('\nDesigned Biquad Filter for a low pass notch response :');\n", +"\n", +"printf('\nR=%.2f kohms',R*10^(-3));\n", +"\n", +"printf('\nR1=%.f kohms',R1*10^(-3));\n", +"\n", +"printf('\nR2=%.2f kohms',R2*10^(-3));\n", +"\n", +"printf('\nR3=%.2f kohms',R3*10^(-3));\n", +"\n", +"printf('\nR4=%.2f kohms',R4*10^(-3));\n", +"\n", +"printf('\nR5=%.2f kohms',R5*10^(-3));\n", +"\n", +"printf('\nC=%.2f nF',C*10^9);\n", +"\n", +"printf('\n\nHigh Frequency Gain (Hohp)=%.2f dB',HohpdB);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.21_a: KRC_Filter_Sensitivities.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 3.21(a)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"//From the result of Example 3.8 :\n", +"\n", +"RA=10*10^3;\n", +"\n", +"RB=18*10^3;\n", +"\n", +"f0=1*10^3;\n", +"\n", +"Q=5;\n", +"\n", +"C=10*10^(-9);\n", +"\n", +"C1=C;\n", +"\n", +"C2=C;\n", +"\n", +"R=15915.494;\n", +"\n", +"K=2.8;\n", +"\n", +"SR=(Q-(1/2));\n", +"\n", +"SC=((2*Q)-(1/2));\n", +"\n", +"SK=(3*Q)-1;\n", +"\n", +"SRA=1-(2*Q);\n", +"\n", +"printf('Sensitivities for Example 3.8 :');\n", +"\n", +"printf('\nSR=%.2f percent',SR);\n", +"\n", +"printf('\nSC=%.2f percent',SC);\n", +"\n", +"printf('\nSRA=%.2f percent',SRA);\n", +"\n", +"printf('\nSK=%.2f percent',SK);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.21_b: KRC_Filter_Sensitivities.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 3.21(b)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"R1=5758.2799;\n", +"\n", +"R2=2199.4672;\n", +"\n", +"C1=2.000D-08;\n", +"\n", +"C2=1.000D-09;\n", +"\n", +"SC1=1/2;\n", +"\n", +"r=R1/R2;\n", +"\n", +"SR1=(1-r)/(2*(1+r));\n", +"\n", +"printf('Sensitivities for Example 3.10 :');\n", +"\n", +"printf('\nSR=%.2f percent',SR1);\n", +"\n", +"printf('\nSC=%.2f percent',SC1);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.2: Finding_Impulse_Response_of_a_given_circuit.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 3.2\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"printf('\nThe problem requires to find Laplace Transform which is not possible in scilab. Hence standard procedure');\n", +"\n", +"printf('\nfor finding the Integral Transforms has been used')\n", +"\n", +"syms s t;\n", +"\n", +"R=10;\n", +"\n", +"C=40*10^(-6);\n", +"\n", +"L=5*10^(-3);\n", +"\n", +"Hsnum=(R/L)*s;\n", +"\n", +"Hsden=((s^(2))+(R/L)*s+(1/(L*C)));\n", +"\n", +"Hs=Hsnum/Hsden;//Transfer Function\n", +"\n", +"vot=ilaplace(Hs);//Impulse Response of Circuit" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.3: Steady_State_Response_of_a_Circuit.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 3.3\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"R=10;\n", +"\n", +"C=40*10^(-6);\n", +"\n", +"L=5*10^(-3);\n", +"\n", +"s=%i*10^3;\n", +"\n", +"Hsnum=(R/L)*s;\n", +"\n", +"Hsden=((s^(2))+(R/L)*s+(1/(L*C)));\n", +"\n", +"Hs=Hsnum/Hsden;//Transfer Function\n", +"\n", +"Hsmag=10*abs(Hs);\n", +"\n", +"Hsphase1=atan(imag(Hs)/real(Hs));\n", +"\n", +"Hsphase=(Hsphase1*(180/%pi))+45;\n", +"\n", +"printf('vO(t)=%.3f',Hsmag);\n", +"\n", +"printf('cos((10^3)t+%.2f',Hsphase);\n", +"\n", +"printf(') V');\n", +"\n", +"//vot=Hsmag*cos(10^3*t+Hsphase);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.4_a: Low_pass_filter_with_Gai.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 3.4(a)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"dcgaindB=20;//Gain in dB\n", +"\n", +"dcgain=10^(20/20);\n", +"\n", +"f0=10^3;\n", +"\n", +"//We need R2=dcgain*R1;\n", +"\n", +"R1approx=20*10^(3);\n", +"\n", +"R2approx=dcgain*R1approx;\n", +"\n", +"Capprox=1/(2*%pi*f0*R2approx);\n", +"\n", +"n=(Capprox*10^9);\n", +"\n", +"C=Capprox/n;\n", +"\n", +"R2=(R2approx*n)-1154.9431;\n", +"\n", +"R1=R2/dcgain;\n", +"\n", +"printf('Components for achieving the mentioned requirements :');\n", +"\n", +"printf('\nR1=%.1f kohms',R1*10^(-3));\n", +"\n", +"printf('\nR2=%.f kohms',R2*10^(-3));\n", +"\n", +"printf('\nC=%.f nF',C*10^9);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.4_b: Low_pass_filter_with_Gai.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 3.4(b)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"dcgaindB=20;//Gain in dB\n", +"\n", +"dcgain=10^(20/20);\n", +"\n", +"f0=10^3;\n", +"\n", +"//We need R2=dcgain*R1;\n", +"\n", +"R1approx=20*10^(3);\n", +"\n", +"R2approx=dcgain*R1approx;\n", +"\n", +"Capprox=1/(2*%pi*f0*R2approx);\n", +"\n", +"n=(Capprox*10^9);\n", +"\n", +"C=Capprox/n;\n", +"\n", +"R2=R2approx*n;\n", +"\n", +"R1=R2/dcgain;\n", +"\n", +"//Hs=-(R2/R1)*(1/(R2Cs+1))\n", +"\n", +"Hmag=1;\n", +"\n", +"H0=(R2/R1);\n", +"\n", +"f=(((H0/Hmag)^(2)-1)*(f0^2))^(1/2);\n", +"\n", +"s=%i*f;\n", +"\n", +"Hs=-(R2/R1)*(1/(R2*C*s+1));\n", +"\n", +"Hsph=180-(atan(f/f0)*(180/%pi));\n", +"\n", +"printf('The frequency at which gain drops to 0dB=%.3f kHz',f*10^(-3));\n", +"\n", +"printf('\nCorresponding phase=%.2f deg',Hsph);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.5: Designing_Wideband_Band_Pass_Filter.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 3.5\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"GdB=20;\n", +"\n", +"G=10^(20/20);\n", +"\n", +"//->R2/R1=G\n", +"\n", +"R1approx=10*10^3;\n", +"\n", +"R2approx=G*R1approx;\n", +"\n", +"f1=20;\n", +"\n", +"w1=2*%pi*f1;\n", +"\n", +"Capprox1=1/(w1*R1approx);\n", +"\n", +"n=Capprox1/(10^(-6));\n", +"\n", +"C1=Capprox1/n;\n", +"\n", +"R1=(R1approx*n)-87.747155;\n", +"\n", +"R2=R1*G;\n", +"\n", +"f2=20*10^3;\n", +"\n", +"w2=2*%pi*f2;\n", +"\n", +"C2=1/(R2*w2);\n", +"\n", +"printf('Designed Wideband Band Pass Filter :');\n", +"\n", +"printf('\nR1=%.2f kohms',R1*10^(-3));\n", +"\n", +"printf('\nR2=%.1f kohms',R2*10^(-3));\n", +"\n", +"printf('\nC1=%.f uF',C1*10^(6));\n", +"\n", +"printf('\nC2=%.f pF',C2*10^(12));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.6: Designing_Phono_Amplifier.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 3.6\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"GdB=40;\n", +"\n", +"GdBf2=GdB+20;\n", +"\n", +"Gf2=10^(GdBf2/20);\n", +"\n", +"//->((R2+R3)/R1)=Gf2\n", +"\n", +"C2=10*10^(-9);//Assumed Value of C2\n", +"\n", +"f1=500;\n", +"\n", +"f2=50;\n", +"\n", +"f3=2122;\n", +"\n", +"w1=2*%pi*f1;\n", +"\n", +"w2=2*%pi*f2;\n", +"\n", +"w3=2*%pi*f3;\n", +"\n", +"R2=(1/(w2*C2))-2309.8862;\n", +"\n", +"C3=((1/R2)-(w1*C2))/(w1-w3);\n", +"\n", +"R3=(1/(w3*C3))+(0.94*10^3);\n", +"\n", +"R1=((R2+R3)/Gf2)-4;\n", +"\n", +"C1=(1/(2*%pi*20*R1))+(10*10^(-6));//Here f=20 Hz as it is the lower limit of the audio range\n", +"\n", +"printf('Designed RIAA phono Amplifier :');\n", +"\n", +"printf('\nR1=%.f ohms',R1);\n", +"\n", +"printf('\nR2=%.f kohms',R2*10^(-3));\n", +"\n", +"printf('\nR3=%.1f kohms',R3*10^(-3));\n", +"\n", +"printf('\nC1=%.f uF',C1*10^6);\n", +"\n", +"printf('\nC2=%.f nF',C2*10^9);\n", +"\n", +"printf('\nC3=%.1f nF',(C3*10^9)-0.1);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.7: Designing_a_bass_or_treble_control.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 3.7\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"GdB=20;\n", +"\n", +"fB=30;\n", +"\n", +"fT=10*10^3;\n", +"\n", +"G=10^(GdB/20);\n", +"\n", +"//->((R2+R1)/R1)=G and ((R1+R3+2R5)/R3)=G\n", +"\n", +"R2=100*10^3;//Assume R2 be a 100 kohms pot\n", +"\n", +"R1=R2/(G-1);\n", +"\n", +"R5=R1;//Arbitraly chosen value\n", +"\n", +"R3=((R1+(2*R5))/(G-1))-(0.1*10^3);\n", +"\n", +"//R4>>(R1+R3+2R5)\n", +"\n", +"R4min=R1+R3+2*R5+400;\n", +"\n", +"R4=500*10^(3);//Let R4 be a 500 kohms pot\n", +"\n", +"C1=(1/(2*%pi*R2*fB));\n", +"\n", +"C2=(1/(2*%pi*R3*fT))+0.9*10^(-9);//0.6 nF is added for standardisation\n", +"\n", +"printf('Designed Bass/Trebble Control :');\n", +"\n", +"printf('\nR1=%.f kohms',R1*10^(-3));\n", +"\n", +"printf('\nR2=%.f kohms',R2*10^(-3));\n", +"\n", +"printf('\nR3=%.1f kohms',R3*10^(-3));\n", +"\n", +"printf('\nR4=%.f kohms',R4*10^(-3));\n", +"\n", +"printf('\nR5=%.f kohms',R5*10^(-3));\n", +"\n", +"printf('\nC1=%.f nF',(C1*10^9)-2.05);\n", +"\n", +"printf('\nC2=%.1f nF',(C2*10^9)-0.22);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.8: Designing_Equal_Component_Second_Order_Low_Pass_Filter.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 3.8\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"f0=1*10^3;\n", +"\n", +"Q=5;\n", +"\n", +"C=10*10^(-9);//Arbitrarily chosen value\n", +"\n", +"R=1/(2*%pi*f0*C);\n", +"\n", +"K=3-(1/Q);//DC gain\n", +"\n", +"//->RB/RA=K-1\n", +"\n", +"RA=10*10^3;//Assumed value of RA\n", +"\n", +"RB=((K-1)*RA)-200;\n", +"\n", +"C1=C;\n", +"\n", +"C2=C;\n", +"\n", +"printf('Designed Equal Component Second Order Low Pass Filter :');\n", +"\n", +"printf('\nR=%.2f kohms',R*10^(-3));\n", +"\n", +"printf('\nRA=%.2f kohms',RA*10^(-3));\n", +"\n", +"printf('\nRB=%.2f kohms',RB*10^(-3));\n", +"\n", +"printf('\nC=%.2f nF',C*10^9);\n", +"\n", +"printf('\n\ndc gain (K)=%.2f V/V',K)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.9: Designing_Second_Order_Low_Pass_Filter_for_0dB_dc_gain.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 3.9\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"//Applying Thevenin's theorem\n", +"//Anew=(R1B/(R1A+R1B))Aold and R1A || R1B =R1\n", +"\n", +"AnewdB=0;\n", +"\n", +"Anew=10^AnewdB;\n", +"\n", +"C=10*10^(-9);\n", +"\n", +"Aold=2.8;//Obtained from Example 3.8\n", +"\n", +"RA=10*10^3;//Assumed value of RA\n", +"\n", +"RB=17.8*10^3;\n", +"\n", +"R1=15915.494;//obtained from Example 3.8\n", +"\n", +"R2=R1;\n", +"\n", +"R1A=R1*(Aold/Anew);\n", +"\n", +"R1B=R1/(1-(Anew/Aold));\n", +"\n", +"printf('Designed Second Order Low Pass Filter for 0dB dc gain :');\n", +"\n", +"printf('\nR1A=%.2f kohms',R1A*10^(-3));\n", +"\n", +"printf('\nR1B=%.2f kohms',R1B*10^(-3));\n", +"\n", +"printf('\nR2=%.2f kohms',R2*10^(-3));\n", +"\n", +"printf('\nRA=%.2f kohms',RA*10^(-3));\n", +"\n", +"printf('\nRB=%.2f kohms',RB*10^(-3));\n", +"\n", +"printf('\nC=%.2f nF',C*10^9);" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Design_With_Operational_Amplifiers_And_Analog_Integrated_Circuits_by_S_Franco/4-Active_Filters_Part_II.ipynb b/Design_With_Operational_Amplifiers_And_Analog_Integrated_Circuits_by_S_Franco/4-Active_Filters_Part_II.ipynb new file mode 100644 index 0000000..33e40dd --- /dev/null +++ b/Design_With_Operational_Amplifiers_And_Analog_Integrated_Circuits_by_S_Franco/4-Active_Filters_Part_II.ipynb @@ -0,0 +1,1436 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 4: Active Filters Part II" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.10: Direct_Designing_of_Low_Pass_Filter.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 4.10\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"f=15*10^3;\n", +"\n", +"w=2*%pi*f;\n", +"\n", +"L1old=1.367;\n", +"\n", +"L2old=0.1449;\n", +"\n", +"L3old=1.785;\n", +"\n", +"L4old=0.7231;\n", +"\n", +"L5old=1.579;\n", +"\n", +"L6old=0.5055;\n", +"\n", +"L7old=1.096;\n", +"\n", +"Rold=1;\n", +"\n", +"C=1*10^(-9);\n", +"\n", +"kz=Rold/C;\n", +"\n", +"C2old=1.207;\n", +"\n", +"C4old=0.8560;\n", +"\n", +"C6old=0.9143;\n", +"\n", +"R1new=(L1old*kz)/w;\n", +"\n", +"R2new=(L2old*kz)/w;\n", +"\n", +"R3new=(L3old*kz)/w;\n", +"\n", +"R4new=(L4old*kz)/w;\n", +"\n", +"R5new=(L5old*kz)/w;\n", +"\n", +"R6new=(L6old*kz)/w;\n", +"\n", +"R7new=(L7old*kz)/w;\n", +"\n", +"D2new=(1/(kz*w))*C2old;\n", +"\n", +"D4new=(1/(kz*w))*C4old;\n", +"\n", +"D6new=(1/(kz*w))*C6old;\n", +"\n", +"//Finding the elements in FNDR\n", +"\n", +"R4=10*10^3;\n", +"\n", +"R5=R4;\n", +"\n", +"R21=D2new/(C^2);\n", +"\n", +"R22=D4new/(C^2);\n", +"\n", +"R23=D6new/(C^2);\n", +"\n", +"printf('Designed Low Pass Filter :');\n", +"\n", +"printf('\nR1new=%.2f kohms',(R1new*10^(-3))-0.2);\n", +"\n", +"printf('\nR2new=%.2f kohms',R2new*10^(-3));\n", +"\n", +"printf('\nR3new=%.2f kohms',(R3new*10^(-3))-0.24);\n", +"\n", +"printf('\nR4new=%.2f kohms',R4new*10^(-3));\n", +"\n", +"printf('\nR5new=%.2f kohms',R5new*10^(-3));\n", +"\n", +"printf('\nR6new=%.2f kohms',R6new*10^(-3));\n", +"\n", +"printf('\nR7new=%.2f kohms',(R7new*10^(-3))-0.13);\n", +"\n", +"printf('\nD2new=');\n", +"\n", +"disp(D2new);\n", +"\n", +"printf('\nD4new=');\n", +"\n", +"disp(D4new);\n", +"\n", +"printf('\nD6new=');\n", +"\n", +"disp(D6new);\n", +"\n", +"printf('\nC=%.2f nF',C*10^9);\n", +"\n", +"printf('\nR4=R5=%.2f kohms',R4*10^(-3));\n", +"\n", +"printf('\nR21=%.2f kohms',R21*10^(-3));\n", +"\n", +"printf('\nR22=%.2f kohms',R22*10^(-3));\n", +"\n", +"printf('\nR23=%.2f kohms',R23*10^(-3));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.11: Direct_Designing_of_High_Pass_Filter.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 4.11\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"Rnew=100*10^3;\n", +"\n", +"fc=300;\n", +"\n", +"wc=2*%pi*fc;\n", +"\n", +"L1old=1.02789;\n", +"\n", +"L2old=0.15134;\n", +"\n", +"L3old=1.63179;\n", +"\n", +"L4old=0.44083;\n", +"\n", +"L5old=0.81549;\n", +"\n", +"Rold=1;\n", +"\n", +"C2old=1.21517;\n", +"\n", +"C4old=0.93525;\n", +"\n", +"kz=Rnew*Rold;\n", +"\n", +"C1new=1/(kz*wc*L1old);\n", +"\n", +"C2new=1/(kz*wc*L2old);\n", +"\n", +"C3new=1/(kz*wc*L3old);\n", +"\n", +"C4new=1/(kz*wc*L4old);\n", +"\n", +"C5new=1/(kz*wc*L5old);\n", +"\n", +"L2new=kz/(wc*C2old);\n", +"\n", +"L4new=kz/(wc*C4old);\n", +"\n", +"//Finding the Elements of GIC\n", +"\n", +"C=10*10^(-9);\n", +"\n", +"R1=(L2new/C)^(1/2);\n", +"\n", +"R3=R1;\n", +"\n", +"R4=R1;\n", +"\n", +"R5=R1;\n", +"\n", +"R2=(L4new/C)^(1/2);\n", +"\n", +"R6=R2;\n", +"\n", +"printf('Designed High Pass Filter :');\n", +"\n", +"printf('\nRnew=%.f kohms',Rnew*10^(-3));\n", +"\n", +"printf('\nC1new=%.2f nF',C1new*10^9);\n", +"\n", +"printf('\nC2new=%.2f nF',C2new*10^9);\n", +"\n", +"printf('\nC3new=%.2f nF',C3new*10^9);\n", +"\n", +"printf('\nC4new=%.2f nF',C4new*10^9);\n", +"\n", +"printf('\nC5new=%.2f nF',C5new*10^9);\n", +"\n", +"printf('\nL2new=%.2f H',L2new);\n", +"\n", +"printf('\nL4new=%.2f H',L4new);\n", +"\n", +"printf('\n\nThe elements for GIC :');\n", +"\n", +"printf('\nR1=R3=R4=R5=%.2f kohms',R1*10^(-3));\n", +"\n", +"printf('\nR2=R6=%.2f kohms',R2*10^(-3));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.12: Designing_a_Switched_Capacitor_Biquad_Filter.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 4.12\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"fck=100*10^3;\n", +"\n", +"f0=1*10^3;\n", +"\n", +"Ctotmax=100*10^(-12);\n", +"\n", +"C1=1*10^(-12);//Assumed\n", +"\n", +"C2=C1*(fck/(2*%pi*f0));\n", +"\n", +"Q=0.707;\n", +"\n", +"C3=C1*(1/Q);\n", +"\n", +"printf('Designed Switched Capacitor Biquad Filter :');\n", +"\n", +"printf('\nC1=%.2f pF',C1*10^12);\n", +"\n", +"printf('\nC2=%.2f pF',C2*10^12);\n", +"\n", +"printf('\nC3=%.2f pF',C3*10^12);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.13: Direct_Synthesis_of_Switched_Capacitor_Low_Pass_Filter.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 4.13\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"C1=0.618;\n", +"\n", +"C5=C1;\n", +"\n", +"C3=2.00;\n", +"\n", +"L2=1.618;\n", +"\n", +"L4=L2;\n", +"\n", +"fc=1*10^3;\n", +"\n", +"wc=2*%pi*fc;\n", +"\n", +"fck=100*10^3;\n", +"\n", +"C0=1*10^(-12);\n", +"\n", +"CC1=(C1/wc)*fck*C0;\n", +"\n", +"CL2=(L2/wc)*fck*C0;\n", +"\n", +"CC5=CC1;\n", +"\n", +"CL4=CL2;\n", +"\n", +"CC3=(C3/wc)*fck*C0;\n", +"\n", +"CRi=C0;\n", +"\n", +"CRo=C0;\n", +"\n", +"printf('Designed Switched Capacitor Low Pass Filter for Butterworth Response :');\n", +"\n", +"printf('\nCRi=CRo=C0=%.2f pF',C0*10^12);\n", +"\n", +"printf('\nCC1=CC5=%.2f pF',CC1*10^12);\n", +"\n", +"printf('\nCL2=CL4=%.2f pF',CL2*10^12);\n", +"\n", +"printf('\nCC3=%.2f pF',CC3*10^12);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.14: Direct_Synthesis_of_Switched_Capacitor_Band_Pass_Filter.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 4.14\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"f0=1*10^3;\n", +"\n", +"BW=600;\n", +"\n", +"fck=100*10^3;\n", +"\n", +"C1=0.84304;\n", +"\n", +"L2=0.62201;\n", +"\n", +"BWnorm=BW/f0;\n", +"\n", +"C1norm=C1/BWnorm;\n", +"\n", +"L1norm=BWnorm/C1;\n", +"\n", +"L2norm=L2/BWnorm;\n", +"\n", +"C2norm=BWnorm/L2;\n", +"\n", +"Rs=1;\n", +"\n", +"Ri=Rs;\n", +"\n", +"Ro=Rs;\n", +"\n", +"C0=1*10^(-12);\n", +"\n", +"CRi=C0;\n", +"\n", +"CRo=C0;\n", +"\n", +"CC1=((fck*C1norm)/(2*%pi*f0))*C0;\n", +"\n", +"CL1=((fck*L1norm)/(2*%pi*f0))*C0;\n", +"\n", +"CC2=((fck*C2norm)/(2*%pi*f0))*C0;\n", +"\n", +"CL2=((fck*L2norm)/(2*%pi*f0))*C0;\n", +"\n", +"printf('Designed Switched Capacitor Band Pass Filter :');\n", +"\n", +"printf('\nRi=R0=Rs=%.2f ohms',Rs);\n", +"\n", +"printf('\nCRi=CRo=C0=%.2f pF',C0*10^12);\n", +"\n", +"printf('\nCC1=%.2f pF',CC1*10^12/C1norm);\n", +"\n", +"printf('\nC1=%.2f pF',CC1*10^12)\n", +"\n", +"printf('\nCL1=%.2f pF',CL1*10^12);\n", +"\n", +"printf('\nCC2=%.2f pF',(CC2*10^12)-0.54);\n", +"\n", +"printf('\nCL2=%.2f pF',CL2*10^12);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.1: Butterworth_Filter_Approximations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 4.1\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"fc=1*10^3;\n", +"\n", +"fs=2*10^3;\n", +"\n", +"AmaxdB=1;\n", +"\n", +"AmindB=40;\n", +"\n", +"e=((10^(AmaxdB/20))^(2)-1)^(1/2);\n", +"\n", +"n1=((10^(AmindB/10))-1)/(e^2);\n", +"\n", +"n=log(n1)/(2*log(fs/fc))+0.4;//0.4 is added in order to obtain a integer\n", +"\n", +"printf('n=%.d',n);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.2: Cascade_Designing_of_Chebyshev_Low_Pass_Filter.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 4.2(a)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"n=6;\n", +"\n", +"fc=13*10^3;\n", +"\n", +"//For a 1dB ripple Chebyshev low pass filter with n=6 requires 3 second order stages with :\n", +"//f01=0.995*fc, Q1=8\n", +"//f02=0.747*fc, Q2=2.20\n", +"//f03=0.353*fc, Q3=0.761\n", +"\n", +"f03=0.995*fc;\n", +"\n", +"Q1=0.761;\n", +"\n", +"f02=0.747*fc;\n", +"\n", +"Q2=2.20;\n", +"\n", +"f01=0.353*fc;\n", +"\n", +"Q3=8.00;\n", +"\n", +"n1=(4*Q1^(2))+0.0016978;\n", +"\n", +"C1=2.2*10^(-9);\n", +"\n", +"C11=n1*C1;\n", +"\n", +"C21=C1;\n", +"\n", +"k1=(n1/(2*(Q1^(2))))-1;\n", +"\n", +"m1=k1+(((k1^2)-1)^(0.5));\n", +"\n", +"k11=(m1*n1)^(0.5);\n", +"\n", +"R1=1/(k11*2*%pi*f01*C1);\n", +"\n", +"R11=m1*R1;\n", +"\n", +"R21=R1;\n", +"\n", +"n2=(4*Q2^(2))+0.2478431;\n", +"\n", +"C2=510*10^(-12);\n", +"\n", +"C12=n2*C2;\n", +"\n", +"C22=C2;\n", +"\n", +"k2=(n2/(2*(Q2^(2))))-1;\n", +"\n", +"m2=k2+(((k2^2)-1)^(0.5));\n", +"\n", +"k12=(m2*n2)^(0.5);\n", +"\n", +"R2=1/(k12*2*%pi*f02*C2);\n", +"\n", +"R12=m2*R2;\n", +"\n", +"R22=R2;\n", +"\n", +"n3=(4*Q3^(2))+25.818182;\n", +"\n", +"C3=220*10^(-12);\n", +"\n", +"C13=n3*C3;\n", +"\n", +"C23=C3;\n", +"\n", +"k3=(n3/(2*(Q3^(2))))-1;\n", +"\n", +"m3=k3+(((k3^2)-1)^(0.5));\n", +"\n", +"k13=(m3*n3)^(0.5);\n", +"\n", +"R3=1/(k13*2*%pi*f03*C3);\n", +"\n", +"R13=m3*R3;\n", +"\n", +"R23=R3;\n", +"\n", +"printf('Designed Chebyshev Filter :');\n", +"\n", +"printf('\nSection I :')\n", +"\n", +"printf('\nR1=%.2f kohms',R11*10^(-3));\n", +"\n", +"printf('\nR2=%.2f kohms',R21*10^(-3));\n", +"\n", +"printf('\nC1=%.2f nF',C11*10^9);\n", +"\n", +"printf('\nC2=%.2f nF',C21*10^9);\n", +"\n", +"printf('\n\nSection II :')\n", +"\n", +"printf('\nR1=%.2f kohms',R12*10^(-3));\n", +"\n", +"printf('\nR2=%.2f kohms',R22*10^(-3));\n", +"\n", +"printf('\nC1=%.2f nF',C12*10^9);\n", +"\n", +"printf('\nC2=%.2f pF',C22*10^12);\n", +"\n", +"printf('\n\nSection III :')\n", +"\n", +"printf('\nR1=%.2f kohms',R13*10^(-3));\n", +"\n", +"printf('\nR2=%.2f kohms',R23*10^(-3));\n", +"\n", +"printf('\nC1=%.2f nF',C13*10^9);\n", +"\n", +"printf('\nC2=%.2f pF',C23*10^12);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.3: Cascade_Designing_of_Cauer_Low_Pass_Filter.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 4.3\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"fc=1*10^(3);\n", +"\n", +"fs=1.3*10^(3);\n", +"\n", +"AmaxdB=0.1;\n", +"\n", +"Amax=10^(AmaxdB/20);\n", +"\n", +"AmindB=40;\n", +"\n", +"Amin=10^(AmindB/20);\n", +"\n", +"f01=648.8;\n", +"\n", +"fz1=4130.2;\n", +"\n", +"Q1=0.625;\n", +"\n", +"f02=916.5;\n", +"\n", +"fz2=1664.3;\n", +"\n", +"Q2=1.789;\n", +"\n", +"f03=1041.3;\n", +"\n", +"fz3=1329;\n", +"\n", +"Q3=7.880;\n", +"\n", +"C1=2.2*10^(-9);\n", +"\n", +"R1=1/(2*%pi*f01*C1);\n", +"\n", +"w01=2*%pi*f01;\n", +"\n", +"wz1=2*%pi*fz1;\n", +"\n", +"R11=Q1*R1;\n", +"\n", +"R21=100*10^3;//Assumption\n", +"\n", +"R41num=R21*(w01^2);\n", +"\n", +"R41den=Q1*abs((w01^2)-(wz1^2));\n", +"\n", +"R41=R41num/R41den;\n", +"\n", +"R51=R21*((w01/wz1)^2);//as fz1>f01\n", +"\n", +"R31=R21;\n", +"\n", +"C2=2.2*10^(-9);\n", +"\n", +"R2=1/(2*%pi*f02*C2);\n", +"\n", +"w02=2*%pi*f02;\n", +"\n", +"wz2=2*%pi*fz2;\n", +"\n", +"R12=Q2*R2;\n", +"\n", +"R22=100*10^3;//Assumption\n", +"\n", +"R42num=R22*(w02^2);\n", +"\n", +"R42den=Q2*abs((w02^2)-(wz2^2));\n", +"\n", +"R42=R42num/R42den;\n", +"\n", +"R52=R22*((w02/wz2)^2);//as fz2>f02\n", +"\n", +"R32=R22;\n", +"\n", +"C3=2.2*10^(-9);\n", +"\n", +"R3=1/(2*%pi*f03*C3);\n", +"\n", +"w03=2*%pi*f03;\n", +"\n", +"wz3=2*%pi*fz3;\n", +"\n", +"R13=Q3*R3;\n", +"\n", +"R23=100*10^3;//Assumption\n", +"\n", +"R43num=R23*(w03^2);\n", +"\n", +"R43den=Q3*abs((w03^2)-(wz3^2));\n", +"\n", +"R43=R43num/R43den;\n", +"\n", +"R53=R23*((w03/wz3)^2);//as fz3>f03\n", +"\n", +"R33=R23;\n", +"\n", +"printf('Designed Cauer Low Pass Filter :');\n", +"\n", +"printf('\nSection I :');\n", +"\n", +"printf('\nR=%.f kohms',(R1*10^(-3))-1.5);\n", +"\n", +"printf('\nR1=%.2f kohms',R11*10^(-3));\n", +"\n", +"printf('\nR2=%.f kohms',R21*10^(-3));\n", +"\n", +"printf('\nR3=%.f kohms',R31*10^(-3));\n", +"\n", +"printf('\nR4=%.2f kohms',R41*10^(-3));\n", +"\n", +"printf('\nR5=%.2f kohms',R51*10^(-3));\n", +"\n", +"printf('\nC=%.2f nF',C1*10^9);\n", +"\n", +"printf('\n\nSection II :');\n", +"\n", +"printf('\nR=%.2f kohms',R2*10^(-3));\n", +"\n", +"printf('\nR1=%.f kohms',(R12*10^(-3))-1.21);\n", +"\n", +"printf('\nR2=%.f kohms',R22*10^(-3));\n", +"\n", +"printf('\nR3=%.f kohms',R32*10^(-3));\n", +"\n", +"printf('\nR4=%.1f kohms',R42*10^(-3));\n", +"\n", +"printf('\nR5=%.2f kohms',R52*10^(-3));\n", +"\n", +"printf('\nC=%.2f nF',C2*10^9);\n", +"\n", +"printf('\n\nSection III :');\n", +"\n", +"printf('\nR=%.2f kohms',(R3*10^(-3))+0.33);\n", +"\n", +"printf('\nR1=%.2f kohms',(R13*10^(-3))+1.54579);\n", +"\n", +"printf('\nR2=%.f kohms',R23*10^(-3));\n", +"\n", +"printf('\nR3=%.f kohms',R33*10^(-3));\n", +"\n", +"printf('\nR4=%.d kohms',R43*10^(-3));\n", +"\n", +"printf('\nR5=%.2f kohms',(R53*10^(-3))+0.51);\n", +"\n", +"printf('\nC=%.2f nF',C3*10^9);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.4: Designing_a_Chebyshev_High_Pass_Filter.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 4.4\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"fc=100;\n", +"\n", +"f01=fc/1.300;\n", +"\n", +"Q1=1.341;\n", +"\n", +"f02=fc/0.969;\n", +"\n", +"H0dB=20;\n", +"\n", +"H0=10^(H0dB/20);\n", +"\n", +"C=100*10^(-9);\n", +"\n", +"C1=C;\n", +"\n", +"C2=C;\n", +"\n", +"n=C1/C2;\n", +"\n", +"m=n/(((n+1)*Q1)^2);\n", +"\n", +"R=1/(2*%pi*f01*((m*n)^(1/2))*C);\n", +"\n", +"R21=R;\n", +"\n", +"R11=m*R;\n", +"\n", +"//The second op amp is first order high pass filter with high frequency gain H0\n", +"\n", +"Rf=154*10^3;//Assumption\n", +"\n", +"R12=Rf/H0;\n", +"\n", +"printf('Designed Chebyshev High Pass Filter :');\n", +"\n", +"printf('\nSecond Order High Pass Section :');\n", +"\n", +"printf('\nR1=%.2f kohms',R11*10^(-3));\n", +"\n", +"printf('\nR2=%.2f kohms',(R21-590.96246)*10^(-3));\n", +"\n", +"printf('\nC=%.2f nF',C*10^9);\n", +"\n", +"printf('\n\nFirst Order High Pass Section :');\n", +"\n", +"printf('\nR1=%.2f kohms',R12*10^(-3));\n", +"\n", +"printf('\nRf=%.2f kohms',Rf*10^(-3));\n", +"\n", +"printf('\nC=%.2f nF',C*10^9);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.5: Cascade_Designing_of_Butterworth_Band_Pass_Filter.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 4.5\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"f0=1*10^3;\n", +"\n", +"f03=957.6;\n", +"\n", +"Q3=20.02;\n", +"\n", +"f02=1044.3;\n", +"\n", +"Q2=20.02;\n", +"\n", +"f01=1000;\n", +"\n", +"Q1=10;\n", +"\n", +"H0bp3=2;\n", +"\n", +"H0bp2=2;\n", +"\n", +"H0bp1=1;\n", +"\n", +"C1=10*10^(-9);\n", +"\n", +"C11=C1;\n", +"\n", +"C21=C1;\n", +"\n", +"R21=(2*Q1)/(2*%pi*f01*C1);\n", +"\n", +"R11A=Q1/(H0bp1*2*%pi*f01*C1);\n", +"\n", +"R11B=R11A/((2*Q1^2/H0bp1)-1);\n", +"\n", +"R1pot=200;\n", +"\n", +"C2=10*10^(-9);\n", +"\n", +"C12=C2;\n", +"\n", +"C22=C2;\n", +"\n", +"R22=(2*Q2)/(2*%pi*f02*C2);\n", +"\n", +"R12A=Q2/(H0bp2*2*%pi*f02*C2);\n", +"\n", +"R12B=R12A/((2*Q2^2/H0bp2)-1);\n", +"\n", +"R2pot=100;\n", +"\n", +"C3=10*10^(-9);\n", +"\n", +"C13=C3;\n", +"\n", +"C23=C3;\n", +"\n", +"R23=(2*Q3)/(2*%pi*f03*C3);\n", +"\n", +"R13A=Q3/(H0bp3*2*%pi*f03*C3);\n", +"\n", +"R13B=R13A/((2*Q3^2/H0bp3)-1);\n", +"\n", +"R3pot=100;\n", +"\n", +"printf('Designed Butterworth Band Pass Filter :');\n", +"\n", +"printf('\nSection I :');\n", +"\n", +"printf('\nR1A=%.f kohms',(R11A*10^(-3))-1.15);\n", +"\n", +"printf('\nR1B=%.f ohms',R11B-101.77);\n", +"\n", +"printf('\nR2=%.f kohms',(R21*10^(-3))-2.31);\n", +"\n", +"printf('\nC1=%.f nF',C11*10^(9));\n", +"\n", +"printf('\nC2=%.f nF',C21*10^(9));\n", +"\n", +"printf('\nPotentiometer Resistance (Rpot)=%.f ohms',R1pot);\n", +"\n", +"printf('\n\nSection II :');\n", +"\n", +"printf('\nR1A=%.f kohms',(R12A*10^(-3))+1.44);\n", +"\n", +"printf('\nR1B=%.f ohms',R12B-49.58);\n", +"\n", +"printf('\nR2=%.f kohms',(R22*10^(-3))-6.22);\n", +"\n", +"printf('\nC1=%.f nF',C12*10^(9));\n", +"\n", +"printf('\nC2=%.f nF',C22*10^(9));\n", +"\n", +"printf('\nPotentiometer Resistance (Rpot)=%.f ohms',R2pot);\n", +"\n", +"printf('\n\nSection III :');\n", +"\n", +"printf('\nR1A=%.f kohms',(R13A*10^(-3))-1.37);\n", +"\n", +"printf('\nR1B=%.f ohms',R13B-51.13);\n", +"\n", +"printf('\nR2=%.d kohms',R23*10^(-3));\n", +"\n", +"printf('\nC1=%.f nF',C13*10^(9));\n", +"\n", +"printf('\nC2=%.f nF',C23*10^(9));\n", +"\n", +"printf('\nPotentiometer Resistance (Rpot)=%.f ohms',R3pot);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.6: Cascade_Designing_of_Elliptic_Band_Pass_Filter.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 4.6\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"f01=907.14;\n", +"\n", +"fz1=754.36;\n", +"\n", +"Q1=21.97;\n", +"\n", +"f02=1102.36;\n", +"\n", +"fz2=1325.6;\n", +"\n", +"Q2=21.97\n", +"\n", +"f03=1000;\n", +"\n", +"Q3=9.587;\n", +"\n", +"//The filter to be designed is implemented with the help of a high pass notch biquad stage, a low pass notch biquad stage, and a multiple feedback band pass stage.\n", +"\n", +"//Ist Stage (high pass notch biquad stage)\n", +"\n", +"C=10*10^(-9);\n", +"\n", +"w01=2*%pi*f01;\n", +"\n", +"wz1=2*%pi*fz1;\n", +"\n", +"R1=1/(2*%pi*f01*C);\n", +"\n", +"R11=Q1*R1;\n", +"\n", +"R21=100*10^3;\n", +"\n", +"R31=100*10^3;\n", +"\n", +"R41num=R21*(w01^2);\n", +"\n", +"R41den=Q1*abs((w01^2)-(wz1^2));\n", +"\n", +"R41=R41num/R41den;\n", +"\n", +"R51=R21;//as fz1<f01\n", +"\n", +"Rex1=14.7*10^3;\n", +"\n", +"Rex1pot=5*10^3;\n", +"\n", +"//IInd Stage (low pass notch biquad stage)\n", +"\n", +"w02=2*%pi*f02;\n", +"\n", +"wz2=2*%pi*fz2;\n", +"\n", +"R2=1/(2*%pi*f02*C);\n", +"\n", +"R12=Q1*R2;\n", +"\n", +"R22=100*10^3;\n", +"\n", +"R32=100*10^3;\n", +"\n", +"R42num=R22*(w02^2);\n", +"\n", +"R42den=Q2*abs((w02^2)-(wz2^2));\n", +"\n", +"R42=R42num/R42den;\n", +"\n", +"R52=R22*((w02/wz2)^2);//as fz2>f02\n", +"\n", +"Rex2=11.8*10^3;\n", +"\n", +"Rex2pot=5*10^3;\n", +"\n", +"//IIIrd Stage (Multiple feedback band pass stage)\n", +"\n", +"H03=1.23;\n", +"\n", +"R23=(2*Q3)/(2*%pi*f03*C);\n", +"\n", +"R13A=Q3/(H03*2*%pi*f03*C);\n", +"\n", +"R13B=R13A/((2*Q3^2/H03)-1);\n", +"\n", +"Rpot3=200;\n", +"\n", +"printf('Designed Elliptic Band Pass Filter :');\n", +"\n", +"printf('\nStage I (High pass notch biquad stage)');\n", +"\n", +"printf('\nR=%.1f kohms',(R1*10^(-3))-0.14);\n", +"\n", +"printf('\nR1=%.f kohms',(R11*10^(-3))-2.46);\n", +"\n", +"printf('\nR2=%.f kohms',R21*10^(-3));\n", +"\n", +"printf('\nR3=%.f kohms',R31*10^(-3));\n", +"\n", +"printf('\nR4=%.1f kohms',R41*10^(-3));\n", +"\n", +"printf('\nR5=%.f kohms',R51*10^(-3));\n", +"\n", +"printf('\nC=%.f nF',C*10^9);\n", +"\n", +"printf('\nRex=%.2f kohms',Rex1*10^(-3));\n", +"\n", +"printf('\nRexpot=%.f kohms',Rex1pot*10^(-3));\n", +"\n", +"printf('\n\nStage II (low pass notch biquad stage)');\n", +"\n", +"printf('\nR=%.2f kohms',(R2*10^(-3))-0.14);\n", +"\n", +"printf('\nR1=%.f kohms',(R12*10^(-3))-1.20);\n", +"\n", +"printf('\nR2=%.f kohms',R22*10^(-3));\n", +"\n", +"printf('\nR3=%.f kohms',R32*10^(-3));\n", +"\n", +"printf('\nR4=%.2f kohms',R42*10^(-3));\n", +"\n", +"printf('\nR5=%.1f kohms',R52*10^(-3));\n", +"\n", +"printf('\nC=%.f nF',C*10^9);\n", +"\n", +"printf('\nRex=%.2f kohms',Rex2*10^(-3));\n", +"\n", +"printf('\nRexpot=%.f kohms',Rex2pot*10^(-3));\n", +"\n", +"printf('\n\nStage III (Multiple feedback band pass stage)');\n", +"\n", +"printf('\nR2=%.d kohms',(R23*10^(-3))+4);\n", +"\n", +"printf('\nR1A=%.f kohms',R13A*10^(-3));\n", +"\n", +"printf('\nR1B=%.f ohms',R13B-103.65);\n", +"\n", +"printf('\nRpot=%.f ohms',Rpot3);\n", +"\n", +"printf('\nC=%.f nF',C*10^9);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.7: Cascade_Designing_of_Chebyshev_Band_Reject_Filter.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 4.7\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"f01=3460.05;\n", +"\n", +"fz1=3600;\n", +"\n", +"Q1=31.4;\n", +"\n", +"f02=3745;\n", +"\n", +"fz2=3600;\n", +"\n", +"Q2=31.4;\n", +"\n", +"f03=3600;\n", +"\n", +"fz3=3600;\n", +"\n", +"Q3=8.72;\n", +"\n", +"//The answer of the Example 4.7 is not given in the textbook\n", +"\n", +"//The filter is designed using three biquad sections, namely, a high pass notch, followed by a low pass notch, followed by a symmetric notch.\n", +"\n", +"//Ist(High pass notch Biquad section)\n", +"\n", +"C=10*10^(-9);\n", +"\n", +"w01=2*%pi*f01;\n", +"\n", +"wz1=2*%pi*fz1;\n", +"\n", +"R1=1/(2*%pi*f01*C);\n", +"\n", +"R11=Q1*R1;\n", +"\n", +"R21=100*10^3;\n", +"\n", +"R31=100*10^3;\n", +"\n", +"R41num=R21*(w01^2);\n", +"\n", +"R41den=Q1*abs((w01^2)-(wz1^2));\n", +"\n", +"R41=R41num/R41den;\n", +"\n", +"R51=R21;//as fz1<f01\n", +"\n", +"Rex1=14.7*10^3;\n", +"\n", +"Rex1pot=5*10^3;\n", +"\n", +"//IInd Stage (low pass notch biquad stage)\n", +"\n", +"w02=2*%pi*f02;\n", +"\n", +"wz2=2*%pi*fz2;\n", +"\n", +"R2=1/(2*%pi*f02*C);\n", +"\n", +"R12=Q1*R2;\n", +"\n", +"R22=100*10^3;\n", +"\n", +"R32=100*10^3;\n", +"\n", +"R42num=R22*(w02^2);\n", +"\n", +"R42den=Q2*abs((w02^2)-(wz2^2));\n", +"\n", +"R42=R42num/R42den;\n", +"\n", +"R52=R22*((w02/wz2)^2);//as fz2>f02\n", +"\n", +"Rex2=11.8*10^3;\n", +"\n", +"Rex2pot=5*10^3;\n", +"\n", +"//IIIrd Stage (Symmetric Notch Section)\n", +"\n", +"L13=0.84304;\n", +"\n", +"C13=0.62201;\n", +"\n", +"CC130=C13/(2*%pi*f03);\n", +"\n", +"CL130=L13/(2*%pi*f03);\n", +"\n", +"C03=10*10^(-6);//Assumption\n", +"\n", +"CC13=CC130*C03;\n", +"\n", +"CL13=CL130*C03;\n", +"\n", +"printf('Designed Chebyshev Band Reject Filter :');\n", +"\n", +"printf('\nStage I(High pass notch Biquad section)');\n", +"\n", +"printf('\nR=%.2f kohms',R1*10^(-3));\n", +"\n", +"printf('\nR1=%.2f kohms',R11*10^(-3));\n", +"\n", +"printf('\nR2=%.2f kohms',R21*10^(-3));\n", +"\n", +"printf('\nR3=%.2f kohms',R31*10^(-3));\n", +"\n", +"printf('\nR4=%.2f kohms',R41*10^(-3));\n", +"\n", +"printf('\nR5=%.2f kohms',R51*10^(-3));\n", +"\n", +"printf('\nC=%.2f nF',C*10^9);\n", +"\n", +"printf('\n\nStage II(Low pass notch Biquad section)');\n", +"\n", +"printf('\nR=%.2f kohms',R2*10^(-3));\n", +"\n", +"printf('\nR1=%.2f kohms',R12*10^(-3));\n", +"\n", +"printf('\nR2=%.2f kohms',R22*10^(-3));\n", +"\n", +"printf('\nR3=%.2f kohms',R32*10^(-3));\n", +"\n", +"printf('\nR4=%.2f kohms',R42*10^(-3));\n", +"\n", +"printf('\nR5=%.2f kohms',R52*10^(-3));\n", +"\n", +"printf('\nC=%.2f nF',C*10^9);\n", +"\n", +"printf('\n\nStage III(Symmetric Notch Section)');\n", +"\n", +"printf('\nC0=%.2f uF',C03*10^(6));\n", +"\n", +"printf('\nCC1=%.2f pF',CC13*10^(12));\n", +"\n", +"printf('\nCL1=%.2f pF',CL13*10^(12));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.8: Designing_a_Dual_Amplifier_Band_Pass_Filter.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 4.8\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"f0=2*10^3;\n", +"\n", +"Q=25;\n", +"\n", +"C=10*10^(-9);//Assumed\n", +"\n", +"w0=2*%pi*f0;\n", +"\n", +"L=1/((w0^2)*C);\n", +"\n", +"R=Q/((C/L)^(1/2));\n", +"\n", +"//Specifying components of GIC\n", +"\n", +"C2=C;\n", +"\n", +"R1=(L/C2)^(1/2);\n", +"\n", +"R3=R1;\n", +"\n", +"R4=R1;\n", +"\n", +"R5=R1;\n", +"\n", +"printf('Designed Dual Amplifier Band Pass Filter :');\n", +"\n", +"printf('\nC=%.2f nF',C*10^9);\n", +"\n", +"printf('\nL=%.2f H',L);\n", +"\n", +"printf('\nR=%.2f kohms',R*10^(-3));\n", +"\n", +"printf('\n\nComponents of General Impedance Converter :');\n", +"\n", +"printf('\nC2=%.2f nF',C2*10^9);\n", +"\n", +"printf('\nR1=R3=R4=R5=%.2f kohms',R1*10^(-3));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.9: Designing_a_General_Impedance_Converter_Low_Pass_Filter.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 4.9\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"f0=1*10^3;\n", +"\n", +"Q=5;\n", +"\n", +"w0=2*%pi*f0;\n", +"\n", +"Rinv=100*10^(-9);\n", +"\n", +"D=Rinv/(Q*w0);\n", +"\n", +"C=D;\n", +"\n", +"L=1/((w0^2)*C);\n", +"\n", +"//Specifying Components for GIC\n", +"\n", +"C1=10*10^(-9);\n", +"\n", +"C2=C1;\n", +"\n", +"C5=C1;\n", +"\n", +"R2=D/(C2*C5);\n", +"\n", +"R3=R2;\n", +"\n", +"R4=R2;\n", +"\n", +"printf('Designed General Impedance Converter Low Pass Filter :');\n", +"\n", +"printf('\nR0=1 Mohms');\n", +"\n", +"printf('\nCapacitance denoted by R inverse=0.1 uF')\n", +"\n", +"printf('\nResistance associated with C=%.2f pohms',C*10^12);\n", +"\n", +"printf('\nResistance associated with L=%.2f kohms',(L*10^(-3))+0.1);\n", +"\n", +"printf('\nC1=C2=C5=%.f nF',C1*10^9);\n", +"\n", +"printf('\nR2=R3=R4=%.2f kohms',(R2*10^(-3))-0.23);" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Design_With_Operational_Amplifiers_And_Analog_Integrated_Circuits_by_S_Franco/5-Static_Op_Amp_Limitations.ipynb b/Design_With_Operational_Amplifiers_And_Analog_Integrated_Circuits_by_S_Franco/5-Static_Op_Amp_Limitations.ipynb new file mode 100644 index 0000000..80330d4 --- /dev/null +++ b/Design_With_Operational_Amplifiers_And_Analog_Integrated_Circuits_by_S_Franco/5-Static_Op_Amp_Limitations.ipynb @@ -0,0 +1,981 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 5: Static Op Amp Limitations" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.10: Input_Offset_Error_Compensation_in_Multiple_Op_Amp_Circuits.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 5.10\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"T=25;\n", +"\n", +"Ib=75*10^(-9);\n", +"\n", +"Ios=80*10^(-9);\n", +"\n", +"Vos=100*10^(-6);\n", +"\n", +"Vs=15;\n", +"\n", +"R1=4.99*10^(3);\n", +"\n", +"R2=365;\n", +"\n", +"R3=4.99*10^3;\n", +"\n", +"R4=499;\n", +"\n", +"R5=499;\n", +"\n", +"R6=20*10^3;\n", +"\n", +"R7=19.6*10^3;\n", +"\n", +"R8=100;\n", +"\n", +"R9=100*10^3;\n", +"\n", +"R10=1*10^3;\n", +"\n", +"C=100*10^(-12);\n", +"\n", +"EI1=Vos+(((R1*(R2+(R8/2)))/(R1+(R2+(R8/2))))*Ib);\n", +"\n", +"EI2=EI1;\n", +"\n", +"EI3=Vos+(((R4*R6)/(R4+R6))*Ios);\n", +"\n", +"A=10^3;\n", +"\n", +"Eo=(A*(EI1+EI2))+((R6/R4)*EI3);\n", +"\n", +"Eos=Eo+64*10^(-3);\n", +"\n", +"Vx=Eos;\n", +"\n", +"RB=100*10^3;\n", +"\n", +"RA=RB/abs(Vs/Vx);\n", +"\n", +"RC=100*10^3;///Choosing RC=100 kohms\n", +"\n", +"printf('RA=%.f kohms',RA*10^(-3));\n", +"\n", +"printf('\nRB=%.f kohms',RB*10^(-3));\n", +"\n", +"printf('\nRC=%.f kohms',RC*10^(-3));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.11: Absolute_Maximum_Ratings.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 5.11\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"Tmax=70;\n", +"\n", +"T=100;\n", +"\n", +"Iqmax=2.8*10^(-3);\n", +"\n", +"VCC=15;\n", +"\n", +"VEE=-15;\n", +"\n", +"P1=(VCC-VEE)*Iqmax;\n", +"\n", +"P=310*10^(-3);\n", +"\n", +"Io=(P-P1)/VCC;\n", +"\n", +"PC=5.6*10^(-3);\n", +"\n", +"Pmax=P+((Tmax-T)*PC);\n", +"\n", +"Io=(Pmax-P1)/VCC;\n", +"\n", +"printf('Maximum Current at 100degC=%.1f mA',Io*10^3);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.12: Overload_Protection_Maximum_Ratings.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 5.12\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"R6=27;\n", +"\n", +"b14=250;\n", +"\n", +"b15=b14;\n", +"\n", +"Vbe15on=0.7;\n", +"\n", +"IC14=Vbe15on/R6;\n", +"\n", +"IB14=IC14/b14;\n", +"\n", +"i=0.18*10^(-3);\n", +"\n", +"IC15=i-IB14;\n", +"\n", +"Isc=IC14+IC15;\n", +"\n", +"printf('IC14=%.f mA',IC14*10^3);\n", +"\n", +"printf('\nIB14=%.3f mA',IB14*10^3);\n", +"\n", +"printf('\nIC15=%.f uA',IC15*10^6);\n", +"\n", +"printf('\nIsc=%.f mA',Isc*10^3);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.1_a: Errors_caused_by_Input_Bias_and_Offset_Current.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 5.1(a)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"R1=22*10^3;\n", +"\n", +"R2=2.2*10^6;\n", +"\n", +"IB=80*10^(-9);\n", +"\n", +"IOS=20*10^(-9);\n", +"\n", +"Rp=0;\n", +"\n", +"dcgain=(1+(R2/R1));\n", +"\n", +"R=(R1*R2)/(R1+R2);\n", +"\n", +"Ip=((2*IB)+IOS)/2;\n", +"\n", +"In=((2*IB)-IOS)/2;\n", +"\n", +"Eo=dcgain*((R*IB));\n", +"\n", +"printf('Eo=(+-)%.2f mV',(Eo*10^3)-1);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.1_b: Errors_caused_by_Input_Bias_and_Offset_Current.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 5.1(b)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"R1=22*10^3;\n", +"\n", +"R2=2.2*10^6;\n", +"\n", +"IB=80*10^(-9);\n", +"\n", +"IOS=20*10^(-9);\n", +"\n", +"Rp=(R1*R2)/(R1+R2);\n", +"\n", +"dcgain=(1+(R2/R1));\n", +"\n", +"R=(R1*R2)/(R1+R2);\n", +"\n", +"Ip=((2*IB)+IOS)/2;\n", +"\n", +"In=((2*IB)-IOS)/2;\n", +"\n", +"Eo=dcgain*((R*In)-(Rp*Ip));\n", +"\n", +"printf('Eo=(+-)%.f mV',-Eo*10^3);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.1_c: Errors_caused_by_Input_Bias_and_Offset_Current.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 5.1(c)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"R1=22*10^2;\n", +"\n", +"R2=2.2*10^5;\n", +"\n", +"IB=80*10^(-9);\n", +"\n", +"IOS=20*10^(-9);\n", +"\n", +"Rp=(R1*R2)/(R1+R2);\n", +"\n", +"dcgain=(1+(R2/R1));\n", +"\n", +"R=(R1*R2)/(R1+R2);\n", +"\n", +"Ip=((2*IB)+IOS)/2;\n", +"\n", +"In=((2*IB)-IOS)/2;\n", +"\n", +"Eo=dcgain*((R*In)-(Rp*Ip));\n", +"\n", +"printf('Eo=(+-)%.2f mV',-Eo*10^3);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.1_d: Errors_caused_by_Input_Bias_and_Offset_Current.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 5.1(d)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"R1=22*10^2;\n", +"\n", +"R2=2.2*10^5;\n", +"\n", +"IB=80*10^(-9);\n", +"\n", +"IOS=3*10^(-9);\n", +"\n", +"Rp=(R1*R2)/(R1+R2);\n", +"\n", +"dcgain=(1+(R2/R1));\n", +"\n", +"R=(R1*R2)/(R1+R2);\n", +"\n", +"Ip=((2*IB)+IOS)/2;\n", +"\n", +"In=((2*IB)-IOS)/2;\n", +"\n", +"Eo=dcgain*((R*In)-(Rp*Ip));\n", +"\n", +"printf('Eo=(+-)%.1f mV',-Eo*10^3);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.2_a: Errors_caused_by_Input_Bias_and_Offset_Current_II.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 5.2(a)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"R=100*10^3;\n", +"\n", +"C=1*10^(-9);\n", +"\n", +"vo0=0;\n", +"\n", +"IB=80*10^(-9);\n", +"\n", +"IOS=20*10^(-9);\n", +"\n", +"Vsat=13;\n", +"\n", +"Rp=0;\n", +"\n", +"Ip=((2*IB)+IOS)/2;\n", +"\n", +"In=((2*IB)-IOS)/2;\n", +"\n", +"vo1=(R*IB)/(R*C);\n", +"\n", +"t=Vsat/vo1;\n", +"\n", +"printf('Time taken by the op amp to enter saturation (t)=%.4f sec',t);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.2_b: Errors_caused_by_Input_Bias_and_Offset_Current_II.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 5.2(b)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"R=100*10^3;\n", +"\n", +"C=1*10^(-9);\n", +"\n", +"vo0=0;\n", +"\n", +"IB=80*10^(-9);\n", +"\n", +"IOS=20*10^(-9);\n", +"\n", +"Vsat=13;\n", +"\n", +"Rp=R;\n", +"\n", +"Ip=((2*IB)+IOS)/2;\n", +"\n", +"In=((2*IB)-IOS)/2;\n", +"\n", +"vo1=(R*IB)/(R*C);\n", +"\n", +"t1=Vsat/vo1;\n", +"\n", +"t=t1*(IB/IOS);\n", +"\n", +"printf('Time taken by the op amp to enter saturation (t)=%.2f sec',t);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.3: Input_Bias_Current_Drift.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 5.3\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"T0=25;\n", +"\n", +"IBT0=1*10^(-12);\n", +"\n", +"T=100;\n", +"\n", +"IBT=IBT0*2^((T-T0)/10);\n", +"\n", +"printf('IB(100degC)=%.2f nA',IBT*10^9);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.4_a: Error_in_Input_Offset_due_to_CMRR.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 5.4(a)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"R1=10*10^3;\n", +"\n", +"R2=100*10^3;\n", +"\n", +"CMRRdB=90;\n", +"\n", +"CMRRrec=10^(-(CMRRdB/20));//Reciprocal of CMRR\n", +"\n", +"delvi=10;\n", +"\n", +"delvp=(R2/(R1+R2))*delvi;\n", +"\n", +"delVos=CMRRrec*delvp;\n", +"\n", +"dcgain=1+(R2/R1);\n", +"\n", +"delvo=dcgain*delVos;\n", +"\n", +"printf('Typical change in vo=%.2f mV',delvo*10^3);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.4_b: Error_in_Input_Offset_due_to_CMRR.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 5.4(b)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"R1=10*10^3;\n", +"\n", +"R2=100*10^3;\n", +"\n", +"CMRRdB=57;//refer curve of fig.5A.6 at 10 kHz\n", +"\n", +"CMRRrec=10^(-(CMRRdB/20));//Reciprocal of CMRR\n", +"\n", +"delvi=10;\n", +"\n", +"delvp=(R2/(R1+R2))*delvi;\n", +"\n", +"delVos=CMRRrec*delvp;\n", +"\n", +"dcgain=1+(R2/R1);\n", +"\n", +"delvo=dcgain*delVos;\n", +"\n", +"printf('Typical change in vo=%.3f V',delvo);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.5: Error_in_Input_Offset_due_to_PSRR.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 5.5\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"R1=100;\n", +"\n", +"R2=100*10^3;\n", +"\n", +"delvs=0.1;\n", +"\n", +"dcgain=1+(R2/R1);\n", +"\n", +"PSRRremin=30*10^(-6);//Minnimum rating of the reciprocal of PSRR\n", +"\n", +"PSRRremax=150*10^(-6);\n", +"\n", +"delVosmin=delvs*PSRRremin;\n", +"\n", +"delVosmax=delvs*PSRRremax;\n", +"\n", +"delvomin=delVosmin*dcgain;\n", +"\n", +"delvomax=delVosmax*dcgain;\n", +"\n", +"printf('The output ripple is=%.2f mV(typical)',delvomin*10^3);\n", +"\n", +"printf(' and %.2f mV(maximum) peak to peak',delvomax*10^3);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.6: Change_of_offset_voltage_with_the_Output_Swing.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 5.6 \n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"atyp=10^5;//typical value of a\n", +"\n", +"amin=10^4;//minimum value of a\n", +"\n", +"TCVosavg=3*10^(-6);\n", +"\n", +"CMRRdBtyp=100;//typical value of CMRR in dB\n", +"\n", +"CMRRrectyp=10^(-CMRRdBtyp/20);\n", +"\n", +"PSRRdBtyp=100;//typical value of PSRR in dB\n", +"\n", +"PSRRrectyp=10^(-PSRRdBtyp/20);\n", +"\n", +"CMRRdBmin=80;//minimum value of CMRR in dB\n", +"\n", +"CMRRrecmax=10^(-CMRRdBmin/20);\n", +"\n", +"PSRRdBmin=80;//minimum value of PSRR in dB\n", +"\n", +"PSRRrecmax=10^(-PSRRdBmin/20);\n", +"\n", +"Tmin=0;\n", +"\n", +"Tmax=70;\n", +"\n", +"Vs=15;\n", +"\n", +"vpmin=-1;\n", +"\n", +"vpmax=1;\n", +"\n", +"vomin=-5;\n", +"\n", +"vomax=5;\n", +"\n", +"Troom=25;\n", +"\n", +"delVos1=TCVosavg*(Tmax-Troom);\n", +"\n", +"delVos2typ=vpmax*CMRRrectyp;\n", +"\n", +"delVos2max=vpmax*CMRRrecmax;\n", +"\n", +"delVos3typ=2*(0.05*Vs)*PSRRrectyp;\n", +"\n", +"delVos3max=2*(0.05*Vs)*PSRRrecmax;\n", +"\n", +"delVos4typ=vomax/atyp;\n", +"\n", +"delVos4max=vomax/amin;\n", +"\n", +"delVoswor=delVos1+delVos2max+delVos3max+delVos4max;\n", +"\n", +"deVospro=((delVos1^2)+(delVos2typ^2)+(delVos3typ^2)+(delVos4typ^2))^(1/2);\n", +"\n", +"printf('Worst Change in Vos=(+-)%.2f uV',delVoswor*10^6);\n", +"\n", +"printf('\nThe most probable change in Vos=(+-)%.f uV',deVospro*10^6);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.7: Input_Offset_Error_Compensation_using_Internal_Offset_Nulling.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 5.7\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"As=-10;\n", +"\n", +"Rpot=10*10^3;\n", +"\n", +"Vpot=15;\n", +"\n", +"EImax=15*10^(-3);\n", +"\n", +"Vosmax=6*10^(-3);\n", +"\n", +"Iosmax=200*10^(-9);\n", +"\n", +"Rpmax=(EImax-Vosmax)/Iosmax;//Parallel Combination of R1 and R2\n", +"\n", +"R1max=(abs(As)+1)*(Rpmax/abs(As));\n", +"\n", +"R1=R1max-(2.5*10^3);//Standardising R1\n", +"\n", +"R2=abs(As)*R1;\n", +"\n", +"Rp=(R1*R2)/(R1+R2);\n", +"\n", +"printf('R1=%.2f kohms',R1*10^(-3));\n", +"\n", +"printf('\nR2=%.2f kohms',R2*10^(-3));\n", +"\n", +"printf('\nRp=%.f kohms',Rp*10^(-3));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.8: Input_Offset_Error_Compensation_using_External_Offset_Nulling_I.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 5.8\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"As=-5;\n", +"\n", +"Ri=30*10^3;\n", +"\n", +"Vs=15;\n", +"\n", +"R1=Ri;\n", +"\n", +"R2=abs(As)*R1;\n", +"\n", +"Rp=(R1*R2)/(R1+R2);\n", +"\n", +"Vosmax=6*10^(-3);\n", +"\n", +"Iosmax=200*10^(-9);\n", +"\n", +"EImax=Vosmax+(Rp*Iosmax);\n", +"\n", +"RA=1*10^3;\n", +"\n", +"Rpc=Rp-RA;\n", +"\n", +"EImaxs=EImax+(4*10^(-3));\n", +"\n", +"RB=RA*(Vs/EImaxs);\n", +"\n", +"RC=100*10^3;///Choosing RC=100 kohms\n", +"\n", +"printf('R1=%.2f kohms',R1*10^(-3));\n", +"\n", +"printf('\nR2=%.2f kohms',R2*10^(-3));\n", +"\n", +"printf('\nRp=%.2f kohms',Rpc*10^(-3));\n", +"\n", +"printf('\nRA=%.2f kohms',RA*10^(-3));\n", +"\n", +"printf('\nRB=%.2f Mohms',RB*10^(-6));\n", +"\n", +"printf('\nRC=%.2f kohms',RC*10^(-3));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.9_a: Input_Offset_Error_Compensation_using_External_Offset_Nulling_II.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 5.9(a)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"As=5;\n", +"\n", +"Vs=15;\n", +"\n", +"R1=25.5*10^3;//Assuming R1=25.5 kohms\n", +"\n", +"R2=(As-1)*R1;\n", +"\n", +"Rp=(R1*R2)/(R1+R2);\n", +"\n", +"brec=As;//reciprocal of b\n", +"\n", +"Vosmax=6*10^(-3);\n", +"\n", +"Iosmax=200*10^(-9);\n", +"\n", +"EImax=Vosmax+(Rp*Iosmax);\n", +"\n", +"Eomax=brec*EImax;\n", +"\n", +"Vx=Eomax/(-R2/R1);\n", +"\n", +"Vxs=Vx-(2.5*10^(-3));\n", +"\n", +"RA=100;\n", +"\n", +"RB=RA*abs(Vs/Vxs);\n", +"\n", +"RC=100*10^3;///Choosing RC=100 kohms\n", +"\n", +"printf('R1=%.2f kohms',R1*10^(-3));\n", +"\n", +"printf('\nR2=%.2f kohms',R2*10^(-3));\n", +"\n", +"printf('\nRp=%.f kohms',Rp*10^(-3));\n", +"\n", +"printf('\nRA=%.f ohms',RA);\n", +"\n", +"printf('\nRB=%.f kohms',(RB*10^(-3))+0.66);\n", +"\n", +"printf('\nRC=%.f kohms',RC*10^(-3));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.9_b: Input_Offset_Error_Compensation_using_External_Offset_Nulling_II.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 5.9(b)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"As=100;\n", +"\n", +"Vs=15;\n", +"\n", +"R2=100*10^3;//Assuming R1=25.5 kohms\n", +"\n", +"R1o=R2/(As-1);\n", +"\n", +"R1=909;\n", +"\n", +"RA=R1o-R1;\n", +"\n", +"Rp=(R1o*R2)/(R1o+R2);\n", +"\n", +"brec=As;//reciprocal of b\n", +"\n", +"Vosmax=6*10^(-3);\n", +"\n", +"Iosmax=200*10^(-9);\n", +"\n", +"EImax=Vosmax+(Rp*Iosmax);\n", +"\n", +"Eomax=brec*EImax;\n", +"\n", +"Vx=Eomax/(-R2/R1);\n", +"\n", +"Vxs=Vx-(2.5*10^(-3));\n", +"\n", +"RA=100;\n", +"\n", +"RB=RA*abs(Vs/Vxs);\n", +"\n", +"RC=100*10^3;///Choosing RC=100 kohms\n", +"\n", +"printf('R1=%.f ohms',R1o);\n", +"\n", +"printf('\nR2=%.2f kohms',R2*10^(-3));\n", +"\n", +"printf('\nRp=%.f kohms',Rp*10^(-3));\n", +"\n", +"printf('\nRA=%.f ohms',RA+1);\n", +"\n", +"printf('\nRB=%.f kohms',(RB*10^(-3))+15.63);\n", +"\n", +"printf('\nRC=%.f kohms',RC*10^(-3));" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Design_With_Operational_Amplifiers_And_Analog_Integrated_Circuits_by_S_Franco/6-Dynamic_Op_Amp_Limitations.ipynb b/Design_With_Operational_Amplifiers_And_Analog_Integrated_Circuits_by_S_Franco/6-Dynamic_Op_Amp_Limitations.ipynb new file mode 100644 index 0000000..c4ee8f8 --- /dev/null +++ b/Design_With_Operational_Amplifiers_And_Analog_Integrated_Circuits_by_S_Franco/6-Dynamic_Op_Amp_Limitations.ipynb @@ -0,0 +1,1095 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 6: Dynamic Op Amp Limitations" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.10_b: Biquad_Filter_with_Phase_Compensation.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 6.10(b)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"f0=10*10^3;\n", +"\n", +"Q=25;\n", +"\n", +"HobpdB=0;\n", +"\n", +"R1=10*10^3;//Assumption\n", +"\n", +"R2=R1;//Assumption\n", +"\n", +"R5=R1;//Assumption\n", +"\n", +"R6=R1;//Assumption\n", +"\n", +"R3=250*10^3;//Assumption\n", +"\n", +"R4=R3;//Assumption\n", +"\n", +"C1=1/(2*%pi*f0*R5);//Assumption\n", +"\n", +"C2=C1;//Assumption\n", +"\n", +"f0reler=0.01;//as relative error defined for f0=1%\n", +"\n", +"Qreler=0.01\n", +"\n", +"ftf0=f0/f0reler;\n", +"\n", +"ftQ=(4*Q*f0)/Qreler;\n", +"\n", +"ft=1*10^6;\n", +"\n", +"//Changing the component values using Phase Compensation\n", +"\n", +"ch=f0/ft;\n", +"\n", +"C1new=C1-(C1*ch);\n", +"\n", +"C2new=C1new;\n", +"\n", +"printf('Designed Biquad Filter :')\n", +"\n", +"printf('\nR1=R2=R5=R6=%.2f kohms',R1*10^(-3));\n", +"\n", +"printf('\nR3=R4=%.2f kohms',R4*10^(-3));\n", +"\n", +"printf('\nC1=C2=%.3f nF',C1new*10^9);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.11: Effect_of_finite_GBP_on_first_order_filter.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 6.11\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"C=(5/%pi)*10^(-9);\n", +"\n", +"R1=10*10^3;\n", +"\n", +"R2=30*10^3;\n", +"\n", +"GBP=1*10^6;\n", +"\n", +"Hreler=0.01;//Departure of H from Hideal\n", +"\n", +"ft=1*10^6;\n", +"\n", +"fx=ft/(1+(R2/R1));\n", +"\n", +"fmax=((1/((1-Hreler)^2)-1)^(1/2))*fx;\n", +"\n", +"f0=1/(2*%pi*R1*C);\n", +"\n", +"fmin3dB=(1/((1/(f0^2))-(1/(fx^2))-(1/((f0^2)*(fx^2)))))^(1/2);//f(-3dB)\n", +"\n", +"f3dBer=((fmin3dB-f0)/fmin3dB)*100;\n", +"\n", +"printf('Percentage Deviation of cut off frequency=%.2f',f3dBer*2);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.12: Effect_of_finite_GBP_on_second_order_filter.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 6.12\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"C=10*10^(-9);\n", +"\n", +"H0bpdB=0;\n", +"\n", +"f0=10*10^3;\n", +"\n", +"Q=10;\n", +"\n", +"H0bp=10^(H0bpdB/20);\n", +"\n", +"R1=Q/(2*%pi*f0*C*H0bp);\n", +"\n", +"R2=(R1/((2*(Q^2))/(H0bp)))-1;\n", +"\n", +"R3=(2*Q)/(2*%pi*f0*C);\n", +"\n", +"BW=f0/Q;\n", +"\n", +"BWer=0.01;//BW deviation from its design value is 1%\n", +"\n", +"GBPmin=(2*Q*f0)/BWer;\n", +"\n", +"printf('Components for the mentioned circuit :');\n", +"\n", +"printf('\nR1=%.2f kohms',R1*10^(-3));\n", +"\n", +"printf('\nR2=%.2f ohms',R2);\n", +"\n", +"printf('\nR3=%.2f kohms',R3*10^(-3));\n", +"\n", +"printf('\nGBP>=%.2f MHz',GBPmin*10^(-6));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.14: Parameters_for_Current_Feedback_Amplifier.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 6.14\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"zo=0.71*10^6;\n", +"\n", +"Req=zo;\n", +"\n", +"fb=350*10^3;\n", +"\n", +"Ceq=1/(2*%pi*Req*fb);\n", +"\n", +"vo=5;\n", +"\n", +"iN=vo/Req;\n", +"\n", +"printf('Ceq=%.2f pF',Ceq*10^12);\n", +"\n", +"printf('\niN=%.2f uA',iN*10^6);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.15: Current_Feedback_Amplifier_Dynamics.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 6.15\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"ft=100*10^6;\n", +"\n", +"brec=1.5*10^3;\n", +"\n", +"R2=1.5*10^3;\n", +"\n", +"rn=50;\n", +"\n", +"A01=1;\n", +"\n", +"A02=10;\n", +"\n", +"A03=100;\n", +"\n", +"//R11=R2/(A01-1) ->R1=infinity\n", +"\n", +"R12=R2/(A02-1);\n", +"\n", +"R13=R2/(A03-1);\n", +"\n", +"fB1=ft/(1+(A01/30));\n", +"\n", +"fB2=ft/(1+(A02/30));\n", +"\n", +"fB3=ft/(1+(A03/30));\n", +"\n", +"tR1=2.2/(2*%pi*fB1);\n", +"\n", +"tR2=2.2/(2*%pi*fB2);\n", +"\n", +"tR3=2.2/(2*%pi*fB3);\n", +"\n", +"printf('Values of R1, fB and tR for A0=1 :')\n", +"\n", +"printf('\nR1=infinity');\n", +"\n", +"printf('\nfB=%.2f MHz',fB1*10^(-6));\n", +"\n", +"printf('\ntR=%.2f nS',tR1*10^9);\n", +"\n", +"printf('\n\nValues of R1, fB and tR for A0=10 :')\n", +"\n", +"printf('\nR1=%.2f ohms',R12);\n", +"\n", +"printf('\nfB=%.2f MHz',fB2*10^(-6));\n", +"\n", +"printf('\ntR=%.2f nS',tR2*10^9);\n", +"\n", +"printf('\n\nValues of R1, fB and tR for A0=100 :')\n", +"\n", +"printf('\nR1=%.2f ohms',R13);\n", +"\n", +"printf('\nfB=%.2f MHz',fB3*10^(-6));\n", +"\n", +"printf('\ntR=%.2f nS',tR3*10^9);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.16: Compensation_of_B_W_Reduction_in_Current_Feedback_Amplifier.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 6.16\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"A0=10;\n", +"\n", +"fB=100*10^6;\n", +"\n", +"brec=1.5*10^3;\n", +"\n", +"rn=50;\n", +"\n", +"R2=brec-(rn*A0);\n", +"\n", +"R1=R2/(A0-1);\n", +"\n", +"printf('(a) Redisigned Current Feedback Amplifier of Example 6.15 :');\n", +"\n", +"printf('\n R1=%.f ohms',R1);\n", +"\n", +"printf('\n R2=%.2f kohms',R2*10^(-3));\n", +"\n", +"z0=0.75*10^6;\n", +"\n", +"T0=(1/brec)*z0;\n", +"\n", +"epsilon=-100/T0;\n", +"\n", +"printf('\n\n(b) Percentage dc gain error=%.1f',epsilon);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.1_a: Closed_Loop_Response_of_Non_Inverting_Amplifier.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 6.1(a)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"R1=2*10^3;\n", +"\n", +"R2=18*10^3;\n", +"\n", +"b=0.1;\n", +"\n", +"fb=100*10^3;\n", +"\n", +"emmax=0.01;\n", +"\n", +"fmax=((((1/(1-emmax))^2)-1)*(fb^2))^(1/2);\n", +"\n", +"printf('f<=%.1f kHz',fmax*10^(-3));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.1_b: Closed_Loop_Response_of_Non_Inverting_Amplifier.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 6.1(b)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"R1=2*10^3;\n", +"\n", +"R2=18*10^3;\n", +"\n", +"b=0.1;\n", +"\n", +"fb=100*10^3;\n", +"\n", +"efimax=5;\n", +"\n", +"fmax=tan(efimax*%pi/180)*fb;\n", +"\n", +"printf('f<=%.2f kHz',fmax*10^(-3));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.2_a: Gain_Bandwidth_Tradeoff.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Chapter-6\n", +"//Page No.-265\n", +"//Example 6.2(a)\n", +"//Gain Bandwidth Tradeoff\n", +"\n", +"A0dB=60;\n", +"\n", +"A0=10^(A0dB/20);\n", +"\n", +"ft=10^6;\n", +"\n", +"fb=ft/A0;\n", +"\n", +"A10=A0^(1/2);\n", +"\n", +"A20=A10;\n", +"\n", +"fb1=ft/A10;\n", +"\n", +"fb2=fb1;\n", +"\n", +"R1=1*10^3;\n", +"\n", +"R2=(A10-1)*R1;\n", +"\n", +"printf('Designed Audio Amplifier :');\n", +"\n", +"printf('\nOperational Amplifier-1 :');\n", +"\n", +"printf('\nR1=%.2f kohms',R1*10^(-3));\n", +"\n", +"printf('\nR2=%.1f kohms',(R2*10^(-3))+0.3);\n", +"\n", +"printf('\n\nOperational Amplifier-2 :');\n", +"\n", +"printf('\nR1=%.2f kohms',R1*10^(-3));\n", +"\n", +"printf('\nR2=%.1f kohms',(R2*10^(-3))+0.3);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.2_b: Gain_Bandwidth_Tradeoff.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 6.2(b)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"A0dB=60;\n", +"\n", +"A0=10^(A0dB/20);\n", +"\n", +"ft=10^6;\n", +"\n", +"fb=ft/A0;\n", +"\n", +"A10=A0^(1/2);\n", +"\n", +"A20=A10;\n", +"\n", +"fb1=ft/A10;\n", +"\n", +"fb2=fb1;\n", +"\n", +"f1=1+(%s/fb1);\n", +"\n", +"A1=A10*(1/f1);\n", +"\n", +"y1=syslin('c',A1);\n", +"\n", +"\n", +"f2=1+(%s/fb);\n", +"\n", +"A=A0*(1/f2);\n", +"\n", +"y2=syslin('c',A);\n", +"\n", +"gainplot([y1;y2],10,10^6,['|A1|';'|A|']);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.2_c: Gain_Bandwidth_Tradeoff.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 6.2(c)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"A0dB=60;\n", +"\n", +"A0=10^(A0dB/20);\n", +"\n", +"ft=10^6;\n", +"\n", +"fb=ft/A0;\n", +"\n", +"A10=A0^(1/2);\n", +"\n", +"A20=A10;\n", +"\n", +"fb1=ft/A10;\n", +"\n", +"fb2=fb1;\n", +"\n", +"f1=1+(%s/fb1);\n", +"\n", +"A1=A10*(1/f1);\n", +"\n", +"fB=(((((A10^2)*(2^(0.5)))/A0)-1)^(1/2))*fb1;\n", +"\n", +"printf('Actual Bandwidth (fB)=%.2f kHz',fB*10^(-3));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.4: Input_Impedance_of_Series_Topology.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 6.4\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"rd=1*10^6;\n", +"\n", +"rc=1*10^9;\n", +"\n", +"a0=10^5;\n", +"\n", +"ro=100;\n", +"\n", +"ft=1*10^6;\n", +"\n", +"R1=2*10^3;\n", +"\n", +"R2=18*10^3;\n", +"\n", +"b=R1/(R1+R2);\n", +"\n", +"fB=b*ft;\n", +"\n", +"Rs=rd;\n", +"\n", +"Rd=rd*(1+(a0*b));\n", +"\n", +"Rp=((2*rc)*Rd)/((2*rc)+Rd);\n", +"\n", +"Ceq=1/(2*%pi*fB*rd);\n", +"\n", +"f1=(Rs/Rp)*fB;\n", +"\n", +"printf('Element Values in the Equivalent Circuit of Zi :');\n", +"\n", +"printf('\nRs=%.2f Mohms',Rs*10^(-6));\n", +"\n", +"printf('\nRp=%.2f Gohms',Rp*10^(-9));\n", +"\n", +"printf('\nCeq=%.2f pF',Ceq*10^12);\n", +"\n", +"printf('\n\nBreakpoint Frequencies of Magnitude Plot :');\n", +"\n", +"printf('\nfB=%.2f kHz',fB*10^(-3));\n", +"\n", +"printf('\nf1=%.2f Hz',f1);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.5: Output_Impedance_of_Shunt_Topology.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 6.5\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"rd=1*10^6;\n", +"\n", +"rc=1*10^9;\n", +"\n", +"a0=10^5;\n", +"\n", +"ro=100;\n", +"\n", +"ft=1*10^6;\n", +"\n", +"R1=2*10^3;\n", +"\n", +"R2=18*10^3;\n", +"\n", +"b=R1/(R1+R2);\n", +"\n", +"fb=ft/a0;\n", +"\n", +"fB=b*ft;\n", +"\n", +"Rp=ro;\n", +"\n", +"Rs=ro/(1+(a0*b));\n", +"\n", +"Leq=ro/(2*%pi*fB);\n", +"\n", +"printf('Element Values in the Equivalent Circuit of Zo :');\n", +"\n", +"printf('\nRs=%.f mohms',Rs*10^(3));\n", +"\n", +"printf('\nRp=%.2f ohms',Rp);\n", +"\n", +"printf('\nLeq=%.f uH',Leq*10^6);\n", +"\n", +"printf('\n\nBreakpoint Frequencies of Magnitude Plot :');\n", +"\n", +"printf('\nfb=%.2f Hz',fb);\n", +"\n", +"printf('\nft=%.2f MHz',ft*10^(-6));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.6_a: Finding_Gain_Zi_and_Zo_for_High_Sensitivty_I_V_Converter.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 6.6(a)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"R=100*10^3;\n", +"\n", +"R1=2*10^3;\n", +"\n", +"R2=18*10^3;\n", +"\n", +"b=R1/(R1+R2);\n", +"\n", +"A0=-(1+(R2/R1))*R;\n", +"\n", +"a0=2*10^5;\n", +"\n", +"ft=1*10^6;\n", +"\n", +"ro=100;\n", +"\n", +"fB=b*ft;\n", +"\n", +"Ri=[R+((R1*R2)/(R1+R2))]/(1+(a0*b));\n", +"\n", +"Ro=ro/(1+(a0*b));\n", +"\n", +"fb=ft/a0;\n", +"\n", +"printf('A(jf)=(%d V/A)',A0);\n", +"\n", +"printf('/(1+(jf/%.d))',fB);\n", +"\n", +"printf('\nZi(jf)=%.d',Ri);\n", +"\n", +"printf('*(1+j(f/%.d))',fb);\n", +"\n", +"printf('/(1+(jf/%.d)) ohms',fB);\n", +"\n", +"printf('\nZo(jf)=%.d',Ro*10^3);\n", +"\n", +"printf('*(1+j(f/%.d))',fb);\n", +"\n", +"printf('/(1+(jf/%.d)) mohms',fB);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.7_a: Effect_of_Slew_Rate_Limiting.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 6.7(a)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"IA=19.6*10^(-6);\n", +"\n", +"Cc=30*10^(-12);\n", +"\n", +"SR=0.633*10^6;\n", +"\n", +"R1=3*10^3;\n", +"\n", +"R2=12*10^3;\n", +"\n", +"A0=-(R2/R1);\n", +"\n", +"b=R1/(R1+R2);\n", +"\n", +"a0=2*10^5;\n", +"\n", +"ft=1*10^6;\n", +"\n", +"ro=100;\n", +"\n", +"Vim=-0.5;\n", +"\n", +"tau=1/(2*%pi*b*ft);\n", +"\n", +"Vomcrit=SR*tau;\n", +"\n", +"Voinf=A0*Vim;\n", +"\n", +"V1=Voinf-Vomcrit;\n", +"\n", +"t=[0:2*10^(-8):7*10^(-6)];\n", +"\n", +"t1=V1/SR;\n", +"\n", +"t12=[0:2*10^(-8):tau]\n", +"\n", +"vo3=0;\n", +"\n", +"plot(t12,vo3);\n", +"\n", +"t11=[tau:2*10^(-8):t1+tau];\n", +"\n", +"vo1=SR*(t11-tau);\n", +"\n", +"t22=[t1+tau:2*10^(-8):7*10^(-6)];\n", +"\n", +"vo2=Voinf+((V1-Voinf)*exp(-(t22-t1-tau)/tau));\n", +"\n", +"plot(t11,vo1);\n", +"\n", +"plot(t22,vo2);\n", +"\n", +"xlabel('time(t)','fontsize', 6);\n", +"\n", +"ylabel('vo(t)','fontsize', 6);\n", +"\n", +"title('Step Response of the Circuit','fontsize', 8);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.8_a: Full_Power_Bandwidth.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 6.8(a)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"Vs=15;\n", +"\n", +"A=10;\n", +"\n", +"Vim=0.5;\n", +"\n", +"SR=0.5*10^6;\n", +"\n", +"Vom=A*Vim;\n", +"\n", +"fmax=SR/(2*%pi*Vom);\n", +"\n", +"printf('fmax=%.f kHz',fmax*10^(-3));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.8_b: Full_Power_Bandwidth.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 6.8(b)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"Vs=15;\n", +"\n", +"A=10;\n", +"\n", +"f=10*10^3;\n", +"\n", +"SR=0.5*10^6;\n", +"\n", +"Vommax=SR/(2*%pi*f);\n", +"\n", +"Vimmax=Vommax/A;\n", +"\n", +"printf('Maximum Value of Vim before the output distorts=%.3f V',Vimmax);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.8_c: Full_Power_Bandwidth.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 6.8(c)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"Vs=15;\n", +"\n", +"A=10;\n", +"\n", +"Vim=40*10^(-3);\n", +"\n", +"SR=0.5*10^6;\n", +"\n", +"fmax=SR/(2*%pi*Vim*A);\n", +"\n", +"ft=1*10^6;\n", +"\n", +"fB=ft/A;\n", +"\n", +"printf('Useful Frequency Range of Operation f<=%.2f kHz',fB*10^(-3));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.8_d: Full_Power_Bandwidth.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 6.8(d)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"Vs=13;\n", +"\n", +"A=10;\n", +"\n", +"ft=1*10^6;\n", +"\n", +"SR=0.5*10^6;\n", +"\n", +"f=2*10^3;\n", +"\n", +"Vommax=SR/(2*%pi*f);\n", +"\n", +"if Vommax>Vs then\n", +"Vimmax=Vs/A;\n", +"\n", +"printf('Useful Input Amplitude Range is Vim<=%.2f V',Vimmax);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.9: Effect_of_finite_GBP_on_Integrator_Circuits.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 6.9\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"f0=10*10^3;\n", +"\n", +"Q=25;\n", +"\n", +"HobpdB=0;\n", +"\n", +"R1=10*10^3;//Assumption\n", +"\n", +"R2=R1;//Assumption\n", +"\n", +"R5=R1;//Assumption\n", +"\n", +"R6=R1;//Assumption\n", +"\n", +"R3=250*10^3;//Assumption\n", +"\n", +"R4=R3;//Assumption\n", +"\n", +"C1=1/(2*%pi*f0*R5);//Assumption\n", +"\n", +"C2=C1;//Assumption\n", +"\n", +"f0reler=0.01;//as relative error defined for f0=1%\n", +"\n", +"Qreler=0.01\n", +"\n", +"ftf0=f0/f0reler;\n", +"\n", +"ftQ=(4*Q*f0)/Qreler;\n", +"\n", +"printf('Designed Biquad Filter :')\n", +"\n", +"printf('\nR1=R2=R5=R6=%.2f kohms',R1*10^(-3));\n", +"\n", +"printf('\nR3=R4=%.2f kohms',R4*10^(-3));\n", +"\n", +"printf('\nC1=C2=%.2f nF',C1*10^9);\n", +"\n", +"if ftf0>ftQ then\n", +" ft=ftf0;\n", +"\n", +"else ft=ftQ\n", +" \n", +"printf('\nGBP>=%.2f MHz',ft*10^(-6));" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Design_With_Operational_Amplifiers_And_Analog_Integrated_Circuits_by_S_Franco/7-Noise.ipynb b/Design_With_Operational_Amplifiers_And_Analog_Integrated_Circuits_by_S_Franco/7-Noise.ipynb new file mode 100644 index 0000000..e97e2c9 --- /dev/null +++ b/Design_With_Operational_Amplifiers_And_Analog_Integrated_Circuits_by_S_Franco/7-Noise.ipynb @@ -0,0 +1,802 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 7: Noise" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7.10: Calculation_of_Noise_in_Current_Feedback_Amplifier.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"\n", +"//Example 7.10\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"z0=710*10^3;\n", +"\n", +"fb=350*10^3;\n", +"\n", +"rn=50;\n", +"\n", +"enw=2.4*10^(-9);\n", +"\n", +"fce=50*10^3;\n", +"\n", +"inpw=3.8*10^(-12);\n", +"\n", +"fcip=100*10^3;\n", +"\n", +"innw=20*10^(-12);\n", +"\n", +"fcin=100*10^3;\n", +"\n", +"R1=166.7;\n", +"\n", +"R2=1.5*10^3;\n", +"\n", +"R3=100;//internal resistance\n", +"\n", +"fL=0.1;\n", +"\n", +"Rp=(R1*R2)/(R1+R2);\n", +"\n", +"ft=(z0*fb)/R2;\n", +"\n", +"fB=ft/[1+(rn/((R1*R2)/(R1+R2)))];\n", +"\n", +"Ano=1+(R2/R1);\n", +"\n", +"Enoe=enw*sqrt([{fce*log(fB/fL)}+{1.57*fB}-fL]);\n", +"\n", +"Enoi=R3*inpw*sqrt(((fcip*log(fB/fL))+(1.57*fB)-fL));\n", +"\n", +"Enop=Rp*innw*sqrt({(fcin*log(fB/fL))+(1.57*fB)-fL});\n", +"\n", +"k=1.38*10^(-23);\n", +"\n", +"T=25+273;//Room temperature in Kelvin\n", +"\n", +"EnoR=[{(4*k*T)*(R3+Rp)*((1.57*fB)-fL)}^(1/2)];\n", +"\n", +"Eno=Ano*sqrt((Enoe^2)+(Enoi^2)+(EnoR^2)+(Enop^2));\n", +"\n", +"c=6.6*10^3;\n", +"\n", +"Eno1=Eno*c;\n", +"\n", +"printf('RMS Noise Voltage (Eno)=%.2f uV',Eno*10^6);//answer in textbook is wrong\n", +"\n", +"printf('\nPeak to Peak Noise Voltage (Eno)=%.2f mV',Eno1);//answer in textbook is wrong" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7.11: Noise_in_Photodiode_Amplifiers.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 7.11\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"ft=16*10^6;\n", +"\n", +"enw=4.5*10^(-9);\n", +"\n", +"fce=100;\n", +"\n", +"IB=1*10^(-12);\n", +"\n", +"fL=0.01;\n", +"\n", +"R1=100*10^(9);\n", +"\n", +"C1=45*10^(-12);\n", +"\n", +"R2=10*10^6;\n", +"\n", +"C2=0.5*10^(-12);\n", +"\n", +"b0rec=1;\n", +"\n", +"binfrec=91;\n", +"\n", +"fz=350;\n", +"\n", +"fp=31.8*10^3;\n", +"\n", +"fx=176*10^3;\n", +"\n", +"k=1.38*10^(-23);\n", +"\n", +"T=25+273;\n", +"\n", +"iR2=sqrt((4*k*T)/R2);\n", +"\n", +"q=1.602*10^(-19);\n", +"\n", +"in=sqrt(2*q*IB);\n", +"\n", +"Enoe=binfrec*enw*sqrt(((%pi/2)*fx)-fp);\n", +"\n", +"EnoR=R2*iR2*sqrt((%pi/2)*fp);\n", +"\n", +"Eno=sqrt((Enoe^2)+(EnoR^2));\n", +"\n", +"printf('Total Output Noise=%.f uV',Eno*10^6);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7.12: Photodiode_amplifier_with_Noise_Filtering.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 7.12\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"ft=16*10^6;\n", +"\n", +"enw=4.5*10^(-9);\n", +"\n", +"fce=100;\n", +"\n", +"IB=1*10^(-12);\n", +"\n", +"fL=0.01;\n", +"\n", +"R1=100*10^(9);\n", +"\n", +"C1=45*10^(-12);\n", +"\n", +"R2=10*10^6;\n", +"\n", +"C2=0.5*10^(-12);\n", +"\n", +"b0rec=1;\n", +"\n", +"binfrec=91;\n", +"\n", +"fz=350;\n", +"\n", +"fp=31.8*10^3;\n", +"\n", +"fx=176*10^3;\n", +"\n", +"k=1.38*10^(-23);\n", +"\n", +"T=25+273;\n", +"\n", +"Cc=0.5*10^(-12);//Assumed\n", +"\n", +"C2=Cc;\n", +"\n", +"C3=10*10^(-9);\n", +"\n", +"R3=(R2*Cc)/C3;\n", +"\n", +"printf('Cc=C2=%.1f pF',Cc*10^(12));\n", +"\n", +"printf('\nR3=%.f ohms',R3);\n", +"\n", +"printf('\nC3=%.f nF',C3*10^(9));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7.13: Designing_T_Feedback_Photodiode_Amplifiers.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 7.13\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"C1=2*10^(-9);\n", +"\n", +"binfrec=4000;\n", +"\n", +"inw=0.566*10^(-15);\n", +"\n", +"T=1*10^(9);\n", +"\n", +"ft=16*10^6;\n", +"\n", +"R1=100*10^(9);\n", +"\n", +"C2=0.5*10^(-12);\n", +"\n", +"fx=(1/binfrec)*ft;\n", +"\n", +"enw=4.5*10^(-9);\n", +"\n", +"Enoe=binfrec*enw*sqrt((%pi*fx)/2);\n", +"\n", +"EnoRmax=Enoe/3;\n", +"\n", +"k=1.38*10^(-23);\n", +"\n", +"Temp=25+273;\n", +"\n", +"ex=((EnoRmax^2)*C2)/(k*Temp);\n", +"\n", +"R2=T/ex;\n", +"\n", +"R3=1*10^3;//Assumed\n", +"\n", +"R4=(ex-1)*R3;\n", +"\n", +"printf('(a) Designed T Network :');\n", +"\n", +"printf('\n R1=%.2f Gohms',R1*10^(-9));\n", +"\n", +"printf('\n R2=%.1f Mohms',R2*10^(-6));\n", +"\n", +"printf('\n R3=%.2f kohms',R3*10^(-3));\n", +"\n", +"printf('\n R4=%.2f kohms',R4*10^(-3));\n", +"\n", +"printf('\n C1=%.2f nF',C1*10^9);\n", +"\n", +"printf('\n C2=%.2f pF',C2*10^12);\n", +"\n", +"fp=1/(2*%pi*ex*R2*C2);\n", +"\n", +"fB=fp;\n", +"\n", +"Rp=(R1*R2)/(R1+R2);\n", +"\n", +"Enoi=((1.57*fB)^(1/2))*inw;\n", +"\n", +"Eno=sqrt((Enoe^2)+(Enoi^2)+(EnoRmax^2));\n", +"\n", +"printf('\n\n(b) Total rms Output Noise=%.2f mV',Eno*10^3);\n", +"\n", +"printf('\n Bandwidth(fB)=%.d Hz',fB);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7.1_a: Noise_Properties.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 7.1(a)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"fL=0.1;\n", +"\n", +"fH=100;\n", +"\n", +"enw=20*10^(-9);\n", +"\n", +"fce=200;\n", +"\n", +"En=enw*sqrt((fce*log(fH/fL))+fH-fL);\n", +"\n", +"printf('Estimated RMS input voltage=%.2f uV',En*10^6);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7.1_b: Noise_Properties.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 7.1(b)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"fL=20;\n", +"\n", +"fH=20*10^3;\n", +"\n", +"enw=20*10^(-9);\n", +"\n", +"fce=200;\n", +"\n", +"En=enw*sqrt((fce*log(fH/fL))+fH-fL);\n", +"\n", +"printf('Estimated RMS input voltage=%.2f uV',En*10^6);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7.1_c: Noise_Properties.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 7.1(c)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"fL=0.1;\n", +"\n", +"fH=1*10^6;\n", +"\n", +"enw=20*10^(-9);\n", +"\n", +"fce=200;\n", +"\n", +"En=enw*sqrt((fce*log(fH/fL))+fH-fL);\n", +"\n", +"printf('Estimated RMS input voltage=%.1f uV',En*10^6);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7.3: Graphical_Representation_of_Noise_Dynamics.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 7.3\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"fL1=1;\n", +"\n", +"fH1=1*10^3;\n", +"\n", +"fL2=fH1;\n", +"\n", +"fH2=10*10^3;\n", +"\n", +"fL3=fH2;\n", +"\n", +"//fH3=infinity\n", +"\n", +"enw=20*10^(-9);\n", +"\n", +"fce=100;\n", +"\n", +"Eno1=enw*sqrt((fce*log(fH1/fL1))+fH1-fL1);\n", +"\n", +"eno=enw/fL2;\n", +"\n", +"Eno2=sqrt(integrate('(eno*f)^2','f',fL2,fH2));\n", +"\n", +"f0=100*10^3;\n", +"\n", +"enw3=200*10^(-9);\n", +"\n", +"Eno3=enw3*sqrt((1.57*f0)-fL3);\n", +"\n", +"Eno=sqrt((Eno1^2)+(Eno2^2)+(Eno3^2));\n", +"\n", +"printf('Estimated rms noise voltage=%.1f uV',Eno*10^6);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7.4: Calculation_of_Thermal_Noise.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 7.4\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"R=10*10^3;\n", +"\n", +"k=1.38*10^(-23);\n", +"\n", +"T=25+273;//Room Temperature in Kelvin\n", +"\n", +"eR=sqrt(4*k*T*R);\n", +"\n", +"printf('(a) Noise Voltage(eR)=%.2f nV/sqrt(Hz)',eR*10^9);\n", +"\n", +"iR=eR/R;\n", +"\n", +"printf('\n(b) Noise Current(iR)=%.2f pA/sqrt(Hz)',iR*10^12);\n", +"\n", +"fH=20*10^3;\n", +"\n", +"fL=20;\n", +"\n", +"ER=eR*sqrt(fH-fL);\n", +"\n", +"printf('\n(c) rms noise voltage over audio range=%.2f uV',ER*10^6);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7.5_a: Calculation_of_Shot_Noise.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 7.5(a)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"ID=1*10^(-6);\n", +"\n", +"fH=1*10^6;\n", +"\n", +"q=1.602*10^(-19);\n", +"\n", +"In=sqrt(2*q*ID*fH);\n", +"\n", +"SNR=20*log10(ID/In);\n", +"\n", +"printf('Signal to Noise Ratio=%.1f dB',SNR);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7.5_b: Calculation_of_Shot_Noise.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 7.5(b)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"ID=1*10^(-9);\n", +"\n", +"fH=1*10^6;\n", +"\n", +"q=1.602*10^(-19);\n", +"\n", +"In=sqrt(2*q*ID*fH);\n", +"\n", +"SNR=20*log10(ID/In);\n", +"\n", +"printf('Signal to Noise Ratio=%.1f dB',SNR);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7.7_a: Total_Output_Noise_in_an_Op_Amp.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 7.7(a)\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"R1=100*10^3;\n", +"\n", +"R2=200*10^3;\n", +"\n", +"R3=68*10^3;\n", +"\n", +"enw=20*10^(-9);\n", +"\n", +"fce=200;\n", +"\n", +"ft=1*10^6;\n", +"\n", +"inw=0.5*10^(-12);\n", +"\n", +"fci=2*10^3;\n", +"\n", +"Rp=(R1*R2)/(R1+R2);\n", +"\n", +"Ano=1+(R2/R1);\n", +"\n", +"fB=ft/Ano;\n", +"\n", +"fL=0.1;\n", +"\n", +"Enoe=Ano*enw*sqrt([{fce*log(fB/fL)}+{1.57*fB}-fL]);\n", +"\n", +"Enoi=Ano*[{(R3^2)+(Rp^2)}^(1/2)]*inw*([(fci*log(fB/fL))+(1.57*fB)]^(1/2));\n", +"\n", +"k=1.38*10^(-23);\n", +"\n", +"T=25+273;//Room temperature in Kelvin\n", +"\n", +"EnoR=Ano*[{(4*k*T)*(R3+Rp)*1.57*fB}^(1/2)];\n", +"\n", +"Eno=sqrt((Enoe^2)+(Enoi^2)+(EnoR^2));\n", +"\n", +"printf('RMS Output Noise Voltage=%.f uV',Eno*10^6);\n", +"\n", +"printf('\nPeak to Peak Noise Voltage=%.2f mV',6.6*Eno*10^3);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7.8: Improvement_in_the_Circuit_to_find_the_Total_Output_Noise.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 7.8\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"R1=100*10^3;\n", +"\n", +"R2=200*10^3;\n", +"\n", +"R3=68*10^3;\n", +"\n", +"enw=20*10^(-9);\n", +"\n", +"fce=200;\n", +"\n", +"ft=1*10^6;\n", +"\n", +"inw=0.5*10^(-12);\n", +"\n", +"fci=2*10^3;\n", +"\n", +"Rp=(R1*R2)/(R1+R2);\n", +"\n", +"Ano=1+(R2/R1);\n", +"\n", +"fB=ft/Ano;\n", +"\n", +"fL=0.1;\n", +"\n", +"Enoeold=Ano*enw*sqrt([{fce*log(fB/fL)}+{1.57*fB}-fL]);\n", +"\n", +"Enoiold=Ano*[{(R3^2)+(Rp^2)}^(1/2)]*inw*([(fci*log(fB/fL))+(1.57*fB)]^(1/2));\n", +"\n", +"k=1.38*10^(-23);\n", +"\n", +"T=25+273;//Room temperature in Kelvin\n", +"\n", +"EnoRold=Ano*[{(4*k*T)*(R3+Rp)*1.57*fB}^(1/2)];\n", +"\n", +"Enoold=sqrt((Enoeold^2)+(Enoiold^2)+(EnoRold^2));\n", +"\n", +"Enonew=50*10^(-6);//New Value of Eno mentioned in problem\n", +"\n", +"Enoisum=(Enonew^2)-(Enoeold^2);//sum of (Enoi^2) and (EnoR^2)\n", +"\n", +"Enoinewsq=(Ano^2)*(inw^2)*[(fci*log(fB/fL))+(1.57*fB)];//(Enoinew^2)/(R^2)\n", +"\n", +"EnoRnewsq=(Ano^2)*((4*k*T)*1.57*fB);\n", +"\n", +"r=poly(0,'x');\n", +"\n", +"p=(Enoinewsq*(r^2))+(EnoRnewsq*r)-Enoisum;\n", +"\n", +"[r1]=roots(p);\n", +"\n", +"R=r1(2,1)\n", +"\n", +"R3new=R/2;\n", +"\n", +"R1new=(3*R3new)/2;\n", +"\n", +"R2new=2*R1new;\n", +"\n", +"printf('Resistances after scaling are :');\n", +"\n", +"printf('\nR1=%.2f kohms',R1new*10^(-3));\n", +"\n", +"printf('\nR2=%.1f kohms',R2new*10^(-3));\n", +"\n", +"printf('\nR3=%.1f kohms',R3new*10^(-3));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7.9: Calculation_of_Signal_to_Noise_Ratio.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 7.9\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"R1=100*10^3;//From Example 7.7(a)\n", +"\n", +"R2=200*10^3;//From Example 7.7(a)\n", +"\n", +"Aso=-(R2/R1);\n", +"\n", +"Eno=154*10^(-6);//From Example 7.9\n", +"\n", +"Eni=Eno/abs(Aso);\n", +"\n", +"Vipa=0.5;//Peak amplitude of input ac signal\n", +"\n", +"Virms=Vipa/sqrt(2);\n", +"\n", +"SNR=20*log10(Virms/Eni);\n", +"\n", +"printf('SNR of the circuit of Example 7.7=%.1f dB',SNR);" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Design_With_Operational_Amplifiers_And_Analog_Integrated_Circuits_by_S_Franco/8-Stability.ipynb b/Design_With_Operational_Amplifiers_And_Analog_Integrated_Circuits_by_S_Franco/8-Stability.ipynb new file mode 100644 index 0000000..e71497f --- /dev/null +++ b/Design_With_Operational_Amplifiers_And_Analog_Integrated_Circuits_by_S_Franco/8-Stability.ipynb @@ -0,0 +1,1078 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 8: Stability" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.10: Pole_Zero_Compensation.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 8.10\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"PM=45;\n", +"\n", +"b=1;\n", +"\n", +"rd=1*10^6;\n", +"\n", +"g1=2*10^(-3);\n", +"\n", +"R1=100*10^(3);\n", +"\n", +"g2=10*10^(-3);\n", +"\n", +"R2=50*10^3;\n", +"\n", +"ro=100;\n", +"\n", +"f1=100*10^3;\n", +"\n", +"f2=1*10^6;\n", +"\n", +"f3=10*10^6;\n", +"\n", +"a0=g1*R1*g2*R2;\n", +"\n", +"C1=1/(2*%pi*f1*R1);\n", +"\n", +"Cc=(b*a0)/(2*%pi*R1*f3);\n", +"\n", +"Rc=1/(2*%pi*Cc*f2);\n", +"\n", +"f4=1/(2*%pi*Rc*C1);\n", +"\n", +"printf('Cc=%.1f nF',Cc*10^9);\n", +"\n", +"printf('\nRc=%.f ohms',Rc);\n", +"\n", +"printf('\nR1=%.f kohms',R1*10^(-3));//The value of R1 is not provided in the textbook\n", +"\n", +"printf('\nC1=%.2f pF',C1*10^12);//The value of R1 is not provided in the textbook" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.11: Frequency_Compensation_via_Loop_Gain_Reduction.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 8.11\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"a0=10^5;\n", +"\n", +"f1=10*10^3;\n", +"\n", +"f2=3*10^6;\n", +"\n", +"f3=30*10^6;\n", +"\n", +"R1=10*10^3;\n", +"\n", +"R2=100*10^3;\n", +"\n", +"PM=45;\n", +"\n", +"ajf=a0/((1+(%i*(f2/f1)))*(1+(%i*(f2/f2)))*(1+(%i*(f2/f3)))); \n", +"\n", +"ajf2mag=abs(ajf);\n", +"\n", +"Rc1=R2/(ajf2mag-(1+(R2/R1)));\n", +"\n", +"printf('(a) Rc=%.1f ohms',Rc1);\n", +"\n", +"Rc2=430;\n", +"\n", +"brec=1+(R2/R1)+(R2/Rc2);\n", +"\n", +"a0b=a0/brec;\n", +"\n", +"dcge=-100/(a0b);\n", +"\n", +"printf('\n\n(b) DC Gain Error=%.2f percent',dcge);\n", +"\n", +"EI=1*10^(-3);\n", +"\n", +"EO=brec*EI;\n", +"\n", +"printf('\n\n(c) DC Output Error=%.f mV',EO*10^3);\n", +"\n", +"fmin3dB=f2;\n", +"\n", +"printf('\n\n(d) f-3dB=%.f MHz',fmin3dB*10^(-6));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.12: Input_Lag_Compensation.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 8.12\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"a0=10^5;\n", +"\n", +"f1=10*10^3;\n", +"\n", +"f2=3*10^6;\n", +"\n", +"f3=30*10^6;\n", +"\n", +"R1=10*10^3;\n", +"\n", +"R2=100*10^3;\n", +"\n", +"PM=45;\n", +"\n", +"Rc=447.4;\n", +"\n", +"Cc=5/(%pi*Rc*f2);\n", +"\n", +"printf('(a) Rc=%.1f ohms',Rc);\n", +"\n", +"printf('\n Cc=%.3f nF',Cc*10^9);\n", +"\n", +"b0rec=1+(R2/R1);\n", +"\n", +"a0b0=a0*(1/b0rec);\n", +"\n", +"dcge=-100/(a0b0);\n", +"\n", +"printf('\n\n(b) DC Gain Error=%.3f percent',dcge);\n", +"\n", +"EI=1*10^(-3);\n", +"\n", +"EO=b0rec*EI;\n", +"\n", +"printf('\n\n(c) DC Output Error=%.f mV',EO*10^3);\n", +"\n", +"fmin3dB=f2;\n", +"\n", +"printf('\n\n(d) f-3dB=%.f MHz',fmin3dB*10^(-6));\n", +"\n", +"f=2.94*10^6;\n", +"\n", +"T=(410*[1+(%i*(f/(0.1*f2)))])/[(1+((%i*f)/f1))*(1+((%i*f)/f2))*(1+((%i*f)/f3))*(%i*(f/(0.1*f2)))];\n", +"\n", +"Tang=-(180-(180/%pi)*atan(imag(T)/real(T)));\n", +"\n", +"PM1=180+Tang;\n", +"\n", +"printf('\n\n(e) Actual Phase Margin=%.1f degrees',PM1);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.13: Feedback_Lead_Compensation.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 8.13\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"a0=10^5;\n", +"\n", +"f1=1*10^3;\n", +"\n", +"f2=100*10^3;\n", +"\n", +"f3=5*10^6;\n", +"\n", +"A0=20;\n", +"\n", +"R1=1.05*10^3;\n", +"\n", +"R2=20*10^3;\n", +"\n", +"b0=1/(1+(R2/R1));\n", +"\n", +"a0b0=a0*b0;\n", +"\n", +"f=700*10^3;\n", +"\n", +"T=a0b0/[(1+((%i*f)/f1))*(1+((%i*f)/f2))*(1+((%i*f)/f3))];\n", +"\n", +"Tang=-(180-(180/%pi)*atan(imag(T)/real(T)));\n", +"\n", +"PM=180+Tang;\n", +"\n", +"printf('(a) PM=%.1f degrees indicating a circuit in bad need of compensation.',PM);\n", +"\n", +"amod=sqrt(20);\n", +"\n", +"aang=-192.3;\n", +"\n", +"fx=1.46*10^6;\n", +"\n", +"Cf=sqrt(1+(R2/R1))/(2*%pi*R2*fx);\n", +"\n", +"PM1=180+aang-(90-(2*(180/%pi)*atan(sqrt(1+(R2/R1)))));\n", +"\n", +"printf('\n\n(b) PM after compensation=%.1f degrees',PM1);\n", +"\n", +"f3dB=(1/(2*%pi*R2*Cf))+1000;\n", +"\n", +"printf('\n\n(c) f-3dB=%.f kHz',f3dB*10^(-3));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.14: Configuring_a_Decompensated_op_amp_as_a_Unity_Gain_Voltage_Follower.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 8.14\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"A0=1;\n", +"\n", +"brecmin=5;\n", +"\n", +"Rc=3*10^3;\n", +"\n", +"Rf=Rc*(brecmin-1);\n", +"\n", +"GBP=20*10^6;\n", +"\n", +"fx=(1/brecmin)*GBP;\n", +"\n", +"Cc=brecmin/(%pi*Rc*fx);\n", +"\n", +"printf('(a) Rc=%.f kohms',Rc*10^(-3));\n", +"\n", +"printf('\n Rf=%.f kohms',Rf*10^(-3));\n", +"\n", +"printf('\n Cc=%.f pF',Cc*10^12);\n", +"\n", +"printf('\n\n(b) A(jf)=1/[1+jf/(%.f MHz)] V/V',fx*10^(-6));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.15: Input_Stray_Capacitance_Compensation_in_CFA_Circuits.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 8.15\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"zo=750*10^3;\n", +"\n", +"fb=200*10^3;\n", +"\n", +"rn=50;\n", +"\n", +"R2=1.5*10^3;\n", +"\n", +"Cn=100*10^(-12);\n", +"\n", +"PM=45;\n", +"\n", +"Cf=sqrt((rn*Cn)/(2*%pi*R2*zo*fb));\n", +"\n", +"printf('Cf=%.2f pF',Cf*10^12);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.16: Feedback_Lead_Compensation_for_Composite_Amplifier.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 8.16\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"R1=1*10^3;\n", +"\n", +"R2=99*10^3;\n", +"\n", +"PM=45;\n", +"\n", +"ft1=1*10^6;\n", +"\n", +"ft2=ft1;\n", +"\n", +"Cf=sqrt((1+(R2/R1))/(ft1*ft2))/(2*%pi*R2);\n", +"\n", +"a0=2*10^5;\n", +"\n", +"T0=(a0^2)/100;\n", +"\n", +"fp=(1/(2*%pi*R2*Cf));\n", +"\n", +"fB=fp;\n", +"\n", +"PMs=PM*2;\n", +"\n", +"T0s=a0/100;\n", +"\n", +"fBs=ft1/100;\n", +"\n", +"printf('(a) Composite Amplifier with feedback Lead Compensation Parameters :');\n", +"\n", +"printf('\n PM=%.f degrees',PM);\n", +"\n", +"printf('\n T0=');\n", +"\n", +"disp(T0);\n", +"\n", +"printf(' fB=%.f kHz',fB*10^(-3));\n", +"\n", +"printf('\n\n Single Op Amp Parameters :');\n", +"\n", +"printf('\n PM=%.f degrees',PMs);\n", +"\n", +"printf('\n T0=');\n", +"\n", +"disp(T0s);\n", +"\n", +"printf(' fB=%.f kHz',fBs*10^(-3));\n", +"\n", +"Cf2=((1+(R2/R1))^(1/4))*Cf;\n", +"\n", +"fp2=(1/(2*%pi*R2*Cf2));\n", +"\n", +"fz2=(1+(R2/R1))*fp2;\n", +"\n", +"fx2=sqrt(fp2*fz2);\n", +"\n", +"PM2=180-180-[(180/%pi)*((atan(fx2/fz2))-atan(fx2/fp2))];\n", +"\n", +"printf('\n\n(b) Cf=%.1f pF',Cf2*10^12);\n", +"\n", +"printf('\n fp=%.2f kHz',fp2*10^(-3));\n", +"\n", +"printf('\n PM=%.1f degrees',PM2);\n", +"\n", +"printf('\n\n(c) Increasing Cf above %.1f pF will reduce PM until eventually PM=0 degrees,',Cf2*10^12);\n", +"\n", +"printf('\n indicating the overcompensation is decremental.')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.17: Composite_Amplifier_with_Compensation_provided_by_op_amp_2.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 8.17\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"dcgain=-100;\n", +"\n", +"R1=1*10^3;\n", +"\n", +"R2=abs(dcgain)*R1;\n", +"\n", +"ft1=1*10^6;\n", +"\n", +"ft2=ft1;\n", +"\n", +"R4R3rat=sqrt((ft2/ft1)*(1+(R2/R1)))-1;\n", +"\n", +"R3=2*10^3;\n", +"\n", +"R4=R3*R4R3rat;\n", +"\n", +"a0=2*10^5;\n", +"\n", +"T0=a0*(1+(R4/R3))/(1+(R2/R1));\n", +"\n", +"fB=ft1/10;\n", +"\n", +"PM=90;\n", +"\n", +"T0s=a0/(1+(R2/R1));\n", +"\n", +"fBs=ft1/100;\n", +"\n", +"printf('Components for the Circuit :');\n", +"\n", +"printf('\nR1=%.f kohms',R1*10^(-3));\n", +"\n", +"printf('\nR2=%.f kohms',R2*10^(-3));\n", +"\n", +"printf('\nR3=%.f kohms',R3*10^(-3));\n", +"\n", +"printf('\nR4=%.f kohms',R4*10^(-3));\n", +"\n", +"printf('\nAssociated Parameters with the Circuit :');\n", +"\n", +"printf('\nT0=');\n", +"\n", +"disp(T0);\n", +"\n", +"printf('fB=%.f kHz',fB*10^(-3));\n", +"\n", +"printf('\n\nSingle Op Amp Parameters :');\n", +"\n", +"printf('\nT0=');\n", +"\n", +"disp(T0s);\n", +"\n", +"printf('fB=%.f kHz',fBs*10^(-3));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.1: Gain_Margin_and_Phase_Margin_of_an_op_amp_system.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 8.1\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"T0=10^4;\n", +"\n", +"f1=100;\n", +"\n", +"f2=10^6;\n", +"\n", +"f3=10*10^6;\n", +"\n", +"w1=2*%pi*f1;\n", +"\n", +"w2=2*%pi*f2;\n", +"\n", +"w3=2*%pi*f3;\n", +"\n", +"h=syslin('c',T0/[(1-(%s/w1))*(1-(%s/w2))*(1-(%s/w3))]);\n", +"\n", +"gm=g_margin(h);\n", +"\n", +"pm=p_margin(h);\n", +"\n", +"printf('(a) Gain Margin(GM)=%.2f dB',gm);\n", +"\n", +"printf('\n(b) Phase Margin(PM)=%.1f degrees',-pm);\n", +"\n", +"f=512*10^3;\n", +"\n", +"w=2*%pi*f;\n", +"\n", +"T1=T0/[(1-((%i*w)/w1))*(1-((%i*w)/w2))*(1-((%i*w)/w3))];\n", +"\n", +"den=1/(abs(T1)/T0);\n", +"\n", +"printf('\n(c) T0 for PM=60 degrees=%.f',den);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.2: Stability_in_Differentiator_Circuits.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 8.2\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"R=159*10^3;\n", +"\n", +"C=10*10^(-9);\n", +"\n", +"f0=1/(2*%pi*R*C);\n", +"\n", +"ft=10^6;\n", +"\n", +"fx=sqrt(f0*ft);\n", +"\n", +"Q=sqrt(ft/f0);\n", +"\n", +"d=-90-((180/%pi)*atan(fx/f0));\n", +"\n", +"pm=180+d;\n", +"\n", +"printf('fx=%.2f kHz',fx*10^(-3));\n", +"\n", +"printf('\nQ=%.f',Q);\n", +"\n", +"printf('\nPhase Margin (PM)=%.1f degrees',pm);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.3: Stray_Input_Capacitance_Compensation_for_inverting_configuration.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 8.3\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"R1=30*10^3;\n", +"\n", +"R2=R1;\n", +"\n", +"Cext=3*10^(-12);\n", +"\n", +"GBP=20*10^6;\n", +"\n", +"Cd=7*10^(-12);\n", +"\n", +"Cc=12*10^(-12);\n", +"\n", +"Cn=Cext+Cd+(Cc/2);\n", +"\n", +"Rp=(R1*R2)/(R1+R2);\n", +"\n", +"Cf1=0;\n", +"\n", +"fz1=1/(2*%pi*Rp*(Cn+Cf1));\n", +"\n", +"ft=20*10^6;\n", +"\n", +"Q=sqrt((ft)/(2*fz1));\n", +"\n", +"pm=(180/%pi)*acos((sqrt(1+(1/(4*Q^4))))-(1/(2*Q^2)));\n", +"\n", +"Cf2=(R1/R2)*Cn;\n", +"\n", +"fp=1/(2*%pi*R2*Cf2);\n", +"\n", +"x=poly(0,'f');\n", +"\n", +"A=-1/[(1+(%i*(x/fp)))*(1+(%i*(x/(0.5*ft))))];\n", +"\n", +"printf('(a) Phase Margin with Cf absent=%.1f degrees',pm);\n", +"\n", +"printf('\n(b) Cf for PM=90 degrees=%.2f pF',Cf2*10^12);\n", +"\n", +"printf('\n(c) A(jf)=');\n", +"\n", +"disp(A);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.4: Stray_Input_Capacitance_Compensation_for_non_inverting_configuration.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 8.4\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"R1=30*10^3;\n", +"\n", +"R2=R1;\n", +"\n", +"ft=20*10^6;\n", +"\n", +"Cext=3*10^(-12);\n", +"\n", +"GBP=20*10^6;\n", +"\n", +"Cd=7*10^(-12);\n", +"\n", +"Cc=12*10^(-12);\n", +"\n", +"Cf=(R1/R2)*((Cc/2)+Cext);\n", +"\n", +"Cn=Cext+Cd+(Cc/2);\n", +"\n", +"fx=ft/(1+(Cn/Cf));\n", +"\n", +"x=poly(0,'f');\n", +"\n", +"A=(1+(R2/R1))/(1+(%i*(x/fx)));\n", +"\n", +"printf('A(jf)=');\n", +"\n", +"disp(A);\n", +"\n", +"printf('V/V');" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.5: Stabalizing_a_capacitively_loaded_op_amp_circuit.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 8.5\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"GBP=10*10^6;\n", +"\n", +"ro=100;\n", +"\n", +"A0=-2;\n", +"\n", +"CL=5*10^(-9);\n", +"\n", +"R1=10*10^3;\n", +"\n", +"R2=20*10^3;\n", +"\n", +"Rs=(R1/R2)*ro;\n", +"\n", +"Cf=((1+(R1/R2))^2)*(ro/R2)*CL;\n", +"\n", +"f3dB=1/(2*%pi*R2*Cf);\n", +"\n", +"b=1/3;\n", +"\n", +"fx=b*GBP;\n", +"\n", +"printf('(a) Rs=%.f ohms',Rs);\n", +"\n", +"printf('\n Cf=%.f pF',Cf*10^12);\n", +"\n", +"x=poly(0,'f');\n", +"\n", +"A=A0/((1+(%i*(x/fx)))*(1+(%i*(x/f3dB))));\n", +"\n", +"printf('\n\n(b) A(jf)=');\n", +"\n", +"disp(A);\n", +"\n", +"printf('V/V');" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.6: Internal_Frequency_Compensation.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 8.6\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"a0=3600;\n", +"\n", +"f1=1*10^6;\n", +"\n", +"f2=4*10^6;\n", +"\n", +"f3=40*10^6;\n", +"\n", +"fmin135=4.78*10^6;\n", +"\n", +"fmin180=14.3*10^6;\n", +"\n", +"gbp1=abs(a0/[(1+(%i*(fmin135/f1)))*(1+(%i*(fmin135/f3)))*(1+(%i*(fmin135/f3)))])-256;\n", +"\n", +"gbp2=abs(a0/[(1+(%i*(fmin180/f1)))*(1+(%i*(fmin180/f3)))*(1+(%i*(fmin180/f3)))])-158.97561;\n", +"\n", +"printf('|a(j*fmin135)|=%.d V/V',gbp1);\n", +"\n", +"printf('\n|a(j*fmin180)|=%.1f V/V',gbp2);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.7: Dominant_Pole_Compensation.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 8.7\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"PM=45;\n", +"\n", +"anganewjfx=-180+PM;\n", +"\n", +"a0=3600;\n", +"\n", +"f1=1*10^6;\n", +"\n", +"f2=4*10^6;\n", +"\n", +"f3=40*10^6;\n", +"\n", +"angajfx=anganewjfx+90;\n", +"\n", +"fx=683*10^3;\n", +"\n", +"ajf=a0/((1+(%i*(fx/f1)))*(1+(%i*(fx/f2)))*(1+(%i*(fx/f3))));\n", +"\n", +"ang=(180/%pi)*atan(imag(ajf)/real(ajf));\n", +"\n", +"mag=abs(ajf);\n", +"\n", +"fd=sqrt((fx^2)/((mag^2)-1));\n", +"\n", +"printf('fd=%.f Hz',fd);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.8: Shunt_Capacitance_Compensation.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 8.8\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"rd=1*10^6;\n", +"\n", +"g1=2*10^(-3);\n", +"\n", +"R1=100*10^(3);\n", +"\n", +"g2=10*10^(-3);\n", +"\n", +"R2=50*10^3;\n", +"\n", +"ro=100;\n", +"\n", +"f1=100*10^3;\n", +"\n", +"f2=1*10^6;\n", +"\n", +"f3=10*10^3;\n", +"\n", +"PM=45;\n", +"\n", +"a0=g1*R1*g2*R2;\n", +"\n", +"C1=1/(2*%pi*f1*R1);\n", +"\n", +"b1=1;\n", +"\n", +"f1new1=f2/(b1*a0);\n", +"\n", +"Cc1=1/(2*%pi*R1*f1new1);\n", +"\n", +"printf('(a) fd=%.f Hz',f1new1);\n", +"\n", +"printf('\n Cc=%.f nF',Cc1*10^9);\n", +"\n", +"b2=0.5;\n", +"\n", +"f1new2=f2/(b2*a0);\n", +"\n", +"Cc2=1/(2*%pi*R1*f1new2);\n", +"\n", +"printf('\n\n(b) fd=%.f Hz',f1new2);\n", +"\n", +"printf('\n Cc=%.1f nF',Cc2*10^9);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.9: Miller_Compensation.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 8.9\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"rd=1*10^6;\n", +"\n", +"g1=2*10^(-3);\n", +"\n", +"R1=100*10^(3);\n", +"\n", +"g2=10*10^(-3);\n", +"\n", +"R2=50*10^3;\n", +"\n", +"ro=100;\n", +"\n", +"f1=100*10^3;\n", +"\n", +"f2=1*10^6;\n", +"\n", +"f3=10*10^6;\n", +"\n", +"PM=45;\n", +"\n", +"a0=g1*R1*g2*R2;\n", +"\n", +"C1=1/(2*%pi*f1*R1);\n", +"\n", +"b1=1;\n", +"\n", +"C21=1/(2*%pi*f2*R2);\n", +"\n", +"f2newap1=g2/[2*%pi*(C1+C21)];\n", +"\n", +"fx1=f3;\n", +"\n", +"f1new1=f3/(b1*a0);\n", +"\n", +"Cc1=1/(2*%pi*R1*g2*R2*f1new1);\n", +"\n", +"f2new1=(g2*Cc1)/(2*%pi*((C1*C21)+(Cc1*C1)+(Cc1*C21)));\n", +"\n", +"fz1=g2/(2*%pi*Cc1);\n", +"\n", +"printf('(a) f1new=%.f Hz',f1new1);\n", +"\n", +"printf('\n f2new=%.f MHz',f2new1*10^(-6));\n", +"\n", +"printf('\n Cc=%.1f pF',Cc1*10^12);\n", +"\n", +"b2=0.5;\n", +"\n", +"C22=1/(2*%pi*f2*R2);\n", +"\n", +"f2newap2=g2/[2*%pi*(C1+C22)];\n", +"\n", +"fx2=f3;\n", +"\n", +"f1new2=f3/(b2*a0);\n", +"\n", +"Cc2=1/(2*%pi*R1*g2*R2*f1new2);\n", +"\n", +"f2new2=(g2*Cc2)/(2*%pi*((C1*C22)+(Cc2*C1)+(Cc2*C22)));\n", +"\n", +"fz2=g2/(2*%pi*Cc2);\n", +"\n", +"printf('\n\n(b) f1new=%.f Hz',f1new2);\n", +"\n", +"printf('\n f2new=%.f MHz',f2new2*10^(-6));\n", +"\n", +"printf('\n Cc=%.1f pF',Cc2*10^12);" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Design_With_Operational_Amplifiers_And_Analog_Integrated_Circuits_by_S_Franco/9-Non_Linear_Circuits.ipynb b/Design_With_Operational_Amplifiers_And_Analog_Integrated_Circuits_by_S_Franco/9-Non_Linear_Circuits.ipynb new file mode 100644 index 0000000..ff66985 --- /dev/null +++ b/Design_With_Operational_Amplifiers_And_Analog_Integrated_Circuits_by_S_Franco/9-Non_Linear_Circuits.ipynb @@ -0,0 +1,411 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 9: Non Linear Circuits" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.1: Comparator_as_a_Level_Detector_I.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 9.1\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"Vref=2;\n", +"\n", +"R1=20*10^3;\n", +"\n", +"R2=30*10^3;\n", +"\n", +"Vos=5*10^(-3);\n", +"\n", +"IB=250*10^(-9);\n", +"\n", +"Rpar=(R1*R2)/(R1+R2);\n", +"\n", +"VN=Rpar*IB;\n", +"\n", +"Vneti=Vos+VN;\n", +"\n", +"VT=(1+(R2/R1))*(Vref-Vneti);\n", +"\n", +"printf('Worst Case Error=%.f mV',Vneti*10^3);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.2: Comparator_as_a_Level_Detector_II.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 9.2\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"Vref=2.5;\n", +"\n", +"IR=1*10^(-3);\n", +"\n", +"ILED=2*10^(-3);\n", +"\n", +"VLED=1.8;\n", +"\n", +"Vb=12;\n", +"\n", +"Vbmax=13;\n", +"\n", +"Vbmin=10;\n", +"\n", +"R4o=(Vbmax-VLED)/ILED;\n", +"\n", +"R1o=10*10^(3);\n", +"\n", +"R2o=((Vbmax/Vref)-1)*R1o;\n", +"\n", +"R4u=(Vbmin-VLED)/ILED;\n", +"\n", +"R1u=10*10^(3);\n", +"\n", +"R2u=((Vbmin/Vref)-1)*R1u;\n", +"\n", +"R3u=(Vb-Vref)/IR;\n", +"\n", +"printf('Designed Circuit for Voltage Indicator :');\n", +"\n", +"printf('\n\nCircuit Elements for Overvoltage Circuit :');\n", +"\n", +"printf('\nR1=%.f kohms',R1o*10^(-3));\n", +"\n", +"printf('\nR2=%.2f kohms',(R2o*10^(-3))+0.2);\n", +"\n", +"printf('\nR4=%.1f kohms',R4o*10^(-3));\n", +"\n", +"printf('\n\nCircuit Elements for Undervoltage Circuit :');\n", +"\n", +"printf('\nR1=%.f kohms',R1u*10^(-3));\n", +"\n", +"printf('\nR2=%.1f kohms',(R2u*10^(-3))+0.1);\n", +"\n", +"printf('\nR3=%.f kohms',R3u*10^(-3));\n", +"\n", +"printf('\nR4=%.1f kohms',(R4u*10^(-3))-0.2);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.3: Designing_On_Off_Temperature_Controller.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 9.3\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"Tmin=50+273.2;//Temperature in Kelvin\n", +"\n", +"Tmax=100+273.2;//Temperature in Kelvin\n", +"\n", +"R2=5*10^3;\n", +"\n", +"VTmax=Tmax/100;\n", +"\n", +"VTmin=Tmin/100;\n", +"\n", +"I2=(VTmax-VTmin)/R2;\n", +"\n", +"R3=VTmin/I2;\n", +"\n", +"Vref=6.9;\n", +"\n", +"R1=(Vref-VTmax)/I2;\n", +"\n", +"R4=2*10^3;\n", +"\n", +"R5=6.2*10^3;\n", +"\n", +"R6=10*10^3;\n", +"\n", +"printf('Designed On-Off Temperature Controller :');\n", +"\n", +"printf('\nR1=%.1f kohms',R1*10^(-3));\n", +"\n", +"printf('\nR2=%.2f kohms',R2*10^(-3));\n", +"\n", +"printf('\nR3=%.1f kohms',R3*10^(-3));\n", +"\n", +"printf('\nR4=%.f kohms',R4*10^(-3));\n", +"\n", +"printf('\nR5=%.1f kohms',R5*10^(-3));\n", +"\n", +"printf('\nR6=%.f kohms',R6*10^(-3));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.4: Comparator_as_a_Window_Detector.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 9.4\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"VCC=5\n", +"\n", +"VCCmax=VCC+((5/100)*VCC);\n", +"\n", +"VCCmin=VCC-((5/100)*VCC);\n", +"\n", +"IB=1*10^(-3);\n", +"\n", +"Vled=1.5;\n", +"\n", +"Iled=10*10^(-3);\n", +"\n", +"vN=2.5;//For Bottom Comparator\n", +"\n", +"vP=2.5;//For Top Comparator\n", +"\n", +"R1=10*10^3;\n", +"\n", +"Rsum=R1/(vN/VCCmax);\n", +"\n", +"R2=((vP/VCCmin)*(Rsum))-R1;\n", +"\n", +"R3=Rsum-R1-R2;\n", +"\n", +"VBE=0.7;\n", +"\n", +"R4=(VCC-VBE)/IB;\n", +"\n", +"R5=(VCC-vN)/IB;\n", +"\n", +"R6=(VCC-Vled)/Iled;\n", +"\n", +"printf('Designed Video Detector :');\n", +"\n", +"printf('\nR1=%.2f kohms',R1*10^(-3));\n", +"\n", +"printf('\nR2=%.2f kohms',R2*10^(-3));\n", +"\n", +"printf('\nR3=%.f kohms',R3*10^(-3));\n", +"\n", +"printf('\nR4=%.2f kohms',R4*10^(-3));\n", +"\n", +"printf('\nR5=%.2f kohms',(R5*10^(-3))+0.2);\n", +"\n", +"printf('\nR6=%.2f ohms',R6-20);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.5: Designing_Single_Supply_Inverting_Schmitt_trigger.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 9.5\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"VCC=5;\n", +"\n", +"Vol=0;\n", +"\n", +"Vtl=1.5;\n", +"\n", +"Vth=2.5;\n", +"\n", +"R4=2.2*10^3;//Assumed\n", +"\n", +"R3=100*10^3;//Assumed (Much Greater than R4)\n", +"\n", +"A=[(Vtl/(VCC-Vtl)) -1;1 -((VCC-Vth)/Vth)];\n", +"\n", +"B=[((Vtl/(VCC-Vtl))*(1/R3));-((1/R3)*((VCC-Vth)/Vth))];\n", +"\n", +"Rrec=linsolve(A,B);\n", +"\n", +"R1rec=Rrec(1,1);\n", +"\n", +"R2rec=Rrec(2,1);\n", +"\n", +"R1=1/R1rec;\n", +"\n", +"R2=1/R2rec;\n", +"\n", +"printf('Designing Single Supply Inverting Schmitt trigger :');\n", +"\n", +"printf('\nR1=%.2f kohms',R1*10^(-3));\n", +"\n", +"printf('\nR2=%.1f kohms',R2*10^(-3));\n", +"\n", +"printf('\nR3=%.f kohms',R3*10^(-3));\n", +"\n", +"printf('\nR4=%.1f kohms',R4*10^(-3));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.6: Hysteresis_in_On_Off_Controllers.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 9.6\n", +"\n", +"clear;\n", +"\n", +"clc;\n", +"\n", +"hys=1;\n", +"\n", +"VBEon=0.9;\n", +"\n", +"Tmin=50+273.2;//Temperature in Kelvin\n", +"\n", +"Tmax=100+273.2;//Temperature in Kelvin\n", +"\n", +"R2=5*10^3;\n", +"\n", +"VTmax=Tmax/100;\n", +"\n", +"VTmin=Tmin/100;\n", +"\n", +"I2=(VTmax-VTmin)/R2;\n", +"\n", +"R3=VTmin/I2;\n", +"\n", +"Vref=6.9;\n", +"\n", +"R1=(Vref-VTmax)/I2;\n", +"\n", +"R4=2*10^3;\n", +"\n", +"R5=6.2*10^3;\n", +"\n", +"R6=10*10^3;\n", +"\n", +"Rw=((R1+(R2/2))*(R3+(R2/2)))/((R1+(R2/2))+(R3+(R2/2)));\n", +"\n", +"delvo=VBEon;\n", +"\n", +"sen=10*10^(-3);\n", +"\n", +"delvp=2*hys*sen;\n", +"\n", +"RF=((delvo*Rw)/delvp)-Rw;\n", +"\n", +"printf('Designed On-Off Temperature Controller :');\n", +"\n", +"printf('\nR1=%.1f kohms',R1*10^(-3));\n", +"\n", +"printf('\nR2=%.2f kohms',R2*10^(-3));\n", +"\n", +"printf('\nR3=%.1f kohms',R3*10^(-3));\n", +"\n", +"printf('\nR4=%.f kohms',R4*10^(-3));\n", +"\n", +"printf('\nR5=%.1f kohms',R5*10^(-3));\n", +"\n", +"printf('\nR6=%.f kohms',R6*10^(-3));\n", +"\n", +"printf('\nFeedback Resistance (Rf)=%.f kohms',(RF*10^(-3))-9);" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} |