{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Chapter 4: Opamps with negative feedback" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 4.10: Gain_and_impedence.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "////Ex 4.10\n", "clc;\n", "clear;\n", "close;\n", "format('v',5);\n", "AOL=2*10^5;//unitless\n", "Rio=2;//Mohm\n", "Ro=75;//ohm\n", "Ri=1;//kohm\n", "Rf=10;//kohm\n", "ACL=-AOL*Rf/(Rf+Ri+AOL*Ri);//unitless(Exact)\n", "disp(ACL,'Exact close loop voltage gain');\n", "ACL=-Rf/Ri;//unitless(Approximate)\n", "disp(ACL,'Approximate close loop voltage gain');\n", "Beta=Ri/(Ri+Rf);//unitless\n", "SF=1+AOL*Beta;//unitless\n", "Rif=Rio*10^6/SF;//ohm\n", "disp(Rif,'Input impedence after feedback(ohm)');" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 4.11: Gain_and_Bandwidth.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "////Ex 4.11\n", "clc;\n", "clear;\n", "close;\n", "format('v',5);\n", "Ri=2;//kohm\n", "Rf=200;//kohm\n", "//For 741C\n", "fo=5;//Hz\n", "AOL=2*10^5;//unitless\n", "UGB=1;//MHz\n", "ACL=-AOL*Rf/(Rf+Ri+AOL*Ri);//unitless(Exact)\n", "disp(ACL,'Close loop voltage gain');\n", "fodash=fo*AOL/-ACL;//Hz\n", "disp(fodash/1000,'Bandwidth, fo_dash(kHz)');" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 4.12: Calculate_Gai.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "////Ex 4.12\n", "clc;\n", "clear;\n", "close;\n", "format('v',6);\n", "Beta=0.06;//feedback factor\n", "fo=100;//Hz\n", "AOL=40000;//unitless(at dc)\n", "SFdc=1+AOL*Beta;//sacrifice factor at dc\n", "f=1;//kHz\n", "f=f*10^3;//Hz\n", "SF1=1+AOL*Beta/sqrt(1+f^2/fo^2);//sacrifice factor at 1 kHz\n", "//(a)\n", "ACL=AOL/SFdc;//(unitless)exact close loop gain at dc\n", "disp(ACL,'Exact close loop gain at dc');\n", "//(b)\n", "ACL=1/Beta;//(unitless)approximate close loop gain at dc\n", "disp(ACL,'Approximate close loop gain at dc');\n", "//(c)\n", "AOL=3980;//unitless(at dc)\n", "ACL=AOL/SF1;//(unitless)exact close loop gain at 1kHz\n", "disp(ACL,'Exact close loop gain at 1kHz');" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 4.13: Input_and_output_impedence.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "////Ex 4.13\n", "clc;\n", "clear;\n", "close;\n", "format('v',5);\n", "Beta=0.04;//feedback factor\n", "AOL=5000;//unitless(at dc)\n", "Rio=40;//kohm\n", "Ro=1;//kohm\n", "SF=1+AOL*Beta;//sacrifice factor at dc\n", "Rif=Rio/SF*1000;//ohm\n", "disp(Rif,'Input impedence(ohm)');\n", "Rof=Ro*1000/SF;//ohm\n", "disp(Rof,'Output impedence(ohm)');" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 4.1: Bandwidth_with_feedback.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "////Ex 4.1\n", "clc;\n", "clear;\n", "close;\n", "format('v',9);\n", "AOL=2*10^5;//unitless\n", "fo=5;//Hz\n", "ACL=100;//unitless\n", "SF=AOL/ACL;//unitless\n", "fodash=SF*fo;//Hz\n", "disp(fodash/1000,'Bandwidth with feedback(kHz)');" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 4.2: Acl_Rif_Rof_fodash.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "////Ex 4.2\n", "clc;\n", "clear;\n", "close;\n", "format('v',6);\n", "AOL=2*10^5;//unitless\n", "Ri=1.5;//kohm\n", "Rf=12;//kohm\n", "Rio=1;//Mohm\n", "Ro=100;//ohm\n", "fo=5;//Hz\n", "Beta=Ri/(Ri+Rf);//unitless\n", "SF=(1+AOL)*Beta;//unitless\n", "ACL=AOL/SF;//unitless\n", "disp(ACL,'Value of ACL');\n", "//In case of ideal opamp\n", "ACL=1+Rf/Ri;//unitless\n", "disp(ACL,'In case of ideal opamp, Value of ACL');\n", "Rif=Rio*SF;//kohm\n", "disp(Rif,'Value of Rif(Mohm)');\n", "disp('This is a large value can be assumed as infity resistance.');\n", "format('v',5);\n", "Rof=Ro/SF;//mohm\n", "disp(Rof*1000,'Value of Rof(mohm)');\n", "fodash=SF*fo;//Hz\n", "disp(fodash/1000,'Bandwidth with feedback, fo_dash(kHz)');\n", "//Answer for Rif in the book has mistake of unit." ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 4.3: Impedence_and_gain.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "////Ex 4.3\n", "clc;\n", "clear;\n", "close;\n", "format('v',9);\n", "AOL=%inf;//unitless\n", "Rio=%inf;//ohm\n", "Ri=1;//kohm\n", "Rf=15;//kohm\n", "SF=%inf;//unitless;//as SF=1+AOL*Beta\n", "Beta=Ri/(Ri+Rf);//unitless\n", "ACL=1/Beta;//unitless\n", "disp(Rio,'Input impedence(ohm) for ideal opamp is ');\n", "disp(ACL,'Gain of the circuit, ACL');" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 4.4: Input_and_output_impedence.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "////Ex 4.4\n", "clc;\n", "clear;\n", "close;\n", "format('v',9);\n", "AOL=400;//unitless\n", "Rio=500;//kohm\n", "Ro=75;//ohm\n", "ACL=100;//unitless\n", "SF=AOL/ACL;//unitless\n", "Rif=Rio*SF;//kohm\n", "disp(Rif/1000,'Input impedence, Rif(Mohm)');\n", "Rof=Ro/SF;//ohm\n", "disp(Rof,'Output impedence, Rof(ohm)');" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 4.5: Non_Inverting_Amplifier.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "////Ex 4.5\n", "clc;\n", "clear;\n", "close;\n", "format('v',5);\n", "ACL=200;//unitless\n", "AOL=2*10^5;//unitless\n", "Rio=2;//Mohm\n", "Ro=75;//ohm\n", "Ri=1;//kohm(Assumed)\n", "SF=AOL/ACL;//unitless\n", "Beta=(SF-1)/AOL;//unitless\n", "Rf=Ri*(1-Beta)/Beta;//kohm\n", "disp(Ri,'Input impedence, Rif(kohm)');\n", "disp(Rf,'Feedback impedence, Rf(kohm)');" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 4.6: Close_Loop_Voltage_Gai.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "////Ex 4.6\n", "clc;\n", "clear;\n", "close;\n", "format('v',5);\n", "AOL=50;//unitless\n", "Beta=0.8;//unitless\n", "deltaAOL=-20;//%(Change in open loop gain)\n", "deltaBeta=15;//%(Change in feedback factor)\n", "AOLnew=AOL+AOL*deltaAOL/100;//unitless(AOL after change)\n", "Betanew=Beta+Beta*deltaBeta/100;//unitless(Beta after change)\n", "ACL=AOLnew/(1+AOLnew*Betanew);//unitless\n", "disp(ACL,'Close loop gain, ACL');" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 4.7: Acl_Rif_Rof.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "////Ex 4.7\n", "clc;\n", "clear;\n", "close;\n", "format('v',5);\n", "AOL=500;//unitless\n", "Rio=300;//kohm\n", "Ro=100;//ohm\n", "ACL=AOL/(1+AOL);//unitless\n", "Rif=Rio*(1+AOL)/1000;//Mohm\n", "Rof=Ro/(1+AOL);//ohm\n", "disp(ACL,'Close loop gain, ACL');\n", "disp(Rif,'Value of Rif(Mohm)');\n", "disp(Rof,'Value of Rof(ohm)');" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 4.8: Output_Voltage.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "////Ex 4.8\n", "clc;\n", "clear;\n", "close;\n", "format('v',5);\n", "Iin=1;//mA\n", "Rf=1;//kohm\n", "IB=0;//for ideal opamp\n", "If=Iin-IB;//mA\n", "Vout=-If*Rf;//V\n", "disp(Vout,'Output Voltage(V)');" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 4.9: Variation_in_output_Voltage.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "////Ex 4.9\n", "clc;\n", "clear;\n", "close;\n", "format('v',5);\n", "I2=1;//mA\n", "Rf=4.7;//kohm\n", "//Case 1st\n", "I1=500;//micro A\n", "Vout1=-I1*10^-6*Rf*10^3;//V\n", "disp(Vout1,'For 500 micro A current, Output Voltage(V)');\n", "//Case 2nd\n", "I2=1;//mA\n", "Vout2=-I2*10^-3*Rf*10^3;//V\n", "disp(Vout2,'For 1 mA current, Output Voltage(V)');\n", "deltaVout=Vout2-Vout1;//V\n", "disp(deltaVout,'Variation in Output Voltage(V)');" ] } ], "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 }