summaryrefslogtreecommitdiff
path: root/Electronic_Devices_by_T_L_Floyd/12-The_Operational_Amplifier.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Electronic_Devices_by_T_L_Floyd/12-The_Operational_Amplifier.ipynb')
-rw-r--r--Electronic_Devices_by_T_L_Floyd/12-The_Operational_Amplifier.ipynb373
1 files changed, 373 insertions, 0 deletions
diff --git a/Electronic_Devices_by_T_L_Floyd/12-The_Operational_Amplifier.ipynb b/Electronic_Devices_by_T_L_Floyd/12-The_Operational_Amplifier.ipynb
new file mode 100644
index 0000000..7c36a22
--- /dev/null
+++ b/Electronic_Devices_by_T_L_Floyd/12-The_Operational_Amplifier.ipynb
@@ -0,0 +1,373 @@
+{
+"cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 12: The Operational Amplifier"
+ ]
+ },
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 12.10: Gain_and_phase_lag.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//ex12.10\n",
+"A_v1=40; //all gains are in decibels\n",
+"A_v2=32;\n",
+"A_v3=20;\n",
+"f_c1=2*10^3;\n",
+"f_c2=40*10^3;\n",
+"f_c3=150*10^3;\n",
+"f=f_c1;\n",
+"A_ol_mid=A_v1+A_v2+A_v3;\n",
+"theta_1=phase_shift(f,f_c1);\n",
+"theta_2=phase_shift(f,f_c2);\n",
+"theta_3=phase_shift(f,f_c3);\n",
+"theta_tot=theta_1+theta_2+theta_3;\n",
+"disp(A_ol_mid,'open loop midrange gain in decibels')\n",
+"disp(theta_tot,'total phase lag in degrees')"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 12.11: Closed_loop_bandwidth.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//ex12.11\n",
+"A_ol_mid=150000; //open loop midrange gain\n",
+"B=0.002; //feedback attenuation\n",
+"BW_ol=200; //open loop bandwidth\n",
+"BW_cl=BW_ol*(1+B*A_ol_mid);\n",
+"disp(BW_cl,'closed loop bandwidth in hertz')"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 12.12: Amplifier_bandwidth.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//ex12.12\n",
+"BW=3*10^6; //unity gain bandwidth\n",
+"A_ol=100; //open loop gain\n",
+"disp('non-inverting amplifier')\n",
+"R_f=220*10^3;\n",
+"R_i=3.3*10^3;\n",
+"A_cl=1+(R_f/R_i); //closed loop gain\n",
+"BW_cl=BW/A_cl;\n",
+"disp(BW_cl,'closed loop bandwidth in hertz')\n",
+"disp('inverting amplifier')\n",
+"R_f=47*10^3;\n",
+"R_i=1*10^3;\n",
+"A_cl=-R_f/R_i;\n",
+"BW_cl=BW/(abs(A_cl));\n",
+"disp(BW_cl,'closed loop bandwidth in hertz')"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 12.1: CMRR_opamp.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//ex12.1\n",
+"A_ol=100000; //open loop voltage gain\n",
+"A_cm=0.2; //common mode gain\n",
+"CMRR=A_ol/A_cm;\n",
+"CMRR_dB=20*log10(CMRR);\n",
+"disp(CMRR,'CMRR')\n",
+"disp(CMRR_dB,'CMRR in decibels')"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 12.2: Slew_rate.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//ex12.2\n",
+"del_t=1; // in microseconds\n",
+"//lower limit is -9V and upper limit is 9V from the graph\n",
+"del_V_out=9-(-9);\n",
+"slew_rate=del_V_out/del_t;\n",
+"disp(slew_rate,'slew rate in volts per microseconds')"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 12.3: Non_inverting_amplifier.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//ex12.3\n",
+"R_f=100*10^3;\n",
+"R_i=4.7*10^3;\n",
+"A_cl_NI=1+(R_f/R_i);\n",
+"disp(A_cl_NI,'closed loop voltage gain')"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 12.4: Inverting_amplifier.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//ex12.4\n",
+"R_i=2.2*10^3;\n",
+"A_cl=-100; //closed loop voltage gain\n",
+"R_f=abs(A_cl)*R_i;\n",
+"disp(R_f,'value of R_f in ohms')"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 12.5: Impedance_noninverting_amplifier.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//ex12.5\n",
+"Z_in=2*10^6;\n",
+"Z_out=75;\n",
+"A_ol=200000;\n",
+"R_f=220*10^3;\n",
+"R_i=10*10^3;\n",
+"B=R_i/(R_i+R_f); //B is attenuation\n",
+"Z_in_NI=(1+A_ol*B)*Z_in;\n",
+"Z_out_NI=Z_out/(1+A_ol*B);\n",
+"A_cl_NI=1+(R_f/R_i);\n",
+"disp(Z_in_NI,'input impedance in ohms')\n",
+"disp(Z_out_NI,'output impedance in ohms')\n",
+"disp(A_cl_NI,'closed loop voltage gain')"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 12.6: Voltage_follower_impedance.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//ex12.6\n",
+"B=1; //voltage follower configuration\n",
+"A_ol=200000;\n",
+"Z_in=2*10^6;\n",
+"Z_out=75;\n",
+"Z_in_VF=(1+A_ol)*Z_in;\n",
+"Z_out_VF=Z_out/(1+A_ol);\n",
+"disp(Z_in_VF,'input impedance in ohms')\n",
+"disp(Z_out_VF,'output impedance in ohms')"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 12.7: Impedance_inverting_amplifier.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//ex12.7\n",
+"R_i=1*10^3;\n",
+"R_f=100*10^3;\n",
+"Z_in=4*10^6;\n",
+"Z_out=50;\n",
+"A_ol=50000;\n",
+"B=R_i/(R_i+R_f); //attenuation\n",
+"Z_in_I=R_i; //almost equal to R_i\n",
+"Z_out_I=Z_out/(1+(A_ol*B));\n",
+"A_cl_I=-R_f/R_i;\n",
+"disp(Z_in_I,'input impedance in ohms')\n",
+"disp(Z_out_I,'output impedance in ohms')\n",
+"disp(A_cl_I,'closed loop voltage gain')"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 12.8: Open_Loop_gain.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//ex12.8\n",
+"f_c_ol=100;\n",
+"A_ol_mid=100000;\n",
+"f=0;\n",
+"A_ol=open_loop_gain(A_ol_mid,f,f_c_ol)\n",
+"disp(A_ol,'open loop gain when f=0Hz');\n",
+"f=10;\n",
+"A_ol=open_loop_gain(A_ol_mid,f,f_c_ol)\n",
+"disp(A_ol,'open loop gain when f=10Hz')\n",
+"f=100;\n",
+"A_ol=open_loop_gain(A_ol_mid,f,f_c_ol)\n",
+"disp(A_ol,'open loop gain when f=100Hz')\n",
+"f=1000;\n",
+"A_ol=open_loop_gain(A_ol_mid,f,f_c_ol)\n",
+"disp(A_ol,'open loop gain when f=1000Hz')"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 12.9: phase_RC_lag.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//ex12.9\n",
+"f_c=100;\n",
+"f=1;\n",
+"theta=phase_shift(f,f_c);\n",
+"disp(theta,'phase lag when f=1Hz (in degrees)')\n",
+"f=10;\n",
+"theta=phase_shift(f,f_c);\n",
+"disp(theta,'phase lag when f=10Hz (in degrees)')\n",
+"f=100;\n",
+"theta=phase_shift(f,f_c);\n",
+"disp(theta,'phase lag when f=100Hz (in degrees)')\n",
+"f=1000;\n",
+"theta=phase_shift(f,f_c);\n",
+"disp(theta,'phase lag when f=1000Hz (in degrees)')\n",
+"f=10000;\n",
+"theta=phase_shift(f,f_c);\n",
+"disp(theta,'phase lag when f=10000Hz (in degrees)')"
+ ]
+ }
+],
+"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
+}