{ "metadata": { "name": "", "signature": "sha256:b8c93f0ed8e762e74a7e32d1ae1c9fc9e20a3917843706f0d24d06eedbf42b4e" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Chapter01:INTRODUCTION TO ELECTRONICS" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Ex1.1:pg-17" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# Example1.1: Amplifier gain, power and eficiency\n", "# Amplifier operates at +10-V/-10-V power supply.\n", "A_v=9/1.0; # sinusoidal voltage input of 1V peak and sinusoidal output voltage of 9V peak\n", "I_o=9/1000.0; # 1 kilo ohms load\n", "print A_v,\"= Voltage gain (V/V) \" \n", "print round(20*log10(A_v),1),\"= Voltage gain (dB) \" \n", "I_i=0.0001 # sinusoidal current input of 0.1mA peak\n", "A_i=I_o/I_i;\n", "print A_i,\"= Current gain (A/A) \"\n", "print round(20*log10(A_i),1),\"= Current gain (dB)\"\n", "V_orms = 9/math.sqrt(2);\n", "I_orms = 9/math.sqrt(2);\n", "P_L=V_orms*I_orms; # output power in mW\n", "V_irms=1/math.sqrt(2);\n", "I_irms=0.1/math.sqrt(2);\n", "P_I=V_irms*I_irms; # input power in mW\n", "A_p=P_L/P_I; \n", "print A_p,\"= Power gain (W/W) \"\n", "print round(10*log10(A_p),1),\"= Power gain (dB) \"\n", "P_dc=10*9.5+10*9.5; # amplifier draws a current of 9.5mA from each of its two power supplies\n", "print P_dc,\"= Power drawn from the dc supplies (mW)\"\n", "P_dissipated=P_dc+P_I-P_L;\n", "print round(P_dissipated,1),\"= Power dissipated in the amplifier (mW)\"\n", "n=P_L/P_dc*100;\n", "print round(n,1),\"= Amplifier efficiency in percentage\"" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "9.0 = Voltage gain (V/V) \n", "19.1 = Voltage gain (dB) \n", "90.0 = Current gain (A/A) \n", "39.1 = Current gain (dB)\n", "810.0 = Power gain (W/W) \n", "29.1 = Power gain (dB) \n", "190.0 = Power drawn from the dc supplies (mW)\n", "149.6 = Power dissipated in the amplifier (mW)\n", "21.3 = Amplifier efficiency in percentage\n" ] } ], "prompt_number": 8 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Ex1.2:pg-21" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# Example 1.2: Gain of transistor amplifier\n", "# Amplifier has transfer characteristics v_O=10-(10**-11)*(exp**40*v_1) applies for v_1 is greater than or equal 0V and v_o is greater than or equal to 0.3V\n", "L_l = 0.3; # limit L_-\n", "print round(L_l,2),\"=The limit L_- (V) \"\n", "v_I=1/40.0*math.log((10-0.3)/10**-11); # from the transfer characteristics and v_o=0.3V\n", "print round(v_I,2),\"=v_I in volts \"\n", "L_u=10-10**-11; # obtained by v_I=0 in transfer characteristics\n", "print round(L_u,3),\"=the limit L_+ (V) \"\n", "V_I=1/40.0*math.log((10-5)/10**-11); # V_O=5V\n", "print round(V_I,3),\"=The value of the dc bias voltage that results in V_O=5V (V)\"\n", "A_v=-10**-11*exp(40*V_I)*40; # A_v=dv_O/dv_I\n", "print round(A_v,2),\"=Gain at the operating point (V/V) \"\n", "print \"NOTE the gain is negative that implies the amplifier is an inverting amplifier\"\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "0.3 =The limit L_- (V) \n", "0.69 =v_I in volts \n", "10.0 =the limit L_+ (V) \n", "0.673 =The value of the dc bias voltage that results in V_O=5V (V)\n", "-200.0 =Gain at the operating point (V/V) \n", "NOTE the gain is negative that implies the amplifier is an inverting amplifier\n" ] } ], "prompt_number": 11 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Ex1.3:pg-25" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# Example 1.3 : Overall voltage gain of cthree-stage amplifier\n", "gainloss_in=10**6/(1*10**6+100.0*10**3); # fraction of input signal is obtained using voltage divider rule , gainloss_in= v_i1/v_s\n", "A_v1=10*100000.0/(100000+1000); # A_v1 = v_i2/v_i1 is the voltage gain at first stage\n", "A_v2=100*10000.0/(10000+1000); # A_v2 = v_i3/v_i2 is the voltage gain at second stage\n", "A_v3=100/(100+10.0); # A_v3 = v_L/v_i3 is the voltage gain at the output stage\n", "A_v=A_v1*A_v2*A_v3; # A_v is the total voltage gain \n", "print round(A_v),\" = The overall voltage gain (V/V) \"\n", "print round(20.0*log10(A_v),1),\"= The overall voltage gain (dB) \"\n", "gain_src_ld=A_v*gainloss_in;\n", "print round(gain_src_ld,2),\"= The voltage gain from source to gain (V/V) \"\n", "print round(20.0*log10(gain_src_ld),1),\"= The voltage gain from source to load (dB) \"\n", "A_i=10**4*A_v; # A_i=i_o/i_i=(v_L/100)/(v_i1/10**6)\n", "print \"{:.2e}\".format(A_i),\" = The current gain (A/A)\"\n", "print round(20.0*log10(A_i),1),\"= The current gain (dB) \"\n", "A_p=818*818*10**4; # A_p=P_L/P_I=v_L*i_o/v_i1*i_i\n", "print \"{:.2e}\".format(A_p),\"= The power gain (W/W) \"\n", "print round(10*log10(A_p),1),\"= The power gain (dB) \"" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "818.0 = The overall voltage gain (V/V) \n", "58.3 = The overall voltage gain (dB) \n", "743.88 = The voltage gain from source to gain (V/V) \n", "57.4 = The voltage gain from source to load (dB) \n", "8.18e+06 = The current gain (A/A)\n", "138.3 = The current gain (dB) \n", "6.69e+09 = The power gain (W/W) \n", "98.3 = The power gain (dB) \n" ] } ], "prompt_number": 23 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Ex1.4:pg-29" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# Example1.4 : Bipolar junction transistor\n", "\n", "# 1,4a\n", "# using voltage divider rule the fraction of input signal v_be=v_s*r_pi/(r_pi+R_s)\n", "# output voltage v_o=-g_mv_be(R_L||r_o)\n", "r_pi=2.5*10**3; # (ohm)\n", "R_s=5*10**3; # (ohm)\n", "R_L=5*10**3 # (ohm)\n", "g_m=40*10**-3; # (mho)\n", "r_o=100*10**3; # (ohm)\n", "gain=-(r_pi*g_m*(R_L*r_o/(R_L+r_o)))/(r_pi+R_s); # gain=v_o/v_s\n", "print round(gain,1),\"= The voltage gain (V/V) \"\n", "gain_negl_r_o=-r_pi*g_m*R_L/(r_pi+R_s);\n", "print round(gain_negl_r_o,1),\"= Gain neglecting the effect of r_o (V/V) \"\n", "\n", "# 1.4b\n", "# Bi_b=g_m*v_be\n", "# B is short circuit gain\n", "B=g_m*r_pi;\n", "print B,\"= The short circuit gain (A/A) \"" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "-63.5 = The voltage gain (V/V) \n", "-66.7 = Gain neglecting the effect of r_o (V/V) \n", "100.0 = The short circuit gain (A/A) \n" ] } ], "prompt_number": 26 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Ex1.5:pg-36" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# Example 1.5 : DC gain, 3dB frequency and frequency at which gain=0 of voltage amplifier\n", "\n", "# 1.5b\n", "R_s =20*10**3; # (ohm)\n", "R_i =100.0*10**3; # (ohm)\n", "C_i =60.0*10**-12; # (ohm)\n", "u = 144.0; # (V/V)\n", "R_o = 200.0; # (ohm)\n", "R_L = 1000; # (ohm)\n", "K=u/((1+R_s/R_i)*(1+R_o/R_L));\n", "print K,\"= The dc gain (V/V)\"\n", "print round(20*log10(K),2),\" = The dc gain (dB) \"\n", "w_o=1/(C_i*R_s*R_i/(R_s+R_i));\n", "print \"{:.0e}\".format(w_o),\" = The 3-dB frequency (rad/s) \"\n", "f_o= w_o/2/math.pi;\n", "print round(f_o/1000,1),\" = Frequency (KHz) \"\n", "print \"{:.0e}\".format(100*w_o),\" = unity gain frequency (rad/s)\"\n", "print round(100*f_o/1e6,2),\" = Unity gain frequency (MHz)\"" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "100.0 = The dc gain (V/V)\n", "40.0 = The dc gain (dB) \n", "1e+06 = The 3-dB frequency (rad/s) \n", "159.2 = Frequency (KHz) \n", "1e+08 = unity gain frequency (rad/s)\n", "15.92 = Unity gain frequency (MHz)\n" ] } ], "prompt_number": 39 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Ex1.6:pg-46" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# Example 1.6: Time for the output to reach (V_OH+V_OL)/2\n", "V_DD=5; # (V)\n", "R=1000.0; # (ohm)\n", "R_on=100.0; # (ohm)\n", "V_offset=0.1; # (V)\n", "C=10.0*10**-12; # (F)\n", "V_OH=5; # (V)\n", "V_OL=V_offset+(V_DD-V_offset)*R_on/(R+R_on);\n", "T=R*C;\n", "v_o_t_PLH=(V_OH+V_OL)/2; #to find t_PLH \n", "t_PLH=0.69*T;# t_PLH is low to high propogtion delay\n", "print t_PLH/1e-9,\"= time required for the output to reach (V_OH+V_OL)/2 (miliseconds) \"" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "6.9 = time required for the output to reach (V_OH+V_OL)/2 (miliseconds) \n" ] } ], "prompt_number": 46 } ], "metadata": {} } ] }