diff options
Diffstat (limited to 'Basic_Electronics_by_R_D_S_Samuel')
8 files changed, 8720 insertions, 0 deletions
diff --git a/Basic_Electronics_by_R_D_S_Samuel/1-PN_Junction_Diode.ipynb b/Basic_Electronics_by_R_D_S_Samuel/1-PN_Junction_Diode.ipynb new file mode 100644 index 0000000..abe1a52 --- /dev/null +++ b/Basic_Electronics_by_R_D_S_Samuel/1-PN_Junction_Diode.ipynb @@ -0,0 +1,913 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 1: PN Junction Diode" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.1_11: Find_the_forward_and_reverse_resistance_and_cut_in_voltage_for_diode.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 1.11')\n", +"printf('\n')\n", +"disp('findout resistance and cut in voltage')\n", +"printf('Given\n')\n", +"disp('forward current=100mA,Vr=25V,cut in voltage=0.7v,reverse current=100nA')\n", +"//all the values are from fig 1.10\n", +"Vf=0.35\n", +"If=80*10^-3 //forward current\n", +"Vr=40 \n", +"Ir=10^-6 //reverse current\n", +"Rf=Vf/If \n", +"Rr=Vr/Ir\n", +"printf('static forward resistance=\n%f ohm\n',Rf)\n", +"printf('static reverse resistance=\n%f ohm\n',Rr)\n", +"//from the characteristic curve we can find cut in voltage\n", +"printf('cut in voltage= 0.3V')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.1_20: Find_the_dynamic_resistance.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 1.20')\n", +"printf('\n')\n", +"disp('calculate dynamic and substrate resistance')\n", +"printf('Given\n')\n", +"disp('forward current=20mA,cut in voltage=0.33v')\n", +"If=20*10^-3\n", +"Vf=0.33\n", +"Rf=Vf/If\n", +"If1=If-(10^-2) //min forward current \n", +"If2=If+(10^-2) //max forward current\n", +"Vf1=0.31\n", +"Vf2=0.35\n", +"rd=(Vf2-Vf1)/(If2-If1)\n", +"rd1=0.026/If\n", +"rsub=rd-rd1\n", +"printf('static forward resistance=\n%f ohm\n',Rf)\n", +"printf('Dynamic resistance=\n%f ohm\n',rd)\n", +"printf('Dynamic resistance using forward current=\n%f ohm\n',rd1)\n", +"printf('substrate resistance=\n%f ohm\n',rsub)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.1_24: calculate_current_in_circuit_in_fig_18.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 1.24')\n", +"printf('\n')\n", +"disp('calculate the current in the circuit in fig 1.18')\n", +"//given\n", +"V=12\n", +"R1=10^3\n", +"R2=2*10^3\n", +"//current\n", +"I=V/(R1+R2)\n", +"printf('current in the circuit=%f Ampere',I)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.1_25: calculate_diode_current.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 1.25')\n", +"printf('\n')\n", +"disp('calculate the diode current')\n", +"//given\n", +"V=12\n", +"R=10^3\n", +"Vd=0.7\n", +"//diode current\n", +"I=(V-Vd)/R\n", +"printf('Diode current=%f Ampere',I)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.1_26: calculate_diode_current_across_2_diodes.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 1.26')\n", +"printf('\n')\n", +"disp('calculate the diode current across 2 diodes')\n", +"//given\n", +"V=12\n", +"Vd1=0.7\n", +"Vd2=0.7\n", +"R=10^3\n", +"//current\n", +"I=(V-(Vd1+Vd2))/R\n", +"printf('Diode current =%f Ampere',I)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.1_27: find_the_forward_current_in_circuit_of_fig_22.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 1.27')\n", +"printf('\n')\n", +"disp('find the forward current in circuit of fig 1.22')\n", +"//given\n", +"V=9\n", +"Vd=0.3\n", +"R=3.3*10^3\n", +"//current\n", +"I=(V-Vd)/R\n", +"printf('forward current=%f Ampere',I)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.1_28: find_out_battery_voltage.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 1.28')\n", +"printf('\n')\n", +"disp('find out battery voltage')\n", +"//given\n", +"R=2.7*10^3\n", +"Vd=0.7\n", +"I=1.96*10^-3\n", +"//battery voltage\n", +"V=(I*R)+Vd\n", +"printf('battery voltage=%f volt',V)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.1_29: find_out_series_resistance.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 1.29')\n", +"printf('\n')\n", +"disp('find out series resistance')\n", +"//given\n", +"V=4.5\n", +"Vd=0.3\n", +"I=1.25*10^-3\n", +"//series resistance\n", +"R=(V-Vd)/I\n", +"printf('series resistance=%f ohm',R)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.1_31: Plot_the_piecewise_linear_characterisic_of_si_diode.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 1.31')\n", +"printf('\n')\n", +"disp('Plot the piecewise-linear characteristic of silicon diode')\n", +"printf('Given\n')\n", +"//given\n", +"Vf=[0 0.7 0.74]\n", +"If=[0 0 0.2]\n", +"plot2d(Vf, If)\n", +"xlabel('Vf')\n", +"ylabel('If')\n", +"xtitle('Piecewise-linear characteristic of diode')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.1_32: Plot_the_piecewiselinear_characterisic_of_Germanium_diode.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 1.32')\n", +"printf('\n')\n", +"disp('Plot the piecewise-linear characterisic of Germanium diode')\n", +"printf('Given\n')\n", +"//given\n", +"Vf=[0 0.3 0.35]\n", +"If=[0 0 0.1]\n", +"plot2d(Vf, If)\n", +"xlabel('Vf')\n", +"ylabel('If')\n", +"xtitle('Piecewise-linear characteristic of diode')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.1_34: find_out_diode_current.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 1.34')\n", +"printf('\n')\n", +"disp('find out diode current')\n", +"//given\n", +"V=2\n", +"Vr=0.6\n", +"rd1=0\n", +"rd2=0.2\n", +"R=14\n", +"//when rd=0\n", +"//diode current\n", +"I1=(V-Vr)/R\n", +"printf('Diode current when rd=0 is \n%f ampere\n',I1)\n", +"//when rd=0.2\n", +"//diode current\n", +"I2=(V-Vr)/(R+rd2)\n", +"printf('Diode current when rd=0.2 is \n%f ampere\n',I2)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.1_35: find_out_series_resistance_in_circuit_fig_32.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 1.35')\n", +"printf('\n')\n", +"disp('find out series resistance in circuit fig 1.32')\n", +"V=3\n", +"rd=0.5\n", +"Vr=0.3\n", +"IF=174*10^-3\n", +"//resistance\n", +"R=(V-Vr-(IF*rd))/IF\n", +"printf('The value of resistance is \n%f ohm\n',R)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.1_48: Find_the_maximum_forward_current_at_25c.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 1.48')\n", +"printf('\n')\n", +"disp('Find the maximum forward current')\n", +"T1=25 //to find maximum forward current at this temperature\n", +"T2=65 //to find maximum forward current at this temperature\n", +"PT1=600*10^-3 //maximum power dissipation at 25c\n", +"D=5*10^-3 //derating factor\n", +"VT1=0.6 //forward voltage drop(constant at all temperature)\n", +"VT2=VT1\n", +"IT1=PT1/VT1 //maximum forward current at T1\n", +"PT2=PT1-((T2-T1)*D)\n", +"IT2=PT2/VT2 //maximum forward current at T2\n", +"printf('Forward current at temperature T1=\n%f Ampere\n',IT1)\n", +"printf('Forward current at temperature T2=\n%f Ampere\n',IT2)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.1_49: Find_the_maximum_forward_current_at_25c_and_80c_and_plot_power_temperature_curve.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 1.49')\n", +"printf('\n')\n", +"disp('find the maximum forward current at 25c and 80c')\n", +"printf('Given\n')\n", +"T1=25 //to find maximum forward current at this temperature\n", +"T2=80 //to find maximum forward current at this temperature\n", +"VT1=0.65 //forward voltage drop(constant at all temperature)\n", +"VT2=VT1\n", +"PT1=80*10^-3 //maximum power dissipation at 80c\n", +"PT2=30*10^-3 //maximum power dissipation at 30c\n", +"IT1=PT1/VT1\n", +"IT2=PT2/VT2\n", +"T=[0 25 80 114]\n", +"P=[80 80 30 0]\n", +"plot2d(T,P)\n", +"xlabel('Temperature in c')\n", +"ylabel('Power in mW')\n", +"xtitle('Power-Temperature curve')\n", +"printf('Forward current at T1=\n%f Ampere\n',IT1)\n", +"printf('Forward current at T2=\n%f Ampere\n',IT2)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.1_50: Find_maximum_forward_current_at_80c.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 1.50')\n", +"printf('\n')\n", +"disp('Find the maximum power at 80c')\n", +"T1=25\n", +"PT1=1000*10^-3 //maximum power dissipation at 25c\n", +"T2=80 \n", +"D=4*10^-3 //derating factor\n", +"PT2=PT1-((T2-T1)*D) //maximum power dissipation at 80c\n", +"printf('Maximum Power dissipated at 80c=\n%f watt\n',PT2)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.1_51: Find_maximum_forward_current_at_75c_and_draw_power_temperature_curve.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 1.51')\n", +"printf('\n')\n", +"disp('Find the maximum forward current and Draw power spectrum curve')\n", +"printf('Given\n')\n", +"T1=25\n", +"PT1=1000*10^-3 //maximum power dissipation at 25c\n", +"//Average current\n", +"IT1=500*10^-3 \n", +"IT2=IT1\n", +"VT2=0.8 //forward voltage drop\n", +"D=10^-2\n", +"PT2=VT2*IT2 \n", +"T2=((PT1-PT2)/D)+T1\n", +"//to caculate maximum forward current at 75c\n", +"T2!=75\n", +"PT2!=PT1-((T2!-T1)*D)\n", +"IT2=PT2!/VT2\n", +"//for(T>25), to draw graph\n", +" vd=10^-2\n", +" PT=(1000-(75*10))*10^-3 //maximum power dissipation at 100c\n", +"Temp=[0 25 100 125] \n", +"p=[1000 1000 PT*10^3 0]\n", +"plot2d(Temp ,p)\n", +"xlabel('Temperature in c')\n", +"ylabel('Power in mW')\n", +"xtitle('Power-Temperature Curve')\n", +"printf('Maximum forward current at 75c=\n%f Ampere\n',IT2)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.1_54: Find_the_forward_voltage_drop_at_100c_and_dynamic_resistance_at_25c_and_100c.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 1.54')\n", +"printf('\n')\n", +"disp('Find the forward voltage drop at 100c and dynamic resistance')\n", +"T1=25\n", +"T2=100\n", +"Vft1=0.6 //forward voltage drop at 25c\n", +"IT1=26*10^-3 //forward current(constant)\n", +"IT2=IT1\n", +"//for silicon diode we know that \n", +"v=(-1.8*10^-3)\n", +"Vft2=Vft1+((T2-T1)*v) \n", +"IF=26*10^-3\n", +"rd1=(26*10^-3/IF)*((T1+273)/298)\n", +"rd2=(26*10^-3/IF)*((T2+273)/298)\n", +"printf('Forward voltage drop at 100c=\n%f volt\n',Vft2)\n", +"printf('Dynamic resistance at 25c and 100c=\n%f ohm\n%f ohm\n',rd1,rd2)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.1_55: Find_the_maximum_and_mini_forward_voltage_drop_and_dynamic_resistance.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 1.55')\n", +"printf('\n')\n", +"disp('Calculate maximum & minimum forward voltage drop and Junction dynamic resistance')\n", +"T1=80\n", +"T2=10\n", +"T=25\n", +"//for germanium diode\n", +"v=(-2.2*10^-3)\n", +"Vft1=0.3\n", +"Vft2maximum=Vft1+((T2-T)*v) //voltage drop at 10c\n", +"Vft2minimum=Vft1+((T1-T)*v) //voltage drop at 80c\n", +"IF=20*10^-3\n", +"rd1=(26*10^-3/IF)*((T2+273)/298)\n", +"rd2=(26*10^-3/IF)*((T1+273)/298)\n", +"printf('Maximum and Minimum Forward voltage drop at 25c and 10c=\n%f volt\n%f volt\n',Vft2maximum,Vft2minimum)\n", +"printf('Dynamic resistance at 10c and 80c=\n%f ohm\n%f ohm\n',rd1,rd2)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.1_56: Find_the_max_forward_current_and_voltage_and_dynamic_resistance.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 1.56')\n", +"printf('\n')\n", +"disp('To find maximum forward current at 25c & 75c and Forward voltage drop and Dynamic resistance')\n", +"PT1=1.5\n", +"VT1=0.9\n", +"D=7.5*10^-3\n", +"//for silicon diodes \n", +"v=(-1.8*10^-3)\n", +"IF=20*10^-3\n", +"T1=25\n", +"T2=75\n", +"IT1=PT1/VT1\n", +"PT2=PT1-((T2-T1)*D)\n", +"IT2=PT2/VT1 //assume voltage drop remains constant at all temperature\n", +"VF2=VT1+((T2-T1)*v)\n", +"rd1=(26*10^-3/IF)*((T1+273)/298)\n", +"rd2=(26*10^-3/IF)*((T2+273)/298)\n", +"printf('Maximum forward current at 25c & 75c =\n%f Ampere\n%f Ampere\n',IT1,IT2)\n", +"printf('Forward voltage drop at 75c=\n%f volt\n',VF2)\n", +"printf('Dynamic resistance at 25c and 75c=\n%f ohm\n%f ohm\n',rd1,rd2)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.1_57: Find_the_diode_currents_at_25c_and_100c.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 1.57')\n", +"printf('\n')\n", +"disp('To find diode current at 25c and 75c')\n", +"RL=150\n", +"//both diode voltage drop as given in fig 1.47\n", +"Vr1=0.7 //for silicon\n", +"Vr2=0.3 //for Germanium\n", +"Vdc=5\n", +"//apply KVL to given circuit\n", +"IF1=(Vdc-(Vr1+Vr2))/RL\n", +"//for silicon diode \n", +"v=(-1.8*10^-3)\n", +"T1=25\n", +"T2=75\n", +"VFT2=Vr1+((T2-T1)*v)\n", +"//for Germanium Diode\n", +"v=(-2.2*10^-3)\n", +"VFT2!=Vr2+((T2-T1)*v)\n", +"IF2=(Vdc-(VFT2!+VFT2))/RL\n", +"printf('Diode current at 25c and 75c =\n%f ampere\n%f ampere\n',IF1,IF2)\n", +"\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.1_65: Find_the_minimal_fall_time.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 1.65')\n", +"printf('\n')\n", +"disp('Find the minimal fall-time')\n", +"//reverse-recovery time is\n", +"trr=4*10^-9\n", +"tfmin=10*trr\n", +"printf('The minimal fall-time for voltage pulses applied=\n%3.2e sec\n',tfmin)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.1_66: Estimate_the_maximum_reverse_recovery_time.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 1.66')\n", +"printf('\n')\n", +"disp('Find the maximum recovery time')\n", +"//fall-time is\n", +"tf=0.5*10^-6\n", +"trrmax=tf/10\n", +"printf('The minimal fall-time for voltage pulses applied=\n%3.2e sec\n',trrmax)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.1_72: Find_the_maximum_current_flow_through_zener.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 1.72')\n", +"printf('\n')\n", +"disp('Find the maximum current flow through Zener diode')\n", +"Vz=7.5 //zener voltage\n", +"Pd1=400*10^-3 //maximum power dissipation at 50c\n", +"T1=50\n", +"T2=100\n", +"D=3.2*10^-3\n", +"//current at 50c\n", +"Izm1=Pd1/Vz\n", +"//current at 100\n", +"Pd2=Pd1-((T2-T1)*D)\n", +"Izm2=Pd2/Vz\n", +"printf('maximum current flow through Zener diode at 50c & 100c=\n%f Ampere\n%f Ampere\n',Izm1,Izm2)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.1_75: Find_the_current_through_zener_at_50c_and_80c.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 1.75')\n", +"printf('\n')\n", +"disp('Find the current through diode at 50c & 80c')\n", +"T1=50\n", +"T2=80\n", +"D=3.2*10^-3\n", +"Pd1=400*10^-3\n", +"Vz=6.2\n", +"//at 50c\n", +"Izm1=Pd1/Vz\n", +"//at 80c\n", +"Pd2=Pd1-((T2-T1)*D)\n", +"Izm2=Pd2/Vz\n", +"printf('the current through diode at 50c & 80c=\n%f ampere\n%f ampere\n',Izm1,Izm2)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.1_76: Find_the_diode_current_and_power_dissipation.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 1.76')\n", +"printf('\n')\n", +"disp('Find the diode current and power dissipation')\n", +"Vdc=12\n", +"Vz=4.3 //zener voltage\n", +"R=820\n", +"Iz=(Vdc-Vz)/R\n", +"Pd=Vz*Iz\n", +"printf('the diode current=\n%f ampere\n',Iz)\n", +"printf('the power dissipation=\n%f watt\n',Pd)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.1_8: Find_the_forward_and_reverse_resistance_for_diode.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 1.8')\n", +"printf('\n')\n", +"disp('find out resistance')\n", +"printf('Given\n')\n", +"disp('forward current=100mA,Vr=25V,cut in voltage=0.7v,reverse current=100nA')\n", +"//all the values are from fig 1.8\n", +"Vf=0.7\n", +"If=100*10^-3 //forward current\n", +"Vr=25 \n", +"Ir=100*10^-9 //reverse current\n", +"Rf=Vf/If \n", +"Rr=Vr/Ir\n", +"printf('static forward resistance=\n%f ohm\n',Rf)\n", +"printf('static reverse resistance=\n%f ohm\n',Rr)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.1_9: Find_the_forward_and_reverse_resistance_for_diode.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 1.9')\n", +"printf('\n')\n", +"disp('find out resistance')\n", +"printf('Given\n')\n", +"disp('forward current=200mA,Vr=75V,cut in voltage=0.75v,reverse current=50nA')\n", +"//all values are from fig 1.9\n", +"Vf=0.75\n", +"If=200*10^-3 //forward current\n", +"Vr=75 \n", +"Ir=50*10^-9 //reverse current\n", +"Rf=Vf/If \n", +"Rr=Vr/Ir\n", +"printf('static forward resistance=\n%f ohm\n',Rf)\n", +"printf('static reverse resistance=\n%f ohm\n',Rr)" + ] + } +], +"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/Basic_Electronics_by_R_D_S_Samuel/2-Semiconductor_Diode_Applications.ipynb b/Basic_Electronics_by_R_D_S_Samuel/2-Semiconductor_Diode_Applications.ipynb new file mode 100644 index 0000000..af58d84 --- /dev/null +++ b/Basic_Electronics_by_R_D_S_Samuel/2-Semiconductor_Diode_Applications.ipynb @@ -0,0 +1,1409 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 2: Semiconductor Diode Applications" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.2_11: EX2_2_11.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 2.11')\n", +"printf('\n')\n", +"disp('Calculate Peak,ac,dc load current,dc diode voltage,total input power,percentage regulation of HW Rectifier')\n", +"printf('Given\n')\n", +"Rf=20\n", +"RL=1000\n", +"N1=1\n", +"N2=N1\n", +"V1=110\n", +"V2=V1 //since (V1/V2)=(N1/N2)\n", +"Vm=sqrt(2)*V2\n", +"Im=Vm/(Rf+RL) //peak load current\n", +"Idc=Im/%pi //DC load current\n", +"Irms=Im/2 //AC load current\n", +"V!dc=-Idc*RL //DC diode Voltage\n", +"Pi=(Irms)^2*(Rf+RL) //Total power input to circuit\n", +"%reg=(Rf/RL)*100 //percentage regulation\n", +"printf('Peak,DC,AC load current are =\n%f ampere\n%f ampere\n%f ampere\n',Im,Idc,Irms)\n", +"printf('DC Diode voltage =\n%f volt\n',V!dc)\n", +"printf('Total power input to circuit =\n%f watt\n',Pi)\n", +"printf('percentage regulation =\n%f\n',%reg)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.2_12: EX2_2_12.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 2.12')\n", +"printf('\n')\n", +"disp('Calculate DC,RMS load voltage,PIV across diode,Rectification efficiency,DC power delivered to load,Frequency of output waveform ')\n", +"printf('Given\n')\n", +"Rf=50\n", +"RL=500\n", +"N1=10\n", +"N2=1\n", +"V1=230\n", +"Vm=(N2/N1)*V1\n", +"w=314\n", +"f=w/(2*%pi)\n", +"Vdc=(Vm/%pi)/(1+(Rf/RL)) //DC load voltage\n", +"Vrms=(Vm/2)/(1+(Rf/RL)) //RMS load voltage\n", +"PIV=Vm\n", +"%n=40.6/(1+(Rf/RL)) //Rectification efficiency\n", +"Pdc=(Vdc^2)/RL\n", +"printf('DC,RMS load voltage=\n%f volt\n%f volt\n',Vdc,Vrms)\n", +"printf('PIV across the diode =\n%f volt\n',PIV)\n", +"printf('Rectification efficiency=\n%f\n',%n)\n", +"printf('DC power delivered to a load=\n%f watt\n',Pdc)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.2_20: EX2_2_20.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 2.20')\n", +"printf('\n')\n", +"disp('Calculate peak,RMS,DC load current, DC in each diode,DC output voltage,% regulation,PIV,RMS current,DC load voltage')\n", +"printf('Given\n')\n", +"Rf=500\n", +"RL=2000\n", +"V2=280\n", +"//Secondary voltage is\n", +"Vm=sqrt(2)*V2 \n", +"//Peak load current\n", +"Im=Vm/(Rf+RL)\n", +"//DC load current\n", +"Idc=2*Im/(%pi)\n", +"//Since each diode acts as a half-wave rectifier,the dc current through each diode is\n", +"Idc1=Im/(%pi)\n", +"//dc output power\n", +"Pdc=[Idc]^2*RL\n", +"%reg=(Rf/RL)*100\n", +"//PIV across each diode\n", +"PIV=2*Vm\n", +"//RMS load current\n", +"Irms=Im/(sqrt(2))\n", +"//RMS through each diode is\n", +"Irms1=(Im/2)\n", +"//Dc load voltage\n", +"Vdc=Idc*RL\n", +"printf('peak load, DC load current is \n%f ampere\n%f ampere\n',Im,Idc)\n", +"printf('direct current in each diode is \n%f ampere\n',Idc1)\n", +"printf('dc output power is \n%f watt\n',Pdc)\n", +"printf('percentage regulation is \n%f\n',%reg)\n", +"printf('PIV across each diode is \n%f volt\n',PIV)\n", +"printf('rms load current and rms current through each diode is\n%f ampere\n%f ampere \n',Irms, Irms1)\n", +"printf('DC load voltage is \n%f volt\n',Vdc)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.2_21: Find_the_load_current_and_rms_value_of_input_current_of_FW_rectifier.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 2.21')\n", +"printf('\n')\n", +"disp('Find the load current and rms value of input current')\n", +"printf('Given\n')\n", +"V2=100\n", +"Rf=50\n", +"RL=950\n", +"//secondary voltage\n", +"Vm=sqrt(2)*V2\n", +"//DC load current\n", +"Idc=(2*Vm)/(%pi*(Rf+RL))\n", +"//RMS input current is same as RMS load current\n", +"Im=(Idc*%pi)/2\n", +"Irms=Im/sqrt(2)\n", +"printf('The load current=\t%f ampere\n',Idc)\n", +"printf('RMS load current=\t%f ampere\n',Irms)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.2_22: Calculate_Average_load_current_and_voltage_and_Ripple_voltage_of_FW_rectifier.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 2.22')\n", +"printf('\n')\n", +"disp('Calculate Average load current & voltage,Ripple voltage')\n", +"printf('Given\n')\n", +"RL=2000\n", +"//diodes are ideal\n", +"Rf=0\n", +"C=500*10^-6\n", +"f=50\n", +"V2=200\n", +"Vm=sqrt(2)*V2\n", +"//average load current\n", +"Idc=(2*Vm)/(%pi*(Rf+RL))\n", +"//Average load voltage\n", +"Vdc=Idc*RL\n", +"//ripple factor\n", +"V=0.483\n", +"Vac=V*Vdc\n", +"//with capacitor connected across RL\n", +"V1=1/(4*sqrt(3)*RL*C*f)\n", +"//with capacitor filter we have Vdc=Vm\n", +"Vdc1=282.84\n", +"Vac1=V1*Vdc1\n", +"printf('Average load current=\t%f ampere\n',Idc)\n", +"printf('Average load voltage=\t%f ampere\n',Vdc)\n", +"printf('Ripple voltage=\t%f volt\n',Vac)\n", +"printf('Ripple voltage when capacitor connected=\t%f volt\n',Vac1)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.2_23: EX2_2_23.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 2.23')\n", +"printf('\n')\n", +"disp('Calculate Average voltage, rectification efficiency & percentage regulation')\n", +"printf('Given\n')\n", +"V2=30\n", +"RL=100\n", +"Rf=10\n", +"Vm=sqrt(2)*V2\n", +"//Average output voltage\n", +"Vdc=(((2*Vm)/(%pi))/(1+(Rf/RL)))\n", +"//Rectification effeiciency\n", +"nr=0.812/(1+(Rf/RL))\n", +"//percentage regulation\n", +"PR=(Rf/RL)*100\n", +"printf('Average output voltage=\t%f volt\n',Vdc)\n", +"printf('Rectification efficiency=\t%f\n',nr)\n", +"printf('Percentage regulation=\t%f\n',PR)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.2_24: EX2_2_24.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 2.24')\n", +"printf('\n')\n", +"disp('Calculate Average load voltage,RMS load current,PIV,DC o/p power,Frequency of output waveform')\n", +"printf('Given\n')\n", +"V1=220\n", +"N1=10\n", +"N2=1\n", +"V2=V1*(N2/N1)\n", +"Vm=V2\n", +"Rf=20\n", +"RL=1000\n", +"w=314\n", +"f=w/(2*%pi)\n", +"//Average load voltage\n", +"Vdc=(((2*Vm)/(%pi))/(1+(Rf/RL)))\n", +"//RMS load current\n", +"Irms=Vm/(sqrt(2)*(Rf+RL))\n", +"//PIV across each diode\n", +"PIV=2*Vm\n", +"//dc output power\n", +"Pdc=Vdc^2/RL\n", +"//Frequency of output waveform\n", +"Fout=2*f\n", +"printf('average load voltage is \n%f volt\n',Vdc)\n", +"printf('RMS load current is \n%f ampere\n',Irms)\n", +"printf('PIV across each diode is \n %f volt\n',PIV)\n", +"printf('DC ouput power \n%f watt\n',Pdc)\n", +"printf('frequency of output waveform is \n%f hz\n',Fout)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.2_28: Calculate_all_characteristics_of_FW_bridge_rectifier.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 2.28')\n", +"printf('\n')\n", +"disp('Calculate DC output voltage,Ripple factor,Effeciency,PIV,%regulation,Peak diode current, Dc load current, dc current,RMS current')\n", +"printf('Given\n')\n", +"Vm=100\n", +"Rf=25\n", +"RL=950\n", +"//dc output voltage\n", +"Vdc=(((2*Vm)/(%pi))/(1+(2*Rf/RL)))\n", +"//Ripple factor\n", +"Vrms=(Vm/sqrt(2))/(1+(2*Rf/RL))\n", +"r=sqrt((Vrms/Vdc)^2-1)\n", +"//Efficiency of rectification\n", +"Rr=0.812/(1+(2*Rf/RL))\n", +"//PIV across the non-conducting diode\n", +"PIV=Vm\n", +"//Percentage regulation\n", +"%reg=(2*Rf/RL)*100\n", +"//Peak load current\n", +"Im=Vm/(2*Rf+RL)\n", +"//DC load current\n", +"Idc=2*Im/%pi\n", +"//Dc current through each diode\n", +"Idc1=Idc/2\n", +"//RMS current through each diode\n", +"Irms1=Im/2\n", +"printf('dc output voltage \n%f volt\n',Vdc)\n", +"printf('Ripple factor \n%f\n',r)\n", +"printf('Efficiency of rectification \n%f\n',Rr)\n", +"printf('PIV across non-conducting diode \n%f volt \n',PIV)\n", +"printf('percentage regulation \n%f\n',%reg)\n", +"printf('Peak diode current \n%f ampere\n',Im)\n", +"printf('dc load current \n%f ampere\n',Idc)\n", +"printf('dc current through each diode \n %f ampere\n',Idc1)\n", +"printf('RMS current through each diode \n %f ampere\n',Irms1)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.2_29: EX2_2_29.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 2.29')\n", +"printf('\n')\n", +"disp('Calculate Average output voltage,avg load current,frequency of output waveform,dc power output')\n", +"printf('Given\n')\n", +"Vm=141.42\n", +"Rf=0 //Ideal diodes\n", +"RL=100\n", +"f=50\n", +"//Average output voltage\n", +"Vdc=(((2*Vm)/(%pi))/(1+(2*Rf/RL)))\n", +"//Average load current\n", +"Idc=Vdc/RL\n", +"//frequency of output waveform\n", +"Fout=2*f\n", +"//dc power output\n", +"Pdc=Idc^2*RL\n", +"printf('average output voltage \n%f volt\n',Vdc)\n", +"printf('average load current \n%f ampere\n',Idc)\n", +"printf('frequency of output waveform \n%f hz\n',Fout)\n", +"printf('dc output power \n %f watt\n',Pdc)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.2_34: EX2_2_34.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 2.34')\n", +"printf('\n')\n", +"disp('Calculate Ripple factor,DC output voltage,DC load current,PIV,RMS output ripple voltage')\n", +"printf('Given\n')\n", +"Vm=311.13\n", +"f=50\n", +"c=200*10^-6\n", +"RL=1000\n", +"//Ripple factor\n", +"r=1/(2*sqrt(3)*RL*f*c)\n", +"//dc output voltage\n", +"Vdc=Vm/(1+(1/(2*f*c*RL)))\n", +"//DC load current\n", +"Idc=Vdc/RL\n", +"//peak inverse voltage\n", +"PIV=Vm\n", +"//RMS ripple voltage on capacitor\n", +"Vac=r*Vdc\n", +"printf('ripple factor \n%f\n',r)\n", +"printf('dc output voltage \n%f volt\n',Vdc)\n", +"printf(' DC load current \n%f ampere\n',Idc)\n", +"printf('PIV across the diode \n%f volt\n',PIV)\n", +"printf('RMS ripple voltage on capacitor \n%f volt \n',Vac)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.2_35: Calculate_the_capacitance_of_HWR.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 2.35')\n", +"printf('\n')\n", +"disp('Calculate the capacitance')\n", +"f=50\n", +"RL=500\n", +"r=0.1\n", +"C=1/(2*sqrt(3)*f*RL*0.1)\n", +"printf('Capacitance value=\t%f Farad\n',C)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.2_40: EX2_2_40.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 2.40')\n", +"printf('\n')\n", +"disp('Estimate the value of capacitor required to keep ripple factor less than 1%')\n", +"Vm=325.27\n", +"f=50\n", +"Idc=10*10^-3\n", +"r=0.01\n", +"RL=Vm/Idc\n", +"C=(1/r)/(4*sqrt(3)*f*RL)\n", +"printf('capacitor required >\t%e Farad\n',C)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.2_41: EX2_2_41.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 2.41')\n", +"printf('\n')\n", +"disp('Calculate minimum value of capacitance used in the filter to keep ripple voltage below 2%')\n", +"Vm=282.84\n", +"f=50\n", +"Idc=12*10^-3\n", +"r=0.02\n", +"RL=Vm/Idc\n", +"C=(1/r)/(4*sqrt(3)*f*RL)\n", +"printf('capacitor required >\t%e Farad\n',C)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.2_42: Find_Ripple_factor_Dc_output_voltage_Ripple_voltage_DC_load_current_of_FWR.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 2.42')\n", +"printf('\n')\n", +"disp('Find Ripple factor,Dc output voltage,Ripple voltage,DC load current')\n", +"printf('Given\n')\n", +"Vm=282.84\n", +"f=50\n", +"C=500*10^-6\n", +"RL=2*10^3\n", +"//Ripple factor\n", +"r=1/(4*sqrt(3)*RL*f*C)\n", +"//Dc output voltage\n", +"Vdc=Vm/(1+(1/(4*f*C*RL)))\n", +"//Ripple voltage on capacitor\n", +"Vac=r*Vdc\n", +"//DC load current\n", +"Idc=Vdc/RL\n", +"printf('Ripple factor \n%f\n',r)\n", +"printf('dc ouput voltage \n%f volt\n',Vdc)\n", +"printf('Ripple voltage on capacitor \n%f volt\n',Vac)\n", +"printf('DC load current \n %f ampere\n',Idc)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.2_43: EX2_2_43.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 2.43')\n", +"printf('\n')\n", +"disp('Find the ripple factor & output voltage if a capacitor of 160uf is connected in parallel with load')\n", +"RL=250\n", +"C=160*10^-6\n", +"f=50\n", +"Vm=49.497\n", +"//ripple factor\n", +"r=1/(4*sqrt(3)*f*RL*C)\n", +"//Dc output voltage\n", +"Vdc=Vm/(1+(1/(4*f*C*RL)))\n", +"printf('ripple factor \n %f\n',r)\n", +"printf('DC output voltage \n%f volt\n',Vdc)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.2_44: Find_the_ripple_factor_and_DC_load_current_of_FWBR.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 2.44')\n", +"printf('\n')\n", +"disp('Find the ripple factor & DC load current')\n", +"printf('Given\n')\n", +"Vm=230\n", +"f=(314/(2*%pi))\n", +"RL=400\n", +"C=500*10^-6\n", +"//ripple factor\n", +"r=1/(4*sqrt(3)*f*RL*C)\n", +"//DC load current\n", +"Vdc=Vm/(1+(1/(4*f*C*RL)))\n", +"Idc=Vdc/RL\n", +"printf('ripple factor \n %f\n',r)\n", +"printf('DC laod current \n%f ampere\n',Idc)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.2_45: Find_the_capacitor_value_for_half_wave_rectifier.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 2.45')\n", +"printf('\n')\n", +"disp('Find the capacitor value for half wave rectifier')\n", +"Vdc=20\n", +"f=60\n", +"RL=500\n", +"r=0.1/(2*sqrt(3))\n", +"c=1/(2*sqrt(3)*r*f*RL)\n", +"printf('Capacitor value =\t%e farad\n',c)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.2_46: Find_the_capacitor_value_for_full_wave_rectifier.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 2.46')\n", +"printf('\n')\n", +"disp('Find the capacitor value for full wave rectifier')\n", +"printf('Given\n')\n", +"Vdc=20\n", +"f=60\n", +"RL=500\n", +"r=0.1/(2*sqrt(3))\n", +"c=1/(4*sqrt(3)*r*f*RL)\n", +"printf('Capacitor value =\t%e farad\n',c)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.2_50: calculate_load_and_source_effects_and_load_and_line_regulation.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 2.50')\n", +"printf('\n')\n", +"disp('calculate load & source effects & the load & line regulation')\n", +"printf('Given\n')\n", +"Vo1=20\n", +"Vo2=19.7\n", +"//load effect=delVo for delIL(max)\n", +"LE=Vo1-Vo2\n", +"//Load regulation\n", +"LR=(LE*100)/Vo1\n", +"//source effect=delVo for 10% change in Vs\n", +"V=20.2\n", +"SE=V-Vo1\n", +"//Line regulation\n", +"LiR=(SE/Vo1)*100\n", +"printf('load effect \n %f volt\n',LE)\n", +"printf('load regulation \n%f \n',LR)\n", +"printf('source effect \n %f volt\n',SE)\n", +"printf('line regulation \n%f\n',LiR)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.2_51: calculate_load_and_source_effects_and_load_and_line_regulation.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 2.51')\n", +"printf('\n')\n", +"disp('calculate load & source effects & load & line regulation')\n", +"printf('Given\n')\n", +"Vo1=15\n", +"Vo2=14.9\n", +"//load effect=delVo for delIL(max)\n", +"LE=Vo1-Vo2\n", +"//Load regulation\n", +"LR=LE*100/Vo1\n", +"//source effect=delVo for 10% change in Vs\n", +"V=14.95\n", +"SE=Vo1-V\n", +"//Line regulation\n", +"LiR=(SE/Vo1)*100\n", +"printf('load effect \n %f volt\n',LE)\n", +"printf('load regulation \n%f \n',LR)\n", +"printf('source effect \n %f volt\n',SE)\n", +"printf('line regulation \n%f\n',LiR)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.2_54: Design_the_Zener_Diode_Voltage_regulator_for_given_specification.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 2.54')\n", +"printf('\n')\n", +"disp('Design the Zener Diode Voltage regulator for given specification')\n", +"printf('Given\n')\n", +"printf('1 Resistance are in ohms \n 2 Current are in ampere \n 3 voltage sources are in volt\n')\n", +"//unregulated dc input voltage\n", +"Vimin=8\n", +"Vimax=12\n", +"//regulated dc output voltage\n", +"Vo=5\n", +"//minimum zener current\n", +"Izmin=5*10^-3\n", +"//maximum zener current\n", +"Izmax=80*10^-3\n", +"//load current\n", +"ILmin=0\n", +"ILmax=20*10^-3\n", +"//load resistance\n", +"RL=Vo/ILmax\n", +"//maximum Resistance\n", +"Rmax=(Vimin-Vo)/(Izmin+ILmax)\n", +"//minimum resistance\n", +"Rmin=(Vimax-Vo)/(Izmax+ILmin)\n", +"//Required resistance\n", +"R=(Rmax+Rmin)/2\n", +"printf('minimum resistance %d ohm \n',Rmin)\n", +"printf('maximum resistance %d ohm \n',Rmax)\n", +"printf('required resistance %d ohm \n',R)\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.2_55: Design_a_zener_diode_voltage_regulator_to_meet_following_specification.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 2.55')\n", +"printf('\n')\n", +"disp('Design a zener diode voltage regulator to meet following specification')\n", +"printf('Given\n')\n", +"printf('1 Resistance are in ohms \n 2 Current are in ampere \n 3 voltage sources are in volt\n')\n", +"//unregulated dc input voltage\n", +"Vimin=13\n", +"Vimax=17\n", +"//Load current\n", +"ILmin-0\n", +"ILmax=10*10^-3\n", +"//regulated output voltage\n", +"Vo=10\n", +"//minimum zener current\n", +"Izmin=5*10^-3\n", +"//Maximum power dissipation\n", +"Pzmax=500*10^-3\n", +"//maximum zener current\n", +"Izmax=Pzmax/Vo\n", +"//maximum Resistance\n", +"Rmax=(Vimin-Vo)/(Izmin+ILmax)\n", +"//minimum resistance\n", +"Rmin=(Vimax-Vo)/(Izmax+ILmin)\n", +"//Required resistance\n", +"R=(Rmax+Rmin)/2\n", +"//load resistance\n", +"RLmin=Vo/ILmax\n", +"printf('minimum resistance %d ohm \n',Rmin)\n", +"printf('maximum resistance %d ohm \n',Rmax)\n", +"printf('required resistance %d ohm \n',R)\n", +"printf('load resistance %d ohm \n',RLmin)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.2_56: Design_a_zener_diode_voltage_regulator_to_meet_following_specification.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 2.56')\n", +"printf('\n')\n", +"disp('Design a zener diode voltage regulator to meet following specification')\n", +"printf('Given\n')\n", +"printf('1 Resistance are in ohms \n 2 Current are in ampere \n 3 voltage sources are in volt\n')\n", +"//dc input voltage\n", +"Vimin=20\n", +"Vimax=Vimin\n", +"//dc output voltage\n", +"Vo=10\n", +"//load current\n", +"ILmin=0\n", +"ILmax=20*10^-3\n", +"//minimum zener current\n", +"Izmin=10*10^-3\n", +"//maximum zener current\n", +"Izmax=100*10^-3\n", +"//load resistance\n", +"RLmin=Vo/ILmax\n", +"//maximum Resistance\n", +"Rmax=(Vimin-Vo)/(Izmin+ILmax)\n", +"//minimum resistance\n", +"Rmin=(Vimax-Vo)/(Izmax+ILmin)\n", +"//Required resistance\n", +"R=(Rmax+Rmin)/2\n", +"printf('minimum resistance %d ohm \n',Rmin)\n", +"printf('maximum resistance %d ohm \n',Rmax)\n", +"printf('required resistance %d ohm \n',R)\n", +"printf('load resistance %d ohm \n',RLmin)\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.2_57: EX2_2_57.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 2.57')\n", +"printf('\n')\n", +"disp('Calculate the value of series resistance & Zener diode current when load is 1200ohm')\n", +"printf('Given\n')\n", +"printf('1 Resistance are in ohms \n 2 Current are in ampere \n 3 voltage sources are in volt\n')\n", +"//Input voltage\n", +"Vi=32\n", +"//Zener diode voltage\n", +"Vz=24\n", +"//maximum power\n", +"Pzmax=600*10^-3\n", +"//output voltage\n", +"Vo=24 \n", +"//since Vi has no variation\n", +"Vimax=32\n", +"Vimin=Vimax\n", +"//Zener current\n", +"Izmax=Pzmax/Vz\n", +"//series resistance\n", +"ILmin=0\n", +"R=(Vimax-Vo)/(Izmax+ILmin)\n", +"//Diode current\n", +"RL=1200\n", +"IL=Vo/RL //load current\n", +"I=(Vi-Vo)/R //total current\n", +"IZ=I-IL\n", +"printf('The diode current=\t%f ampere\n',IZ)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.2_58: Design_a_voltage_regulator_using_zener_diode_to_meet_following_specification.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 2.58')\n", +"printf('\n')\n", +"disp('Design a voltage regulator using zener diode to meet following specification')\n", +"printf('Given\n')\n", +"printf('1 Resistance are in ohms \n 2 Current are in ampere \n 3 voltage sources are in volt\n')\n", +"//unregulated dc input voltage\n", +"Vimin=20\n", +"Vimax=30\n", +"//regulated dc output voltage\n", +"Vo=10\n", +"//minimum zener current\n", +"Izmin=2*10^-3\n", +"//maximum zener current\n", +"Izmax=100*10^-3\n", +"//load current\n", +"ILmin=0\n", +"ILmax=25*10^-3\n", +"//load resistance\n", +"RL=Vo/ILmax\n", +"//maximum Resistance\n", +"Rmax=(Vimin-Vo)/(Izmin+ILmax)\n", +"//minimum resistance\n", +"Rmin=(Vimax-Vo)/(Izmax+ILmin)\n", +"//Required resistance\n", +"R=(Rmax+Rmin)/2\n", +"printf('minimum resistance %d ohm \n',Rmin)\n", +"printf('maximum resistance %d ohm \n',Rmax)\n", +"printf('required resistance %d ohm \n',R)\n", +"printf('load resistance %d ohm \n',RLmin)\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.2_59: Design_a_zener_voltage_regulator_to_meet_following_specification.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 2.59')\n", +"printf('\n')\n", +"disp('Design a zener voltage regulator to meet following specification')\n", +"printf('Given\n')\n", +"printf('1 Resistance are in ohms \n 2 Current are in ampere \n 3 voltage sources are in volt\n')\n", +"//DC input voltage\n", +"Vimin=10-2\n", +"Vimax=10+2\n", +"//DC output voltage\n", +"Vo=5\n", +"//Load current\n", +"ILmax=10*10^-3\n", +"ILmin=0\n", +"//zener wattage\n", +"Pzmax=400*10^-3\n", +"Vz=Vo\n", +"//maximum zener current\n", +"Izmax=Pzmax/Vz\n", +"//since Izmin is not given so let us take IZmin=5mA\n", +"Izmin=5*10^-3\n", +"//maximum Resistance\n", +"Rmax=(Vimin-Vo)/(Izmin+ILmax)\n", +"//minimum resistance\n", +"Rmin=(Vimax-Vo)/(Izmax+ILmin)\n", +"//Required resistance\n", +"R=(Rmax+Rmin)/2\n", +"//load resistance\n", +"RL=Vo/ILmax\n", +"printf('minimum resistance %d ohm \n',Rmin)\n", +"printf('maximum resistance %d ohm \n',Rmax)\n", +"printf('required resistance %d ohm \n',R)\n", +"printf('load resistance %d ohm \n',RL)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.2_60: Design_a_zener_voltage_regulator_to_meet_following_specification.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 2.60')\n", +"printf('\n')\n", +"disp('Design a zener voltage regulator to meet following specification')\n", +"printf('Given\n')\n", +"printf('1 Resistance are in ohms \n 2 Current are in ampere \n 3 voltage sources are in volt\n')\n", +"//DC input voltage(10V[+-]20%)\n", +"Vimin=10-2\n", +"Vimax=10+2\n", +"//DC output voltage\n", +"Vo=5\n", +"//Load current\n", +"ILmax=20*10^-3\n", +"ILmin=0\n", +"//zener current\n", +"Izmax=80*10^-3\n", +"Izmin=5*10^-3\n", +"//maximum Resistance\n", +"Rmax=(Vimin-Vo)/(Izmin+ILmax)\n", +"//minimum resistance\n", +"Rmin=(Vimax-Vo)/(Izmax+ILmin)\n", +"//Required resistance\n", +"R=(Rmax+Rmin)/2\n", +"//load resistance\n", +"RL=Vo/ILmax\n", +"printf('minimum resistance %d ohm \n',Rmin)\n", +"printf('maximum resistance %d ohm \n',Rmax)\n", +"printf('required resistance %d ohm \n',R)\n", +"printf('load resistance %d ohm \n',RL)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.2_61: Design_a_zener_voltage_regulator_to_meet_following_specification.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 2.61')\n", +"printf('\n')\n", +"disp('Design a zener voltage regulator to meet following specification')\n", +"printf('Given\n')\n", +"printf('1 Resistance are in ohms \n 2 Current are in ampere \n 3 voltage sources are in volt\n')\n", +"//DC input voltage\n", +"Vimin=12-3\n", +"Vimax=12+3\n", +"//DC output voltage\n", +"Vo=5\n", +"//Load current\n", +"ILmax=20*10^-3\n", +"ILmin=0\n", +"//zener wattage\n", +"Pzmax=500*10^-3\n", +"Vz=Vo\n", +"//maximum zener current\n", +"Izmax=Pzmax/Vz\n", +"//since Izmin is not given so let us take IZmin=5mA\n", +"Izmin=5*10^-3\n", +"//maximum Resistance\n", +"Rmax=(Vimin-Vo)/(Izmin+ILmax)\n", +"//mini resistance\n", +"Rmin=(Vimax-Vo)/(Izmax+ILmin)\n", +"//Required resistance\n", +"R=(Rmax+Rmin)/2\n", +"//load resistance\n", +"RL=Vo/ILmax\n", +"printf('minimum resistance %d ohm \n',Rmin)\n", +"printf('maximum resistance %d ohm \n',Rmax)\n", +"printf('required resistance %d ohm \n',R)\n", +"printf('load resistance %d ohm \n',RL)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.2_63: Design_a_6V_dc_reference_source_to_operate_from_a_16v_supply.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 2.63')\n", +"printf('\n')\n", +"disp('Design a 6V dc reference source to operate from a 16v supply')\n", +"printf('Given\n')\n", +"printf('1 Resistance are in ohms \n 2 Current are in ampere \n 3 voltage sources are in volt\n')\n", +"//output voltage\n", +"Vo=6\n", +"//input voltage\n", +"Vi=16\n", +"//zener power\n", +"Pzmax=400*10^-3\n", +"//zener current maximum\n", +"Izmax=Pzmax/Vo\n", +"//I=Iz+IL & ILmin=0, we have Izmax=I\n", +"//take Izmin=5*10^-3\n", +"Izmin=5*10^-3\n", +"//maximum load current\n", +"ILmax=Izmax-Izmin\n", +"//load resistance\n", +"RLmin=Vo/ILmax\n", +"//series resistance\n", +"R=(Vi-Vo)/Izmax\n", +"printf('maximum load current %d ampere\n',ILmax)\n", +"printf('Load resistance %d ohm\n',RLmin)\n", +"printf('sereies resistance %d ohm\n',R)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.2_64: EX2_2_64.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 2.64')\n", +"printf('\n')\n", +"disp('Design a 8V dc reference source to operate from a 20v supply and find maximum load current')\n", +"printf('Given\n')\n", +"printf('1 Resistance are in ohms \n 2 Current are in ampere \n 3 voltage sources are in volt\n')\n", +"//output voltage\n", +"Vo=8\n", +"//input voltage\n", +"Vi=20\n", +"//zener power\n", +"Pzmax=400*10^-3\n", +"//zener current maximum\n", +"Izmax=Pzmax/Vo\n", +"//I=Iz+IL & ILmin=0, we have Izmax=I\n", +"//take Izmin=5*10^-3\n", +"Izmin=5*10^-3\n", +"//maximum load current\n", +"ILmax=Izmax-Izmin\n", +"//load resistance\n", +"RLmin=Vo/ILmax\n", +"//series resistance\n", +"R=(Vi-Vo)/Izmax\n", +"printf('maximum load current %d ampere\n',ILmax)\n", +"printf('Load resistance %d ohm\n',RLmin)\n", +"printf('sereies resistance %d ohm\n',R)\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.2_65: EX2_2_65.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 2.65')\n", +"printf('\n')\n", +"disp('Calculate circuit current when supply voltage drops to 27V, select suitable components')\n", +"printf('Given\n')\n", +"printf('1 Resistance are in ohms \n 2 Current are in ampere \n 3 voltage sources are in volt\n')\n", +"//input voltage\n", +"Vi=30\n", +"//output voltage\n", +"Vo=9\n", +"//test current(lies b/w Izmin & Izmax)\n", +"Izt=20*10^-3\n", +"//load current(assume zero, no load operation)\n", +"IL=0\n", +"//circuit current\n", +"I=Izt\n", +"//series resistance\n", +"R=(Vi-Vo)/I\n", +"//zener current when Vi drops to 27V\n", +"Vi1=27\n", +"Iz=(Vi1-Vo)/R\n", +"printf('Zener current is %f ampere\n',Iz)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.2_66: Calculate_the_effect_of_a_10per_variation_supply_voltage_on_diode_current.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 2.66')\n", +"printf('\n')\n", +"disp('Calculate the effect of a 10% variation supply voltage on diode current')\n", +"printf('Given\n')\n", +"//input voltage\n", +"Vi=25\n", +"//output voltage\n", +"Vo=10\n", +"//test current(lies b/w Izmin & Izmax)\n", +"Izt=20*10^-3\n", +"//load current(assume zero, no load operation)\n", +"IL=10^-3\n", +"//select R such that\n", +"Iz=Izt\n", +"//series resistance\n", +"R=(Vi-Vo)/(Iz+IL)\n", +"//maximum input voltage \n", +"Vimax=25+2.5\n", +"//minimum input voltage\n", +"Vimin=25-2.5\n", +"//ciruit current\n", +"I1=(Vimax-Vo)/R\n", +"//zener current when Vimax\n", +"Izmax=I1-IL\n", +"//cicuit current when Vimin\n", +"I2=(Vimin-Vo)/R\n", +"//zener current when Vimin\n", +"Izmin=I2-IL\n", +"printf('circuit current when Vimax is %f ampere\n',I1)\n", +"printf('zener current when Vimax is %f ampere\n',Izmax)\n", +"printf('circuit current when Vimin is %f ampere\n',I2)\n", +"printf('zener current when Viin is %f ampere\n',Izmin)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.2_68: EX2_2_68.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 2.68')\n", +"printf('\n')\n", +"disp('Calculate the line regulation, output resistance, load regulation & ripple rejection ratio')\n", +"printf('Given\n')\n", +"printf('1 Resistance are in ohms \n 2 Current are in ampere \n 3 voltage sources are in volt\n')\n", +"//input voltage\n", +"Vi=16\n", +"//output voltage\n", +"Vo=6\n", +"//load current\n", +"ILmax=60*10^-3\n", +"//dynamic impedence\n", +"Zz=7\n", +"//series resistance\n", +"R=150\n", +"//Source effect\n", +"delVi=(10*16)/100\n", +"RL=Vo/ILmax\n", +"//Zz||RL\n", +"Rp=(Zz*RL)/(Zz+RL)\n", +"delVo=(delVi*Rp)/(R+Rp)\n", +"//Line regulation\n", +"LR=(delVo*100)/Vo\n", +"//load effect\n", +"delIL=ILmax\n", +"Ro=(Zz*R)/(Zz+R)\n", +"delVo1=delIL*Ro\n", +"//output resistance\n", +"Rout=Ro\n", +"//Ripple rejection ratio\n", +"VrobyVri=Rp/(R+Rp)\n", +"printf('line regulation is %f \n',LR)\n", +"printf('output resistance is %d ohm\n',Rout)\n", +"printf('Ripple rejection ratio %f \n',VrobyVri)" + ] + } +], +"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/Basic_Electronics_by_R_D_S_Samuel/3-pnp_and_npn_Transistors.ipynb b/Basic_Electronics_by_R_D_S_Samuel/3-pnp_and_npn_Transistors.ipynb new file mode 100644 index 0000000..96e6c66 --- /dev/null +++ b/Basic_Electronics_by_R_D_S_Samuel/3-pnp_and_npn_Transistors.ipynb @@ -0,0 +1,1762 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 3: pnp and npn Transistors" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.3_14: calculate_the_value_of_Ic_Ie_beta_for_a_transistor.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 3.14')\n", +"printf('\n')\n", +"disp('calculate the value of Ic,Ie,beta for a transistor')\n", +"printf('Given\n')\n", +"alpha=0.98\n", +"//base current\n", +"Ib=120*10^-6\n", +"//Value of Ic\n", +"Ic=alpha*Ib/(1-alpha)\n", +"//Value of Ie\n", +"Ie=Ic+Ib\n", +"//value of beta\n", +"beta=alpha/(1-alpha)\n", +"printf('base current \n%f ampere\n',Ib)\n", +"printf('collector current \n%f ampere\n',Ic)\n", +"printf('Emitter current \n%f ampere\n',Ie)\n", +"printf('beta \n%f\n',beta)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.3_15: Find_the_value_of_alpha_and_beta_of_transistor_and_Ib_for_desired_Ic.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 3.15')\n", +"printf('\n')\n", +"disp('Find the value of alpha & beta of transistor and Ib for desired Ic')\n", +"printf('Given\n')\n", +"Ic=1.2*10^-3\n", +"Ib=20*10^-6\n", +"//the value of beta\n", +"beta=Ic/Ib\n", +"//the value of alpha\n", +"alpha=beta/(1+beta)\n", +"//the value of Ib for desired value of Ic=5mA\n", +"Ic1=5*10^-3\n", +"Ib1=Ic1/beta\n", +"printf('beta \n%f\n',beta)\n", +"printf('alpha \n%f\n',alpha)\n", +"printf('base current when collector current is 5mA is \n%f ampere\n',Ib1)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.3_16: calculate_the_value_of_alpha_beta_and_Ib_for_a_transistor.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 3.16')\n", +"printf('\n')\n", +"disp('calculate the value of alpha,Ib,beta for a transistor')\n", +"printf('Given\n')\n", +"//collector current\n", +"Ic=2.5*10^-3\n", +"//emitter current\n", +"Ie=2.55*10^-3\n", +"//Value of alpha\n", +"alpha=Ic/Ie\n", +"//Value of Ib\n", +"Ib=Ie-Ic\n", +"//value of beta\n", +"beta=Ic/Ib\n", +"printf('collector current \n%f ampere\n',Ic)\n", +"printf('Emitter current \n%f ampere\n',Ie)\n", +"printf('alpha \n%f\n',alpha)\n", +"printf('base current \n%f ampere\n',Ib)\n", +"printf('beta \n%f\n',beta)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.3_17: EX3_3_17.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 3.17')\n", +"printf('\n')\n", +"disp('calculate the value of beta for transistor. find new collector current when beta of new transistor is 70')\n", +"printf('Given\n')\n", +"//old transistor\n", +"Ic=3*10^-3\n", +"Ie=3.03*10^-3\n", +"//find Ib\n", +"Ib=Ie-Ic\n", +"//value of beta\n", +"beta=Ic/Ib\n", +"//for new transistor beta=70\n", +"beta1=70\n", +"//the value of Ic\n", +"Ic=beta1*Ib\n", +"printf('base current \n%f ampere\n',Ib)\n", +"printf('beta \n%f\n',beta)\n", +"printf('new value of collector current for beta 70 is \n%f ampere\n',Ic)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.3_18: calculate_the_value_of_Ic_Ie_for_a_transistor_and_Find_beta_for_transistor.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 3.18')\n", +"printf('\n')\n", +"disp('calculate the value of Ic,Ie for a transistor.Find beta for transistor')\n", +"printf('Given\n')\n", +"//For old transistor\n", +"alpha=0.97\n", +"Ib=50*10^-6\n", +"//value of collector current\n", +"Ic=alpha*Ib/(1-alpha)\n", +"//value of emitter current\n", +"Ie=Ic/alpha\n", +"//value of beta\n", +"beta=Ic/Ib\n", +"printf('collector current \n%f ampere\n',Ic)\n", +"printf('Emitter current \n%f ampere\n',Ie)\n", +"printf('beta \n%f\n',beta)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.3_19: EX3_3_19.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 3.19')\n", +"printf('\n')\n", +"disp('calculate the value of Ie,alpha,beta for a transistor and find Ib for new value of Ic')\n", +"printf('Given\n')\n", +"//for old transistor\n", +"Ic=5.25*10^-3\n", +"Ib=100*10^-6\n", +"//value of Ie\n", +"Ie=Ic+Ib\n", +"//value of alpha\n", +"alpha=Ic/Ie\n", +"//value of beta\n", +"beta=Ic/Ib\n", +"//for new value of Ib the Ic value is\n", +"Ic1=15*10^-3\n", +"Ib=Ic1/beta\n", +"printf('emitter current \n%f ampere\n',Ie)\n", +"printf('alpha \n%f\n',alpha)\n", +"printf('beta \n%f\n',beta)\n", +"printf('new base current \n%f ampere\n',Ib)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.3_20: calculate_the_value_of_Ic_and_Ie_for_a_transistor.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 3.20')\n", +"printf('\n')\n", +"disp('calculate the value of Ic,Ie for a transistor')\n", +"printf('Given\n')\n", +"alpha=0.99\n", +"//base current\n", +"Ib=20*10^-6\n", +"//value of collector current\n", +"Ic=alpha*Ib/(1-alpha)\n", +"//value of emitter current\n", +"Ie=Ic+Ib\n", +"printf('base current \n%f ampere\n',Ib)\n", +"printf('collector current \n%f ampere\n',Ic)\n", +"printf('Emitter current \n%f ampere\n',Ie)\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.3_21: calculate_the_value_of_Ic_alpha_beta_for_a_transistor_and_Ic_when_Ib_is_150uA.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 3.21')\n", +"printf('\n')\n", +"disp('calculate the value of Ic,alpha,beta for a transistor and Ic when Ib=150uA')\n", +"printf('Given\n')\n", +"Ic=12.42*10^-3\n", +"Ib=200*10^-6\n", +"//value of Ie\n", +"Ie=Ic+Ib\n", +"//value of alpha\n", +"alpha=Ic/Ie\n", +"//value of beta\n", +"beta=Ic/Ib\n", +"//value of Ic when Ib=150uA\n", +"Ib1=150*10^-6\n", +"Ic=beta*Ib1\n", +"printf('Emitter current \n%f ampere\n',Ie)\n", +"printf('alpha \n%f\n',alpha)\n", +"printf('beta \n%f\n',beta)\n", +"printf('collector current \n%f ampere\n',Ic)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.3_22: calculate_the_value_of_Ib_beta_for_a_transistor_and_Ic_Ie_for_new_value_of_beta.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 3.22')\n", +"printf('\n')\n", +"disp('calculate the value of Ib,beta for a transistor and Ic, Ie for new value of beta')\n", +"printf('Given\n')\n", +"Ic=16*10^-3\n", +"Ie=16.04*10^-3\n", +"//base current\n", +"Ib=Ie-Ic\n", +"//beta value\n", +"beta=Ic/Ib\n", +"//for beta=25\n", +"beta1=25\n", +"Ic1=beta1*Ib\n", +"Ie1=Ic1+Ib\n", +"printf('base current \n%f ampere\n',Ib)\n", +"printf('beta \n%f\n',beta)\n", +"printf('emitter current \n%f ampere\n',Ie1)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.3_25: Find_the_DC_collector_voltage_and_voltage_gain_of_ckt_for_Vi_is_50mV.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 3.25')\n", +"printf('\n')\n", +"disp('Find the DC collector voltage & voltage gain of circuit for Vi=50mV')\n", +"printf('Given\n')\n", +"//base current for Vbe=0.7\n", +"Ib=30*10^-6\n", +"Vbe=0.7\n", +"beta=80\n", +"//collector current\n", +"Ic=beta*Ib\n", +"//given from ckt\n", +"Vcc=20\n", +"Rc=5.8*10^3\n", +"//writing KVL for Common Emitter circuit\n", +"Vc=Vcc-(Ic*Rc)\n", +"//for input characteristics delVi=delVb=50mV\n", +"Vi=50*10^-3\n", +"delIb=5*10^-6\n", +"Ic1=beta*delIb\n", +"//output voltage\n", +"Vo=Ic1*Rc\n", +"//voltage gain\n", +"Av=Vo/Vi\n", +"printf('Dc collector voltage \n%f volt\n',Vc)\n", +"printf('voltage gain \n%f\n',Av)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.3_26: FInd_the_DC_current_gain_for_circuit_fig_15_and_ac_voltage_gain.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 3.26')\n", +"printf('\n')\n", +"disp('FInd the DC current gain for circuit fig 3.15 and ac voltage gain')\n", +"printf('Given\n')\n", +"//to find dc current gain\n", +"//given\n", +"Vcc=15\n", +"Vc=7\n", +"Rc=5.6*10^3\n", +"Ib=20*10^-6\n", +"//to find Vrc\n", +"Vrc=Vcc-Vc\n", +"//collector current\n", +"Ic=Vrc/Rc\n", +"//dc current gain\n", +"betadc=Ic/Ib\n", +"//to find ac voltage gain\n", +"//given\n", +"Vi=50*10^-3\n", +"delIb=10*10^-6\n", +"delIc=betadc*delIb\n", +"//output voltage\n", +"Vo=delIc*Rc\n", +"//voltage gain\n", +"Av=Vo/Vi\n", +"printf('DC current gain \n%f\n',betadc)\n", +"printf('voltage gain \n%f\n',Av)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.3_27: Find_the_parameters_of_the_ckt_of_question_27.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 3.27')\n", +"printf('\n')\n", +"disp('Find the following terms as given in question 3.27')\n", +"printf('Given\n')\n", +"//to find collector voltage\n", +"//given\n", +"Vbe=0.7\n", +"Ib=30*10^-6\n", +"beta=50\n", +"Rc=12*10^3\n", +"Vcc=25\n", +"//collector current\n", +"Ic=beta*Ib\n", +"//collector voltage\n", +"Vc=Vcc-(Ic*Rc)\n", +"//to find voltage gain\n", +"//given\n", +"Vi=50*10^-3\n", +"Ib1=15*10^-6\n", +"Ic1=beta*Ib1\n", +"Vo=Ic1*Rc\n", +"//voltage gain\n", +"Av=Vo/Vi\n", +"//to find Vce\n", +"//given\n", +"Vbe=0.73\n", +"Ib2=40*10^-6\n", +"Ic2=beta*Ib2\n", +"Vce=Vcc-(Ic2*Rc)\n", +"//to find voltage gain when Rc changed to 6.8k\n", +"Rc1=6.8*10^3\n", +"Vo1=Ic1*Rc1\n", +"Av1=Vo1/Vi\n", +"//to find current gain of replaced transistor\n", +"//given\n", +"Vc1=9\n", +"Vrc=Vcc-Vc1\n", +"Ic3=Vrc/Rc\n", +"beta1=Ic3/Ib\n", +"printf('collector voltage \n%f volt \n',Vc)\n", +"printf('Voltage gain for vi=50mv \n%f\n',Av)\n", +"printf('Vce if Vbe=0.73 is \n%f volt\n',Vce)\n", +"printf('Voltage gain when Rc=6.8k \n%f Volt\n',Av1)\n", +"printf('current gain of replaced transistor \n%f\n',beta1)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.3_34: Obtain_the_CB_current_gain_and_output_characteristics.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 3.34')\n", +"printf('\n')\n", +"disp('Obtain the Common base current gain & output characteristics')\n", +"printf('Given\n')\n", +"Vcb=[ 4 4 4 4 4 4 ]\n", +"Ic=[ 0 2 4 6 8 10]\n", +"subplot(221)\n", +"plot2d(Vcb,Ic)\n", +"xlabel('Vcb in volt')\n", +"ylabel('Ic in Ampere')\n", +"xtitle('output characteristics')\n", +"Ic1=[0 2 10 ]\n", +"Ie=[0 2 10 ]\n", +"subplot(222)\n", +"plot2d(Ie,Ic1)\n", +"xarrows(Ie,Ic1,2,2)\n", +"xarrows(Ie,Ic1,10,10)\n", +"xlabel('Vcb in volt')\n", +"ylabel('Ic in Ampere')\n", +"xtitle('current gain characteristics')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.3_46: For_the_circuit_given_draw_a_DC_load_line.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 3.46')\n", +"printf('\n')\n", +"disp('For the circuit shown in example 3.46 draw a DC load line')\n", +"printf('Given\n')\n", +"//to find Vce value when Ic=0\n", +"Ic1=0\n", +"//given\n", +"Rc=12*10^3\n", +"Vcc=20\n", +"//from circuit\n", +"Vce=Vcc-(Ic1*Rc)\n", +"//to find Ic when Vce=0\n", +"Vce1=0\n", +"Ic=Vcc/Rc\n", +"//To draw DC load line\n", +"Vceg=[Vce, Vce1]\n", +"Icg=[Ic1,Ic]\n", +"plot2d(Vceg,Icg)\n", +"xlabel('Vce in volt')\n", +"ylabel('Ic in ampere')\n", +"xtitle('DC Load line for Rc=12Kohm')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.3_50: Draw_a_DC_load_line_for_the_base_bias_circuit.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 3.50')\n", +"printf('\n')\n", +"disp('Draw a DC load line for the base bias circuit')\n", +"printf('Given\n')\n", +"//given\n", +"Rc=2.2*10^3\n", +"Rb=470*10^3\n", +"Vcc=18\n", +"Vbe=0.7\n", +"hFE=100\n", +"//find the Ib\n", +"Ib=(Vcc-Vbe)/Rb // from ciruit\n", +"//find the Ic\n", +"Icq=hFE*Ib\n", +"//find the Vceq\n", +"Vceq=Vcc-(Icq*Rc)\n", +"//to draw Dc load line \n", +"Ic1=Vcc/Rc\n", +"Vce1=Vcc\n", +"Vce=[Vcc Vceq 0]\n", +"Ic=[0 Icq Ic1]\n", +"printf('Q(%f,%f)\n',Vceq,Icq)\n", +"plot2d(Vce, Ic)\n", +"xlabel('Vce in volt')\n", +"ylabel('Ic in Ampere')\n", +"xtitle('DC load line for base bias circuit')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.3_51: Draw_a_DC_load_line_for_the_base_bias_circuit_for_different_hFE.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 3.51')\n", +"printf('\n')\n", +"disp('Draw a DC load line for the base bias circuit for different hFE')\n", +"printf('Given\n')\n", +"//given\n", +"Rc=2.2*10^3\n", +"Rb=470*10^3\n", +"Vcc=18\n", +"Vbe=0.7\n", +"hFE1=50\n", +"hFE2=200\n", +"//find the Ib\n", +"Ib=(Vcc-Vbe)/Rb // from ciruit\n", +"//find the Ic for hFE1\n", +"Icq1=hFE1*Ib\n", +"//find the Vceq1\n", +"Vceq1=Vcc-(Icq1*Rc)\n", +"//find the Ic for hFE2\n", +"Icq2=hFE2*Ib\n", +"//find the Vceq2\n", +"Vceq2=Vcc-(Icq2*Rc)\n", +"//to draw Dc load line \n", +"Ic1=Vcc/Rc\n", +"Vce1=Vcc\n", +"Vce=[Vcc Vceq1 Vceq2 0]\n", +"Ic=[0 Icq1 Icq2 Ic1]\n", +"printf('Q1(%f volt,%f ampere)\n',Vceq1,Icq1)\n", +"printf('Q2(%f volt,%f ampere)\n',Vceq2,Icq2)\n", +"plot2d(Vce, Ic)\n", +"xlabel('Vce in volt')\n", +"ylabel('Ic in ampere')\n", +"xtitle('DC load line for base bias circuit')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.3_52: Find_Ic_and_Vce_and_Draw_a_DC_load_line_for_the_base_bias_circuit.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 3.52')\n", +"printf('\n')\n", +"disp(' Find Ic & Vce. Draw a DC load line for the base bias circuit')\n", +"printf('Given\n')\n", +"//given\n", +"betadc=100\n", +"Vbe=0.7\n", +"Rc=10^3\n", +"Rb=10^5\n", +"Vb=5\n", +"Vc=10\n", +"//to find Ib\n", +"Ib=(Vb-Vbe)/Rb //from ciruit\n", +"//Ic value\n", +"Icq=betadc*Ib\n", +"//Vce value\n", +"Vceq=Vc-(Icq*Rc)\n", +"//to draw DC load line\n", +"Ic1=Vc/Rc\n", +"Vce1=Vc\n", +"Vce=[Vc Vceq 0]\n", +"Ic=[0 Icq Ic1]\n", +"printf('Q(%f volt,%f ampere)\n',Vceq,Icq)\n", +"plot2d(Vce, Ic)\n", +"xlabel('Vce in volt')\n", +"ylabel('Ic in ampere')\n", +"xtitle('DC load line for base bias circuit')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.3_53: Find_Ic_and_Vce_and_Draw_a_DC_load_line_for_the_base_bias_circuit.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 3.53')\n", +"printf('\n')\n", +"disp(' Find Ic & Vce. Draw a DC load line for the base bias circuit')\n", +"printf('Given\n')\n", +"//given\n", +"betadc=50\n", +"Vbe=0.7\n", +"Rc=2.2*10^3\n", +"Rb=240*10^3\n", +"Vc=12\n", +"//to find Ib\n", +"Ib=(Vc-Vbe)/Rb //from ciruit\n", +"//Ic value\n", +"Icq=betadc*Ib\n", +"//Vce value\n", +"Vceq=Vc-(Icq*Rc)\n", +"//to draw DC load line\n", +"Ic1=Vc/Rc\n", +"Vce1=Vc\n", +"Vce=[Vc Vceq 0]\n", +"Ic=[0 Icq Ic1]\n", +"printf('Q(%f volt,%f ampere)\n',Vceq,Icq)\n", +"plot2d(Vce, Ic)\n", +"xlabel('Vce in volt')\n", +"ylabel('Ic in ampere')\n", +"xtitle('DC load line for base bias circuit')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.3_54: Draw_a_DC_load_line_for_the_base_bias_circuit_neglecting_Vbe.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 3.54')\n", +"printf('\n')\n", +"disp(' Draw a DC load line for the base bias circuit neglecting Vbe')\n", +"printf('Given\n')\n", +"//given\n", +"betadc=100\n", +"Rc=5*10^3\n", +"Rb=1.5*10^6\n", +"Vc=30\n", +"//to find Ib\n", +"Ib=Vc/Rb //from ciruit\n", +"//Ic value\n", +"Icq=betadc*Ib\n", +"//Vce value\n", +"Vceq=Vc-(Icq*Rc)\n", +"//to draw DC load line\n", +"Ic1=Vc/Rc\n", +"Vce1=Vc\n", +"Vce=[Vc Vceq 0]\n", +"Ic=[0 Icq Ic1]\n", +"printf('Q(%f volt,%f ampere)\n',Vceq,Icq)\n", +"plot2d(Vce, Ic)\n", +"xlabel('Vce in volt')\n", +"ylabel('Ic in ampere')\n", +"xtitle('DC load line for base bias circuit')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.3_55: Calculate_transistor_hFE_and_new_Vce_level_for_hFE_is_100_of_base_bias_ciruit.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 3.55')\n", +"printf('\n')\n", +"disp('Calculate transistor hFE & new Vce level for hFE=100 of base bias ciruit')\n", +"printf('Given\n')\n", +"//given\n", +"Vcc=24\n", +"Rb=390*10^3\n", +"Rc=3.3*10^3\n", +"Vce=10\n", +"//Find Ic\n", +"Ic=(Vcc-Vce)/Rc //from circuit\n", +"//find Ib\n", +"Ib=(Vcc-Vbe)/Rb //from ciruit\n", +"//the value of hFE\n", +"hFE=Ic/Ib\n", +"//to find Vce when hFE=100\n", +"hFE1=100\n", +"Ic1=hFE1*Ib\n", +"Vce1=Vcc-(Ic1*Rc)\n", +"printf('Value of hFE is \n%f\n',hFE)\n", +"printf('New value of Vce is \n%f volt\n',Vce1)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.3_57: Design_a_Base_bias_circuit.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 3.57')\n", +"printf('\n')\n", +"disp('Design a Base bias circuit')\n", +"printf('Given\n')\n", +"//given\n", +"Vce=5\n", +"Ic=5*10^-3\n", +"Vcc=15\n", +"hFE=100\n", +"//Value of Rc\n", +"Rc=(Vcc-Vce)/Ic\n", +"Ib=Ic/hFE\n", +"//value of Rb\n", +"Vbe=0.7\n", +"Rb=(Vcc-Vbe)/Ib\n", +"printf('The value of Rc=%f ohm\nRb=%f ohm\n',Rc,Rb)\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.3_58: Draw_the_DC_load_line_and_determine_Rc_for_base_bias_circuit.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 3.58')\n", +"printf('\n')\n", +"disp('Draw the DC load line & determine Rc for base bias circuit')\n", +"printf('Given\n')\n", +"//given\n", +"Vcc=18\n", +"Vbe=0.7\n", +"Vceq=9\n", +"Icq=2*10^-3\n", +"//to find Rc\n", +"Rc=(Vcc-Vceq)/Icq //from circuit\n", +"//to draw DC load line\n", +"Ic1=Vcc/Rc\n", +"Vce=[Vcc Vceq 0]\n", +"Ic=[0 Icq Ic1]\n", +"printf('Q(%f volt,%f ampere)\n',Vceq,Icq)\n", +"plot2d(Vce, Ic)\n", +"xlabel('Vce in volt')\n", +"ylabel('Ic in ampere')\n", +"xtitle('DC load line for base bias circuit')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.3_59: Calculate_Base_resistance_for_base_bias_circuit.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 3.59')\n", +"printf('\n')\n", +"disp('Calculate Base resistance for base bias circuit')\n", +"printf('Given\n')\n", +"//given\n", +"Vcc=20\n", +"Vce=5\n", +"Rc=6.8*10^3\n", +"hFE=120\n", +"Vbe=0.7\n", +"//collector current\n", +"Ic=(Vcc-Vce)/Rc\n", +"//base current\n", +"Ib=Ic/hFE\n", +"//the required base resistance\n", +"Rb=(Vcc-Vbe)/Ib\n", +"printf('The base resistance \n%f ohm\n',Rb)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.3_61: Determine_the_Ic_and_Vce_levels_and_draw_DC_load_line_for_Collector_to_base_bias.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 3.61')\n", +"printf('\n')\n", +"disp('Determine the Ic & Vce levels & draw DC load line for Collector to base bias')\n", +"printf('Given\n')\n", +"//given\n", +"Vcc=15\n", +"Vbe=0.7\n", +"hFE=50\n", +"Rc=1.8*10^3\n", +"Rb=39*10^3\n", +"//base current\n", +"Ib=(Vcc-Vbe)/(Rb+(1+hFE)*Rc)\n", +"//collector current\n", +"Icq=hFE*Ib\n", +"//value of Vce\n", +"Vceq=(Ib*Rb)+Vbe\n", +"//to draw DC load line\n", +"Ic1=Vcc/Rc\n", +"Vce=[Vcc Vceq 0]\n", +"Ic=[0 Icq Ic1]\n", +"printf('Q(%f volt,%f ampere)\n',Vceq,Icq)\n", +"plot2d(Vce, Ic)\n", +"xlabel('Vce in volt')\n", +"ylabel('Ic in ampere')\n", +"xtitle('DC load line for base bias circuit')\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.3_62: Determine_the_hFE_and_new_Vce_for_hFE_is_50_for_Collector_to_base_bias.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 3.62')\n", +"printf('\n')\n", +"disp('Determine the hFE and new Vce for hFE=50 for Collector to base bias')\n", +"printf('Given\n')\n", +"//given\n", +"Vcc=15\n", +"Vce=5\n", +"Vbe=0.7\n", +"Rb=82*10^3\n", +"Rc=5.6*10^3\n", +"//base current\n", +"Ib=(Vce-Vbe)/Rb\n", +"//hFE value\n", +"hFE=((Vcc-Vbe)/(Ib*Rc))-(Rb/Rc)-1\n", +"//to find Vce for hFE=50\n", +"hFE1=50\n", +"Ib1=(Vcc-Vbe)/(Rb+(1+hFE1)*Rc)\n", +"Vce1=(Ib1*Rb)+Vbe\n", +"printf('The hFE is \n%f\n',hFE)\n", +"printf('new Vce is \n%fvolt \n',Vce1)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.3_63: Draw_a_DC_load_line_for_Collector_to_base_bias.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 3.63')\n", +"printf('\n')\n", +"disp('Draw a DC load line for Collector to base bias')\n", +"printf('Given\n')\n", +"//given\n", +"Vcc=20\n", +"Vbe=0.7\n", +"hFE=50\n", +"Rc=1.8*10^3\n", +"Rb=39*10^3\n", +"//base current\n", +"Ib=(Vcc-Vbe)/(Rb+(1+hFE)*Rc)\n", +"//collector current\n", +"Icq=hFE*Ib\n", +"//to find Vce\n", +"Vceq=(Ib*Rb)+Vbe\n", +"//to draw DC load line\n", +"Ic1=Vcc/Rc\n", +"Vce=[Vcc Vceq 0]\n", +"Ic=[0 Icq Ic1]\n", +"printf('Q(%f,%f)\n',Vceq,Icq)\n", +"plot2d(Vce, Ic)\n", +"xlabel('Vce')\n", +"ylabel('Ic')\n", +"xtitle('DC load line for base bias circuit')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.3_64: Draw_a_DC_load_line_for_Collector_to_base_bias_for_different_hFE.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 3.64')\n", +"printf('\n')\n", +"disp('Draw a DC load line for Collector to base bias for different hFE')\n", +"printf('Given\n')\n", +"//given\n", +"Vcc=18\n", +"Vbe=0.7\n", +"hFE1=50\n", +"hFE2=200\n", +"Rc=2.2*10^3\n", +"Rb=270*10^3\n", +"//for hFE=50\n", +"//base current\n", +"Ib1=(Vcc-Vbe)/(Rb+(1+hFE1)*Rc)\n", +"//collector current\n", +"Icq1=hFE1*Ib1\n", +"//to find Vce\n", +"Vceq1=(Ib1*Rb)+Vbe\n", +"//for hFE=200\n", +"//base current\n", +"Ib2=(Vcc-Vbe)/(Rb+(1+hFE2)*Rc)\n", +"//collector current\n", +"Icq2=hFE2*Ib2\n", +"//to find Vce\n", +"Vceq2=(Ib2*Rb)+Vbe\n", +"//to draw DC load line\n", +"Ic1=Vcc/Rc\n", +"Vce=[Vcc Vceq1 Vceq2 0]\n", +"Ic=[0 Icq1 Icq2 Ic1]\n", +"printf('Q1(%f volt,%f ampere)\n',Vceq1,Icq1)\n", +"printf('Q2(%f volt,%f ampere)\n',Vceq2,Icq2)\n", +"plot2d(Vce, Ic)\n", +"xlabel('Vce in volt')\n", +"ylabel('Ic in ampere')\n", +"xtitle('DC load line for base bias circuit')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.3_66: Design_a_Collector_to_base_bias_circuit.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 3.66')\n", +"printf('\n')\n", +"disp('Design a Collector to base bias circuit')\n", +"printf('Given\n')\n", +"//Given\n", +"Vce=5\n", +"Ic=5*10^-3\n", +"Vbe=0.7\n", +"Vcc=15\n", +"hFE=100\n", +"//base current\n", +"Ib=Ic/hFE\n", +"//collector resistance\n", +"Rc=(Vcc-Vce)/(Ic+Ib)\n", +"//base resistance\n", +"Rb=(Vce-Vbe)/Ib\n", +"printf('base current %f ampere \n',Ib)\n", +"printf('Collector resistance %f ohm \n',Rc)\n", +"printf('base resistance %f ohm \n',Rb)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.3_67: Design_a_Collector_to_base_bias_circuit.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 3.67')\n", +"printf('\n')\n", +"disp('Design a Collector to base bias circuit')\n", +"printf('Given\n')\n", +"//Given\n", +"Vce=10\n", +"Ic=3*10^-3\n", +"Vbe=0.7\n", +"Vcc=25\n", +"hFE=80\n", +"//base current\n", +"Ib=Ic/hFE\n", +"//collector resistance\n", +"Rc=(Vcc-Vce)/(Ic+Ib)\n", +"//base current\n", +"Rb=(Vce-Vbe)/Ib\n", +"printf('base current %f ampere \n',Ib)\n", +"printf('Collector resistance %f ohm \n',Rc)\n", +"printf('base resistance %f ohm \n',Rb)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.3_68: Calculate_required_base_resistance_for_Collector_to_base_bias_circuit.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 3.68')\n", +"printf('\n')\n", +"disp('Calculate required base resistance for Collector to base bias circuit')\n", +"printf('Given\n')\n", +"//given\n", +"Vcc=30\n", +"Vce=7\n", +"Vbe=0.7\n", +"Rc=8.2*10^3\n", +"hFE=100\n", +"//base current\n", +"Ib=(Vcc-Vce)/(Rc*(1+hFE))\n", +"//base resistance\n", +"Rb=(Vce-Vbe)/Ib\n", +"printf('base resistance is \n%f ohm\n',Rb)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.3_72: Draw_a_DC_load_line_for_Voltage_divider_circuit.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 3.72')\n", +"printf('\n')\n", +"disp('Draw a DC load line for Voltage divider circuit')\n", +"printf('Given\n')\n", +"//given\n", +"Vcc=15\n", +"Rc=2.7*10^3\n", +"Re=2.2*10^3\n", +"R1=22*10^3\n", +"R2=12*10^3\n", +"Vbe=0.7\n", +"//base voltage\n", +"Vb=(Vcc*R2)/(R1+R2)\n", +"//emitter voltage\n", +"Ve=Vb-Vbe\n", +"//emitter current\n", +"Ie=Ve/Re\n", +"//collector current\n", +"Icq=Ie\n", +"//collector to emitter voltage\n", +"Vceq=Vcc-(Icq*(Rc+Re))\n", +"//collector voltage\n", +"Vc=Vce+Ve\n", +"//to draw DC load line\n", +"Ic1=Vcc/(Rc+Re)\n", +"Vce=[Vcc Vceq 0]\n", +"Ic=[0 Icq Ic1]\n", +"printf('Q(%f volt,%f ampere)\n',Vceq,Icq)\n", +"plot2d(Vce, Ic)\n", +"xlabel('Vce in volt')\n", +"ylabel('Ic in ampere')\n", +"xtitle('DC load line for base bias circuit')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.3_73: Find_the_Ve_Ic_Vce_and_Vc_and_Draw_a_DC_load_line_for_Voltage_divider_circuit.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 3.73')\n", +"printf('\n')\n", +"disp('Find the Ve, Ic,Vce & Vc. Draw a DC load line for Voltage divider circuit')\n", +"printf('Given\n')\n", +"//given\n", +"Vcc=18\n", +"Vbe=0.7\n", +"hFE=50\n", +"R1=33*10^3\n", +"R2=12*10^3\n", +"Rc=1.2*10^3\n", +"Re=10^3\n", +"//thevenin voltage\n", +"Vt=(Vcc*R2)/(R1+R2)\n", +"//thevenin resistance\n", +"Rt=(R1*R2)/(R1+R2)\n", +"//base current\n", +"Ib=(Vt-Vbe)/(Rt+(1+hFE)*Re)\n", +"//collector current\n", +"Icq=hFE*Ib\n", +"//emitter current\n", +"Ie=Ib+Icq\n", +"//emitter voltage\n", +"Ve=Ie*Re\n", +"//collector to emitter voltage\n", +"Vceq=Vcc-(Icq*Rc)-(Ie*Re)\n", +"//collector voltage\n", +"Vc=Vce+Ve\n", +"//to draw DC load line\n", +"Ic1=Vcc/(Rc+Re)\n", +"Vce=[Vcc Vceq 0]\n", +"Ic=[0 Icq Ic1]\n", +"printf('Q(%f volt,%f ampere)\n',Vceq,Icq)\n", +"plot2d(Vce, Ic)\n", +"xlabel('Vce in volt')\n", +"ylabel('Ic in ampere')\n", +"xtitle('DC load line for base bias circuit')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.3_74: Find_the_Ve_Ic_Vce_and_Vc_and_Draw_a_DC_load_line_for_Voltage_divider_circuit.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 3.74')\n", +"printf('\n')\n", +"disp('Find the Ve, Ic,Vce & Vc. Draw a DC load line for Voltage divider circuit')\n", +"printf('Given\n')\n", +"//given\n", +"Vcc=15\n", +"Vbe=0.7\n", +"hFE=50\n", +"R1=6.8*10^3\n", +"R2=3.3*10^3\n", +"Rc=0.9*10^3\n", +"Re=0.9*10^3\n", +"//thevenin voltage\n", +"Vt=(Vcc*R2)/(R1+R2)\n", +"//thevenin resistance\n", +"Rt=(R1*R2)/(R1+R2)\n", +"//base current\n", +"Ib=(Vt-Vbe)/(Rt+(1+hFE)*Re)\n", +"//collector current\n", +"Icq=hFE*Ib\n", +"//emitter current\n", +"Ie=Ib+Icq\n", +"//emitter voltage\n", +"Ve=Ie*Re\n", +"//collector to emitter voltage\n", +"Vceq=Vcc-(Icq*Rc)-(Ie*Re)\n", +"//collector voltage\n", +"Vc=Vce+Ve\n", +"//to draw DC load line\n", +"Ic1=Vcc/(Rc+Re)\n", +"Vce=[Vcc Vceq 0]\n", +"Ic=[0 Icq Ic1]\n", +"printf('Q(%f,%f)\n',Vceq,Icq)\n", +"plot2d(Vce, Ic)\n", +"xlabel('Vce')\n", +"ylabel('Ic')\n", +"xtitle('DC load line for base bias circuit')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.3_76: Design_a_Voltage_divider_bias_circuit.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 3.76')\n", +"printf('\n')\n", +"disp('Design a Voltage divider bias circuit')\n", +"printf('Given\n')\n", +"//given\n", +"Vce=5\n", +"Ve=Vce\n", +"Ic=5*10^-3\n", +"Vcc=15\n", +"hFE=100\n", +"Vbe=0.7\n", +"//emitter resistance\n", +"Re=Ve/Ic\n", +"//collector resistance\n", +"Rc=(Vcc-Vce-Ve)/Ic\n", +"//current through resistor R2\n", +"I2=Ic/10\n", +"//base voltage\n", +"Vb=Vbe+Ve\n", +"//resistance 1\n", +"R1=(Vcc-Vb)/I2\n", +"//resistance 2\n", +"R2=Vb/I2\n", +"printf('Collector resistance %f ohm \n',Rc)\n", +"printf('emitter resistance %f ohm \n',Re)\n", +"printf('base voltage %f volt \n',Vb)\n", +"printf('voltage divider resistance R1 & R2 %f ohm\n %f ohm\n',R1,R2)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.3_77: Design_a_Voltage_divider_bias_circuit.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 3.77')\n", +"printf('\n')\n", +"disp('Design a Voltage divider bias circuit')\n", +"printf('Given\n')\n", +"//given\n", +"Vce=3\n", +"Ve=5\n", +"Ic=10^-3\n", +"Vcc=12\n", +"Vbe=0.7\n", +"//emitter resistance\n", +"Re=Ve/Ic\n", +"//collector resistance\n", +"Rc=(Vcc-Vce-Ve)/Ic\n", +"//current through resistor R2\n", +"I2=Ic/10\n", +"//base voltage\n", +"Vb=Vbe+Ve\n", +"//resistance 1\n", +"R1=(Vcc-Vb)/I2\n", +"//resistance 2\n", +"R2=Vb/I2\n", +"printf('Collector resistance %f ohm \n',Rc)\n", +"printf('emitter resistance %f ohm \n',Re)\n", +"printf('base voltage %f volt \n',Vb)\n", +"printf('voltage divider resistance R1 & R2 %f ohm\n %f ohm\n',R1,R2)\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.3_79: Calculate_the_suitable_resistor_values_for_Voltage_divider_bias_circuit.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 3.79')\n", +"printf('\n')\n", +"disp('Calculate the suitable resistor values for Voltage divider bias circuit')\n", +"printf('Given\n')\n", +"printf('1 Resistance are in ohms \n2 Current are in ampere \n3 voltage sources are in volt')\n", +"//given\n", +"Vcc=20\n", +"Vce=8\n", +"hFE=80\n", +"Vbe=0.7\n", +"Rc=6*10^3\n", +"//select Ve\n", +"Ve=5\n", +"//find collector resistor\n", +"Ic=(Vcc-Vce-Ve)/Rc\n", +"//find I2\n", +"I2=Ic/10\n", +"//emitter resistance\n", +"Re=Ve/Ic\n", +"//base voltage\n", +"Vb=Vbe+Ve\n", +"//resistance R1\n", +"R1=(Vcc-Vb)/I2\n", +"//resistance R2\n", +"R2=Vb/I2\n", +"printf('Collector resistance %f ohm \n',Rc)\n", +"printf('emitter resistance %f ohm \n',Re)\n", +"printf('base voltage %f volt \n',Vb)\n", +"printf('voltage divider resistance R1 & R2 %f ohm\n %f ohm\n',R1,R2)\n", +"\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.3_85: EX3_3_85.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 3.85')\n", +"printf('\n')\n", +"disp('Find the stability factor & change in Ic for increase in temperature of base bias circuit')\n", +"printf('Given\n')\n", +"//given\n", +"hFE=100\n", +"Rc=2.2*10^3\n", +"Rb=470*10^3\n", +"Icbo1=15*10^-9\n", +"T1=25\n", +"T2=105\n", +"//stability factor\n", +"S=1+hFE\n", +"//Change in collector to base reverse saturation current(delIcbo)\n", +"n=(T2-T1)/10\n", +"Icbo2=Icbo1*2^8\n", +"delIcbo=Icbo2-Icbo1\n", +"//Change in Ic for increase in temperature\n", +"delIc=S*delIcbo\n", +"printf('Stability factor is \n%f\n',S)\n", +"printf('the change in collector current is \n%f ampere\n',delIc)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.3_86: EX3_3_86.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 3.86')\n", +"printf('\n')\n", +"disp('Find the stability factor & change in Ic for increase in temperature of collector to base bias circuit')\n", +"printf('Given\n')\n", +"//given\n", +"hFE=100\n", +"Rc=2.2*10^3\n", +"Rb=270*10^3\n", +"Icbo1=15*10^-9\n", +"T1=25\n", +"T2=105\n", +"//stability factor\n", +"S=(1+hFE)/(1+((hFE*Rc)/(Rc+Rb)))\n", +"//Change in collector to base reverse saturation current(delIcbo)\n", +"n=(T2-T1)/10\n", +"Icbo2=Icbo1*2^8\n", +"delIcbo=Icbo2-Icbo1\n", +"//Change in Ic for increase in temperature\n", +"delIc=S*delIcbo\n", +"printf('stability factor %f \n',S)\n", +"printf('change in Ic %f ampere\n',delIc)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.3_87: EX3_3_87.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 3.87')\n", +"printf('\n')\n", +"disp('Find the stability factor & change in Ic for increase in temperature of Voltage divider bias circuit')\n", +"printf('Given\n')\n", +"//given\n", +"hFE=100\n", +"Rc=1.2*10^3\n", +"R1=33*10^3\n", +"R2=12*10^3\n", +"Re=10^3\n", +"Icbo1=15*10^-9\n", +"T1=25\n", +"T2=105\n", +"//thevenin resistance\n", +"Rt=(R1*R2)/(R1+R2)\n", +"//stability factor\n", +"S=(1+hFE)/(1+((hFE*Re)/(Re+Rt)))\n", +"//Change in collector to base reverse saturation current(delIcbo)\n", +"n=(T2-T1)/10\n", +"Icbo2=Icbo1*2^8\n", +"delIcbo=Icbo2-Icbo1\n", +"//Change in Ic for increase in temperature\n", +"delIc=S*delIcbo\n", +"printf('stability factor %f \n',S)\n", +"printf('change in Ic %f ampere\n',delIc)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.3_89: EX3_3_89.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 3.89')\n", +"printf('\n')\n", +"disp('Calculate the change in Ic produced by effect of Vbe changes over temperature of Voltage divider bias circuit')\n", +"printf('Given\n')\n", +"//given\n", +"Re=4.7*10^3\n", +"T1=25\n", +"T2=125\n", +"//change in temperature\n", +"delT=T2-T1\n", +"//change in Vbe\n", +"delVbe=delT*(-1.8*10^-3) //change in Vbe for 1C raise in temperature=-1.8mV/C\n", +"//change in Ic\n", +"delIc=-delVbe/Re\n", +"printf('change in Ic %f ampere\n',delIc)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.3_90: EX3_3_90.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 3.90')\n", +"printf('\n')\n", +"disp('Calculate the change in Ic produced by effect of Vbe changes over temperature of Voltage divider bias circuit')\n", +"printf('Given\n')\n", +"//given\n", +"Re=4.7*10^3\n", +"T1=-35\n", +"T2=100\n", +"//change in temperature\n", +"delT=T2-T1\n", +"//change in Vbe\n", +"delVbe=delT*(-1.8*10^-3) //change in Vbe for 1C raise in temperature=-1.8mV/C\n", +"//change in Ic\n", +"delIc=-delVbe/Re\n", +"printf('The change in IC is \n%f ampere\n',delIc)" + ] + } +], +"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/Basic_Electronics_by_R_D_S_Samuel/4-Other_Devices.ipynb b/Basic_Electronics_by_R_D_S_Samuel/4-Other_Devices.ipynb new file mode 100644 index 0000000..d7a37e7 --- /dev/null +++ b/Basic_Electronics_by_R_D_S_Samuel/4-Other_Devices.ipynb @@ -0,0 +1,576 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 4: Other Devices" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.4_18: Calculate_input_votage_that_turns_SCR_ON_and_supply_voltage_that_turns_OFF.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 4.18')\n", +"printf('\n')\n", +"disp('Calculate input voltage that turns SCR ON, & find supply voltage that turns SCR OFF if holding current is 10mA')\n", +"printf('Given\n')\n", +"printf('Resistance are in ohms \nCurrent are in Ampere \n Voltage sources are in volt\n')\n", +"//gate trigger voltage\n", +"Vgt=0.75\n", +"//trigger current\n", +"Igt=5*10^-3\n", +"//gate resistance\n", +"Rg=1000\n", +"//load resistance\n", +"RL=100\n", +"//diode forward voltage\n", +"Vf=0.7\n", +"//holding current\n", +"Ih=10*10^-3\n", +"//minimum input voltage to trigger the SCR is\n", +"Vin=Vgt+(Igt*Rg)\n", +"//The supply voltage that turns OFF the SCR is\n", +"VCC=Vf+(Ih*RL)\n", +"printf('minimum input voltage to trigger the SCR is %f volt \n',Vin)\n", +"printf('The supply voltage that turns OFF the SCR is %f volt \n',VCC)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.4_28: Calculate_the_values_of_R1_R2_and_Rp_of_SCR_circuit.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 4.28')\n", +"printf('\n')\n", +"disp('Calculate suitable values of R1,Rp,R2 for SCR in circuit Fig 4.12')\n", +"printf('Given\n')\n", +"printf('Resistance are in ohms \nCurrent are in Ampere \n Voltage sources are in volt\n')\n", +"//gate current\n", +"Ig=250*10^-6\n", +"//gate trigger voltage\n", +"Vgt=0.75\n", +"Vd=0.7\n", +"//supply voltage\n", +"Vs=40\n", +"//peak value of supply voltage\n", +"Vm=sqrt(2)*Vs\n", +"//supply voltage at angle 10deg\n", +"Vs1=Vm*sin(10*%pi/180)\n", +"//supply voltage at angle 90deg\n", +"Vs2=Vm*sin(90*%pi/180)\n", +"Vt=Vd+Vgt\n", +"//to trigger SCR at 10deg moving contact of Rp is at top\n", +"//from circuit\n", +"VR1=Vs1-Vt\n", +"//choose I1min>>Ig\n", +"I1min=1.5*10^-3\n", +"R1=VR1/I1min\n", +"//since Ig<<I1min, current through Rp & R2 is I1min\n", +"RpPLUSR2=Vt/I1min\n", +"//to trigger SCR at 90deg moving contact of Rp is at bottom\n", +"VR2=Vt\n", +"I1=Vs2/(R1+RpPLUSR2)\n", +"R2=Vt/I1\n", +"Rp=RpPLUSR2-R2\n", +"printf('Resistance R1 is %f ohm \n',R1)\n", +"printf('Resistance R2 is %f ohm \n',R2)\n", +"printf('Resistance Rp is %f ohm \n',Rp)\n", +"\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.4_29: Calculate_the_values_of_R1_R2_and_Rp_of_SCR_circuit.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 4.29')\n", +"printf('\n')\n", +"disp('Calculate suitable values of R1,Rp,R2 for SCR in circuit Fig 4.12')\n", +"printf('Given\n')\n", +"printf('Resistance are in ohms \nCurrent are in Ampere \n Voltage sources are in volt\n')\n", +"//gate current\n", +"Ig=600*10^-6\n", +"//gate trigger voltage\n", +"Vg=0.7\n", +"Vd=0.7\n", +"//supply voltage\n", +"Vs=230\n", +"//peak value of supply voltage\n", +"Vm=sqrt(2)*Vs\n", +"//supply voltage at angle 8deg\n", +"Vs1=Vm*sin(8*%pi/180)\n", +"//supply voltage at angle 90deg\n", +"Vs2=Vm*sin(90*%pi/180)\n", +"//to trigger SCR at 10deg moving contact of Rp is at top\n", +"//from circuit\n", +"VR1=Vs1-Vg\n", +"//choose I1min>>Ig\n", +"I1min=6*10^-3\n", +"R1=VR1/I1min\n", +"//since Ig<<I1min, current through Rp & R2 is I1min\n", +"RpPLUSR2=Vg/I1min\n", +"//to trigger SCR at 90deg moving contact of Rp is at bottom\n", +"VR2=Vt\n", +"I1=Vs2/(R1+RpPLUSR2)\n", +"R2=Vg/I1\n", +"Rp=RpPLUSR2-R2\n", +"printf('Resistance R1 is %f ohm \n',R1)\n", +"printf('Resistance R2 is %f ohm \n',R2)\n", +"printf('Resistance Rp is %f ohm \n',Rp)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.4_40: EX4_4_40.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 4.40')\n", +"printf('\n')\n", +"disp('Design the SCR crowbar circuit to protect the load from voltage levels greater than 12V')\n", +"printf('Given\n')\n", +"//gate trigger voltage\n", +"Vgt=0.75\n", +"//load voltage maximum\n", +"VLmax=12\n", +"//Zener voltage is\n", +"Vz=VLmax-Vgt\n", +"//assume zener current(mini) as\n", +"Izmin=10^-3\n", +"R=Vgt/Izmin\n", +"printf('zener voltage \n%f volt\n',Vz)\n", +"printf('Resistance \n%f ohm\n',R)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.4_41: EX4_4_41.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 4.41')\n", +"printf('\n')\n", +"disp('Design the SCR crowbar circuit to protect the load from voltage levels greater than 7.5V')\n", +"printf('Given\n')\n", +"//gate trigger voltage\n", +"Vgt=0.7\n", +"//load voltage maximum\n", +"VLmax=7.5\n", +"//Zener voltage is\n", +"Vz=VLmax-Vgt\n", +"//assume zener current(mini) as\n", +"Izmin=10^-3\n", +"R=Vgt/Izmin\n", +"printf('zener voltage \n%f volt\n',Vz)\n", +"printf('Resistance \n%f ohm\n',R)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.4_49: Determine_the_minimum_and_maximum_triggering_voltage_for_a_UJT.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 4.49')\n", +"printf('\n')\n", +"disp('Determine the minimum & maximum triggering voltage for a UJT')\n", +"printf('Given\n')\n", +"Vbb=20\n", +"//intrinsic ratios\n", +"nmin=0.6\n", +"nmax=0.8\n", +"V=0.7\n", +"//minimum triggering voltage is\n", +"Vpmini=nmin*Vbb+Vd\n", +"//maximum triggering voltage is\n", +"Vpmax=nmax*Vbb+Vd\n", +"printf('Minimum triggering Voltage \n%f volt\n',Vpmini)\n", +"printf('Maximum triggering Voltage \n%f volt\n',Vpmax)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.4_51: find_maximum_oscillating_frequency_of_UJT.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 4.51')\n", +"printf('\n')\n", +"disp('Calculate minimum & maximum values of Re for the relaxation oscillator & also find maximum oscillating frequency')\n", +"printf('Given\n')\n", +"Vbb=15\n", +"//the parameters of UJT\n", +"Ip=10^-6\n", +"Iv=2.5*10^-3\n", +"Vv=2.5\n", +"n=0.7\n", +"PRe=20*10^3\n", +"C=10^-6\n", +"Vp=12\n", +"Vd=0.7\n", +"Vp1=(n*Vbb)+Vd\n", +"//minimum Re\n", +"Remin=(Vbb-Vv)/Iv\n", +"//maximum Re\n", +"Remax=(Vbb-Vp1)/Ip\n", +"//to find maximum oscillating frequency\n", +"T=PRe*C*log((Vbb-Vv)/(Vbb-Vp))\n", +"f=1/T\n", +"printf('maximum Re \n%f ohm\n',Remax)\n", +"printf('minimum Re \n%f ohm\n',Remin)\n", +"printf('maximum oscillating frequency \n%f hz \n',f)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.4_52: Determine_the_minimum_and_maximum_values_of_VEB1_for_a_UJT.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 4.52')\n", +"printf('\n')\n", +"disp('Determine the minimum & maximum values of VEB1 for a UJT')\n", +"printf('Given\n')\n", +"Vbb=15\n", +"//intrinsic ratios\n", +"nmin=0.68\n", +"nmax=0.82\n", +"V=0.7\n", +"//mini triggering voltage is\n", +"Vpmini=nmin*Vbb+Vd\n", +"//max triggering voltage is\n", +"Vpmax=nmax*Vbb+Vd\n", +"printf('minimum triggering voltage \n%f volt\n',Vpmini)\n", +"printf('maximum triggering voltage \n%f volt\n',Vpmax)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.4_53: find_maximum_oscillating_frequency_of_UJT.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 4.53')\n", +"printf('\n')\n", +"disp('find maximum oscillating frequency')\n", +"Vbb=20\n", +"//the parameters of UJT\n", +"Ip=10^-6\n", +"Iv=10*10^-3\n", +"Vv=3.5\n", +"n=0.75\n", +"PRe=4.7*10^3\n", +"C=0.5*10^-6\n", +"Vd=0.7\n", +"Vp1=(n*Vbb)+Vd\n", +"//to find maximum oscillating frequency\n", +"T=PRe*C*log((Vbb-Vv)/(Vbb-Vp1))\n", +"f=1/T\n", +"printf('Oscillator frequency \n%f hz\n',f)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.4_74: plot_the_drain_characteristics_of_JFET.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 4.74')\n", +"printf('\n')\n", +"disp('plot the drain characteristics of JFET')\n", +"//given\n", +"Vds=[0 1 2 2.5 3 4 6 8]\n", +"Id=[0 2 4.5 5.3 5.5 5.5 5.5 5.5]\n", +"plot2d(Vds,Id)\n", +"xlabel('Vds(V)')\n", +"ylabel('Id(mA)')\n", +"xtitle('Plot of Vds V/s Id')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.4_77: calculate_Vds_at_these_gate_source_voltages_and_circuit_voltage_gain_of_JFET.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 4.77')\n", +"printf('\n')\n", +"disp('calculate Vds at these gate_source voltages & circuit voltage gain of JFET')\n", +"printf('Given\n')\n", +"//drain current\n", +"Id=9*10^-3\n", +"//gate to source voltage\n", +"Vgs=(-2)\n", +"//when Vgs is reduced to -1V then Id is 12mA\n", +"Vgs1=-1\n", +"Id1=12*10^-3\n", +"//from circuit (fig 4.49)\n", +"Rd=1.5*10^3\n", +"Vdd=20\n", +"//to find Vds\n", +"//when Vgs=-2\n", +"Vds=Vdd-(Id*Rd)\n", +"//when Vgs=-1\n", +"Vds1=Vdd-(Id1*Rd)\n", +"//change in input voltage Vgs is\n", +"delVi=Vgs1-Vgs\n", +"//change in output voltage is\n", +"delVo=Vds-Vds1\n", +"//Voltage gain \n", +"Av=delVo/delVi\n", +"printf('The value of Vds at gate-source voltages is \n%f volt\n',Vds)\n", +"printf('The circuit voltage gain \n%f\n',Av)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.4_78: EX4_4_78.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 4.78')\n", +"printf('\n')\n", +"disp('calculate the minimum & maximum variation in the drain source voltage Vds produced by a change of 0.1V & circuit voltage gain of JFET')\n", +"printf('Given\n')\n", +"//transconductance\n", +"gmmax=5000*10^-6\n", +"gmmin=1500*10^-6\n", +"//change in gate to source voltage\n", +"delVgs=0.1\n", +"Rd=1.5*10^3\n", +"//the maximum change in drain current\n", +"delIdmax=gmmax*delVgs\n", +"delVdsmax=delIdmax*Rd\n", +"//voltage gain\n", +"Av1=delVdsmax/delVgs\n", +"//the minimum change in drain current\n", +"delIdmin=gmmin*delVgs\n", +"delVdsmin=delIdmin*Rd\n", +"//voltage gain\n", +"Av2=delVdsmin/delVgs\n", +"printf('maximum change in drain voltage is %f volt\n',delVdsmax)\n", +"printf('maximum voltage gain %f \n',Av1)\n", +"printf('minimum change in drain voltage is %f volt\n',delVdsmin)\n", +"printf('minimum voltage gain %f \n',Av2)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.4_79: calculate_transconductance_of_JFET.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 4.79')\n", +"printf('\n')\n", +"disp('calculate transconductance of JFET')\n", +"printf('Given\n')\n", +"//voltage gain \n", +"Av=20\n", +"//drain resistance\n", +"Rd=3.3*10^3\n", +"//transconductance\n", +"gm=Av/Rd\n", +"printf('Transconductance of JFET \n%f (1/ohm)\n',gm)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.4_80: determine_the_suitable_value_of_load_resistor_Rd_of_JFET.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 4.80')\n", +"printf('\n')\n", +"disp('determine the suitable value of load resistor Rd of JFET')\n", +"printf('Given\n')\n", +"//voltage gain\n", +"Av=10\n", +"//transconductance\n", +"gm=4500*10^-6\n", +"//load resistance\n", +"Rd=Av/gm\n", +"printf('load resistance \n%f ohm \n',Rd)" + ] + } +], +"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/Basic_Electronics_by_R_D_S_Samuel/5-Amplifiers_and_Oscillators.ipynb b/Basic_Electronics_by_R_D_S_Samuel/5-Amplifiers_and_Oscillators.ipynb new file mode 100644 index 0000000..f1f6f5a --- /dev/null +++ b/Basic_Electronics_by_R_D_S_Samuel/5-Amplifiers_and_Oscillators.ipynb @@ -0,0 +1,1189 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 5: Amplifiers and Oscillators" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.5_10: EX5_5_10.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 5.10')\n", +"printf('\n')\n", +"disp('Calculate overall voltage gain in db & output voltage when input voltage is 1uV for cascaded amplifier')\n", +"printf('Given\n')\n", +"//Voltage gain of amplifier\n", +"Av1=10\n", +"Av2=100\n", +"Av3=1000\n", +"//input voltage\n", +"Vi=10^-6\n", +"//overall voltage gain\n", +"Av=Av1*Av2*Av3\n", +"//in db\n", +"Avdb=20*log10(Av)\n", +"//output voltage when input voltage is 10^-6V\n", +"Vo=Av*Vi\n", +"printf('overall voltage gain in dB \n%f dB\n',Avdb)\n", +"printf('output voltage \n%f volt\n',Vo)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.5_11: Calculate_overall_voltage_gain_in_db_of_cascaded_2_stage_amplifier.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 5.11')\n", +"printf('\n')\n", +"disp('Calculate overall voltage gain in db of cascaded 2 stage amplifier')\n", +"printf('Given\n')\n", +"//Voltage gain\n", +"Av1=10\n", +"Av2=20\n", +"//overall voltage gain \n", +"Av=Av1*Av2\n", +"//in db\n", +"Avdb=20*log10(Av)\n", +"printf('Overall gain is \n%f dB\n',Avdb)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.5_12: EX5_5_12.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 5.12')\n", +"printf('\n')\n", +"disp('Calculate overall voltage gain ,gain of 2nd & 3rd stage,input voltage of 2nd stage & all in db of three stage amplifier')\n", +"printf('Given\n')\n", +"//input voltage \n", +"Vi=0.05\n", +"//output voltage\n", +"Vo=150\n", +"//voltage gain of 1st stage\n", +"Av1=20\n", +"//input to 3rd stage\n", +"V2=15\n", +"//overall voltage gain \n", +"Av=Vo/Vi\n", +"//input to 2nd stage\n", +"V1=Av1*Vi\n", +"//voltage gain of 2nd stage\n", +"Av2=V2/V1\n", +"//voltage gain of 3rd stage\n", +"Av3=Vo/V2\n", +"//all stages gain in db\n", +"Av1db=20*log10(Av1)\n", +"Av2db=20*log10(Av2)\n", +"Av3db=20*log10(Av3)\n", +"//overall gain in db\n", +"Av=Av1db+Av2db+Av3db\n", +"printf('overall voltage gain \n%f\n',Av)\n", +"printf('voltage gain of 2nd & 3rd stages \n%f\n%f\n',Av2,Av3)\n", +"printf('input voltage of 2nd stage \n%f volt\n',V1)\n", +"printf('Decibal voltage gain of 1st, 2nd, 3rd stage \n%fdB\n%fdB\n%fdB\n',Av1db,Av2db,Av3db)\n", +"printf('Overall gain in db \n%f dB\n',Av)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.5_15: For_CE_amplifier_find_R1_R2_Re_and_Rc.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 5.15')\n", +"printf('\n')\n", +"disp('For CE amplifier shown in fig 5.5 find R1,R2,Re & Rc')\n", +"printf('Given\n')\n", +"Vcc=24\n", +"//load resistance\n", +"RL=120*10^3\n", +"//since Rc<<RL\n", +"Rc=RL/10\n", +"//select Ve & Vce\n", +"Ve=5\n", +"Vce=3\n", +"Vrc=Vcc-Vce-Ve //from circuit\n", +"Ic=Vrc/Rc\n", +"//find Re\n", +"Re=Ve/Ic\n", +"R2=10*Re\n", +"//Vbe for si transistor\n", +"Vbe=0.7\n", +"Vb=Vbe+Ve\n", +"I2=Vb/R2\n", +"R1=(Vcc-Vb)/I2\n", +"printf('The resistance values are\nR1=%f ohm\nR2=%f ohm\nRe=%f ohm\nRc=%f ohm\n',R1,R2,Re,Rc)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.5_16: For_CE_amplifier_find_R1_R2_Re_and_Rc.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 5.16')\n", +"printf('\n')\n", +"disp('For CE amplifier shown in fig 5.5 find R1,R2,Re & Rc')\n", +"printf('Given\n')\n", +"Vcc=18\n", +"//load resistance\n", +"RL=56*10^3\n", +"//since Rc<<RL\n", +"Rc=RL/10\n", +"//select Ve & Vce\n", +"Ve=5\n", +"Vce=3\n", +"Vrc=Vcc-Vce-Ve //from circuit\n", +"Ic=Vrc/Rc\n", +"//find Re\n", +"Re=Ve/Ic\n", +"R2=10*Re\n", +"//Vbe for si transistor\n", +"Vbe=0.7\n", +"Vb=Vbe+Ve\n", +"I2=Vb/R2\n", +"R1=(Vcc-Vb)/I2\n", +"printf('The resistance values are\nR1=%f ohm\nR2=%f ohm\nRe=%f ohm\nRc=%f ohm\n',R1,R2,Re,Rc)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.5_19: calculate_upper_cutoff_frequency_and_voltage_gain_at_lower_cutoff_frequency.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 5.19')\n", +"printf('\n')\n", +"disp('calculate upper cut-off frequency & voltage gain at lower cut-off frequency')\n", +"printf('Given\n')\n", +"//bandwidth of amplifier\n", +"BW=500*10^3\n", +"//lower cut-off frequency\n", +"f1=25\n", +"//midband gain\n", +"Ao=120\n", +"//upper cut-off frequency\n", +"f2=BW+f1\n", +"//voltage gain at lower cut-off frequency\n", +"A1=Ao/sqrt(2)\n", +"printf('upper cut-off frequency \n %f hz\n',f2)\n", +"printf('Voltage gain at lower cut-off frequency \n %f \n',A1)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.5_23: calculate_closed_loop_gain_for_the_negative_feedback_amplifier.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 5.23')\n", +"printf('\n')\n", +"disp('calculate closed-loop gain for the negative feedback amplifier')\n", +"printf('Given\n')\n", +"//voltage gain without feedback\n", +"Av=100000\n", +"//feedback factor\n", +"B=1/100\n", +"//voltage gain with feedback\n", +"Acl=Av/(1+(B*Av))\n", +"//when Av is changed by 50%\n", +"Av1=50*100000/100\n", +"Av2=Av+Av1\n", +"//voltage gain with feedback when Av changed by +50%\n", +"Acl1=Av2/(1+(B*Av2))\n", +"//voltage gain with feedback when Av changed by -50%\n", +"Av3=Av-Av1\n", +"Acl2=Av3/(1+(B*Av3))\n", +"printf('closed loop gain of negative feedback amplifier is \n %f \n',Acl2)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.5_24: calculate_closed_loop_gain_for_the_negative_feedback_amplifier.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 5.24')\n", +"printf('\n')\n", +"disp('calculate closed-loop gain for the negative feedback amplifier')\n", +"printf('Given\n')\n", +"//voltage gain without feedback\n", +"Av=1000\n", +"//feedback factor\n", +"B=0.1\n", +"//voltage gain with feedback\n", +"Acl=Av/(1+(B*Av))\n", +"printf('closed loop gain of negative feedback amplifier is \n %f \n',Acl)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.5_27: calculate_input_impedance_of_amplifier_with_negative_feedback.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 5.27')\n", +"printf('\n')\n", +"disp('calculate input impedance of amplifier with negative feedback')\n", +"printf('Given\n')\n", +"//input impedance without feedback\n", +"Zb=10^3\n", +"//open loop voltage gain\n", +"Av=100000\n", +"//feedback network resistance\n", +"RF1=56*10^3\n", +"RF2=560\n", +"//input side resistance\n", +"R1=68*10^3\n", +"R2=33*10^3\n", +"//feedback factor\n", +"B=RF2/(RF1+RF2)\n", +"//input impedance with feedback\n", +"Zi=Zb*(1+(B*Av))\n", +"//input impedance with feedback by considering R1 & R2\n", +"Rp=(R1*R2)/(R1+R2)\n", +"Zin=(Zi*Rp)/(Zi+Rp)\n", +"printf('input impedance with negative feedback \n%f ohm\n',Zin)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.5_29: calculate_input_and_output_impedance_of_amplifier_with_negative_feedback.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 5.29')\n", +"printf('\n')\n", +"disp('calculate input & output impedance of amplifier with negative feedback')\n", +"printf('Given\n')\n", +"//input impedance without feedback\n", +"Zb=10^3\n", +"//open loop voltage gain\n", +"Av=7533\n", +"//input side resistance\n", +"R1=68*10^3\n", +"R2=47*10^3\n", +"//feedback factor\n", +"B=1/101\n", +"//input impedance with feedback\n", +"Zi=Zb*(1+(B*Av))\n", +"//input impedance with feedback by considering R1 & R2\n", +"Rp=(R1*R2)/(R1+R2)\n", +"Zin=(Zi*Rp)/(Zi+Rp)\n", +"//output impedance without feedback\n", +"Zc=50*10^3\n", +"Rc=3.9*10^3\n", +"//output impedance with feedback\n", +"Zo=Zc/(1+(B*Av))\n", +"//output impedance with feedback by considering Rc\n", +"Zout=(Rc*Zo)/(Rc+Zo)\n", +"printf('input impedance with negative feedback \n%f ohm\n',Zin)\n", +"printf('output impedance with negative feedback \n%f ohm\n',Zout)\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.5_35: Estimate_the_closed_loop_upper_cut_off_frequency_and_total_harmonic_distortion.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 5.35')\n", +"printf('\n')\n", +"disp('Estimate the closed loop upper cut-off frequency & total harmonic distortion')\n", +"printf('Given\n')\n", +"//open loop gain\n", +"Av=60000\n", +"//closed loop gain\n", +"Acl=300\n", +"//open loop upper cut-off frequency\n", +"F2OL=15*10^3\n", +"//closed loop upper cut-off frequency & Av/Acl=(1+BAv)\n", +"F2CL=F2OL*Av/Acl\n", +"//total harmonic distortion with feedback if there is 10% distortion without feedback\n", +"HD=10/(Av/Acl)\n", +"printf('closed loop upper cut-off frequency \n%f hz\n',F2CL)\n", +"printf('total harmonic distortion with feedback if there is 10per distortion without feedback \n%f\n',HD)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.5_36: calculate_open_loop_cut_off_frequency_if_the_open_loop_gain_is_200000.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 5.36')\n", +"printf('\n')\n", +"disp('calculate open loop cut-off frequency if the open loop gain is 200000')\n", +"printf('Given\n')\n", +"//open loop gain\n", +"Av=200000\n", +"//closed loop gain \n", +"Acl=250\n", +"//upper cut-off frequency with feedback\n", +"F2CL=4*10^6\n", +"//upper cut-off frequency without feedback\n", +"F2OL=F2CL/(Av/Acl)\n", +"printf('upper cut-off frequency without feedback \n%f hz\n',F2OL)\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.5_37: calculate_the_phase_shift_with_negative_feedback.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 5.37')\n", +"printf('\n')\n", +"disp('calculate the phase shift with negative feedback')\n", +"printf('Given\n')\n", +"//open loop phase shift\n", +"Po=15\n", +"//open loop gain\n", +"Av=60000\n", +"//closed loop gain\n", +"Acl=300\n", +"//to calculate phase shift with feedback\n", +"AvB=(Av/Acl)-1\n", +"k=((AvB*sin(Po*%pi/180))/(1+(AvB*cos(Po*%pi/180))))\n", +"Pcl=Po-(atan(k)*180/%pi)\n", +"printf('The phase shift with negative feedback=\t%f degree\n',Pcl)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.5_38: calculate_bandwidth_and_gain_and_harmonic_distortion_with_feedback.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 5.38')\n", +"printf('\n')\n", +"disp('calculate bandwidth,gain & harmonic distortion with feedback')\n", +"printf('Given\n')\n", +"//open loop gain\n", +"Av=1000\n", +"//bandwidth without feedback\n", +"BWol=500*10^3\n", +"//feedback factor\n", +"B=0.1\n", +"//bandwidth with feedback\n", +"BWcl=BWol*(1+(B*Av))\n", +"//closed loop gain\n", +"Acl=Av/(1+(B*Av))\n", +"//harmonic distortion if 15% negative feedback used\n", +"HDcl=15/(1+(B*Av))\n", +"printf('bandwidth with feedback is \n %f hz \n',BWcl)\n", +"printf('closed loop gain \n %f \n',Acl)\n", +"printf('Harmonic distortion with feedback \n %f \n',HDcl)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.5_3: Calculate_output_power_change_in_decibel_of_amplifier.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 5.3')\n", +"printf('\n')\n", +"disp('Calculate output power change in decibel of amplifier')\n", +"printf('Given\n')\n", +"//output power when frequency is 5khz\n", +"P1=50*10^-3\n", +"//output power when frequency is 20khz\n", +"P2=25*10^-3\n", +"//output power change in decibel\n", +"delPo=10*log10(P2/P1)\n", +"printf('output power change \n%f dB\n',delPo)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.5_40: calculate_the_frequency_of_oscillation_and_feedback_factor_of_Hartley_oscillator.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 5.50')\n", +"printf('\n')\n", +"disp('calculate the frequency of oscillation & feedback factor of Hartley oscillator')\n", +"printf('Given\n')\n", +"//inductance\n", +"L1=2*10^-3\n", +"L2=8*10^-3\n", +"//mutual inductance\n", +"M=100*10^-6\n", +"//capacitor\n", +"C=0.001*10^-6\n", +"//total inductance \n", +"L=L1+L2+M\n", +"//frequency of oscillation\n", +"f=1/(2*%pi*sqrt(L*C))\n", +"//feedback factor\n", +"B=L1/L2\n", +"printf('frequency of oscillation of hartley oscillator \n %f hz \n',f)\n", +"printf('feedback factor \n %f \n',B)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.5_43: calculate_the_frequency_of_oscillation_of_RC_phase_shift_oscillator.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 5.43')\n", +"printf('\n')\n", +"disp('calculate the frequency of oscillation of RC phase shift oscillator')\n", +"printf('Given\n')\n", +"R=500\n", +"C=0.1*10^-6\n", +"//frequency of oscillation\n", +"f=1/(2*%pi*R*C*sqrt(6))\n", +"printf('frequency of oscillation \n%f hz\n',f)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.5_44: calculate_the_value_of_Capacitor_for_a_RC_phase_shift_oscillator.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 5.44')\n", +"printf('\n')\n", +"disp('calculate the value of Capacitor for a RC phase shift oscillator')\n", +"printf('Given\n')\n", +"R=1000\n", +"//frequency of oscillation\n", +"f=5000\n", +"//capacitor value\n", +"C=1/(2*%pi*R*f*sqrt(6))\n", +"printf('Capacitor value \n%e farad \n',C)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.5_45: calculate_the_value_of_R_and_C_for_RC_phase_shift_oscillator.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 5.45')\n", +"printf('\n')\n", +"disp('calculate the value of R & c for RC phase shift oscillator')\n", +"printf('Given\n')\n", +"//oscillating frequency\n", +"f=2000\n", +"//select Capacitor value\n", +"C=0.1*10^-6\n", +"//resistance value \n", +"R=1/(2*%pi*f*C*sqrt(6)) \n", +"printf('Resistance value \n%f ohm\n',R)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.5_49: EX5_5_49.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 5.49')\n", +"printf('\n')\n", +"disp('calculate frequency of oscillation,feedback factor & gain required for sustained oscillation of hartley oscillator')\n", +"printf('Given\n')\n", +"//inductance\n", +"L1=5*10^-3\n", +"L2=10*10^-3\n", +"//capacitor\n", +"C=0.01*10^-6\n", +"//frequency of oscillation\n", +"f=1/(2*%pi*sqrt((L1+L2)*C))\n", +"//feedback factor\n", +"B=L1/L2\n", +"//gain required for sustained oscillation\n", +"Av=L2/L1\n", +"printf('gain required for sustained oscillation=\t>%f\n',Av)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.5_4: Calculate_output_power_change_in_decibel_of_amplifier.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 5.4')\n", +"printf('\n')\n", +"disp('Calculate output power change in decibel of amplifier')\n", +"printf('Given\n')\n", +"//output voltage of amplifier when frequency 3khz\n", +"V1=2\n", +"//output voltage of amplifier when frequency 50khz\n", +"V2=0.5\n", +"//output power change in decibel\n", +"delPo=20*log10(V2/V1)\n", +"printf('output power change \n%f dB\n',delPo)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.5_51: calculate_the_value_of_L1_and_L2_of_Hartley_oscillator.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 5.51')\n", +"printf('\n')\n", +"disp('calculate the value of L1 & L2 of Hartley oscillator')\n", +"printf('Given\n')\n", +"//frequency of oscillation\n", +"f=25*10^3\n", +"C=0.02*10^-6\n", +"//feedback factor\n", +"B=0.2\n", +"//Total inductance\n", +"L=1/(4*(%pi)^2*f^2*C)\n", +"L1byL2=B\n", +"L1plusL2=L\n", +"//therefore\n", +"L2=L/1.2\n", +"L1=L-L2\n", +"printf('The values of L1=\t%f henry\nL2=\t%f henry\n',L1,L2)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.5_53: Design_the_value_of_L1_L2_and_C_for_a_hartley_oscillator.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 5.53')\n", +"printf('\n')\n", +"disp('Design the value of L1,L2 & C for a hartley oscillator')\n", +"printf('Given\n')\n", +"//frequency of oscillation\n", +"f=30*10^3\n", +"//then value of LC\n", +"LC=1/(4*(%pi)^2*f^2)\n", +"//select c as\n", +"C=0.1*10^-6\n", +"//Total inductance\n", +"L=LC/C\n", +"//let L1=L2\n", +"L1=L/2\n", +"L2=L1\n", +"printf('The values of L1=\t%f henry\nL2=\t%f henry\nC=\t%e farad\n',L1,L2,C)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.5_55: calculate_the_frequency_of_oscillation_of_Colpitts_oscillator.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 5.55')\n", +"printf('\n')\n", +"disp('calculate the frequency of oscillation of Colpitts oscillator')\n", +"printf('Given\n')\n", +"//capacitor\n", +"C1=400*10^-12\n", +"C2=C1\n", +"//inductance\n", +"L=2*10^-3\n", +"//Total capacitance\n", +"C=C1*C2/(C1+C2)\n", +"//frequency of oscillation\n", +"f=1/(2*%pi*sqrt(L*C))\n", +"printf('frequency of oscillations \n%f hz\n',f)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.5_56: EX5_5_56.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 5.56')\n", +"printf('\n')\n", +"disp('calculate the frequency of oscillation,feedback factor & gain required for sustained oscillation')\n", +"printf('Given\n')\n", +"//Capacitance\n", +"C1=40*10^-12\n", +"C2=10*10^-12\n", +"//inductance\n", +"L=3*10^-3\n", +"//total effective capacitance\n", +"C=C1*C2/(C1+C2)\n", +"//frequency of oscillation\n", +"f=1/(2*%pi*sqrt(L*C))\n", +"//feedback factor\n", +"B=C2/C1\n", +"//gain required for sustained oscillation\n", +"Av=C1/C2\n", +"printf('gain required for sustained oscillation =\t>%f\n',Av)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.5_57: calculate_the_value_of_L_of_Colpitts_oscillator.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 5.57')\n", +"printf('\n')\n", +"disp('calculate the value of L of Colpitts oscillator ')\n", +"printf('Given\n')\n", +"//capacitor\n", +"C1=100*10^-12\n", +"C2=60*10^-12\n", +"//total effective capacitance\n", +"C=C1*C2/(C1+C2)\n", +"//frequency of oscillation\n", +"f=40*10^3\n", +"//inductance\n", +"L=1/(4*(%pi)^2*f^2*C)\n", +"printf('inductance value is \n%f henry\n',L)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.5_58: calculate_the_value_of_C1_and_C2_of_Colpitts_oscillator.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 5.58')\n", +"printf('\n')\n", +"disp('calculate the value of C1 & C2 of Colpitts oscillator')\n", +"printf('Given\n')\n", +"//inductance\n", +"L=5*10^-3\n", +"//frequency of oscillation\n", +"f=50*10^3\n", +"//total effective capacitance\n", +"C=1/(4*(%pi)^2*f^2*L)\n", +"//feedback factor \n", +"B=0.1\n", +"//then C2/C1=0.1, so substituting in C=C1C2/(C1+C2) we get\n", +"C1=1.1*C/0.1\n", +"C2=0.1*C1\n", +"printf('The value of C1=\t%e farad\nC2=\t%e farad\n',C1,C2)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.5_59: calculate_the_value_of_L_and_C_for_a_colpitts_oscillator.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 5.59')\n", +"printf('\n')\n", +"disp('calculate the value of L & C for a colpitts oscillator')\n", +"printf('Given\n')\n", +"//frequency of oscillation\n", +"f=40*10^3\n", +"LC=1/(4*(%pi)^2*f^2)\n", +"//select L\n", +"L=10*10^-3\n", +"//find C\n", +"C=1/(4*(%pi)^2*f^2*L)\n", +"//let C1=C2 so we get\n", +"C1=2*C\n", +"C2=C1\n", +"printf('The values of L=\t%f henry\nC1=\t%e farad\nC2=\t%e farad\n',L,C1,C2)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.5_5: Calculate_power_gain_of_amplifier.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 5.5')\n", +"printf('\n')\n", +"disp('Calculate power gain of amplifier')\n", +"printf('Given\n')\n", +"//have equal input & load resistance\n", +"//input voltage\n", +"Vi=100*10^-3\n", +"//output voltage\n", +"Vo=3\n", +"//power gain of amplifier\n", +"Apdb=20*log10(Vo/Vi)\n", +"printf('power gain of amplifier \n%f\n',Apdb)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.5_61: calculate_the_frequency_of_oscillation_for_Wein_Bridge_Oscillator.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 5.61')\n", +"printf('\n')\n", +"disp('calculate the frequency of oscillation for Wein_Bridge Oscillator')\n", +"printf('Given\n')\n", +"//Resistance\n", +"R=2*10^3\n", +"//capacitor\n", +"C=0.1*10^-6\n", +"//frequency of oscillation\n", +"f=1/(2*%pi*R*C)\n", +"printf('frequecy of oscillation \n%f hz\n',f)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.5_62: calculate_the_value_of_R_and_C_for_Wein_Bridge_oscillator.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 5.62')\n", +"printf('\n')\n", +"disp('calculate the value of R & c for Wein-Bridge oscillator')\n", +"printf('Given\n')\n", +"//frequency of oscillation\n", +"f=1000\n", +"//find RC\n", +"RC=1/(2*%pi*f)\n", +"//select C<10^-6F\n", +"C=0.1*10^-6\n", +"//the value of R\n", +"R=1/(2*%pi*f*C)\n", +"printf('the value of c \n%f farad\n',C)\n", +"printf('the value of R \n%f ohm\n',R)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.5_65: calculate_the_Series_and_parallel_resonant_frequencies_of_Crystal.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 5.65')\n", +"printf('\n')\n", +"disp('calculate the Series & parallel resonant frequencies of Crystal')\n", +"printf('Given\n')\n", +"//indutance\n", +"L=3\n", +"//Capacitor due to mechanical mounting of crystal\n", +"Cm=10*10^-12\n", +"//electrical equivalent capacitance of crystal compliance\n", +"Cs=0.05*10^-12\n", +"//electrical equivalent resistance of crystal structure internal friction\n", +"R=2*10^3\n", +"//series resonant frequency\n", +"fs=1/(2*%pi*sqrt(L*Cs))\n", +"Cp=Cm*Cs/(Cm+Cs)\n", +"//parallel resonant frequency\n", +"fp=1/(2*%pi*sqrt(L*Cp))\n", +"printf('series resonant frequency \n%f hz\n',fs)\n", +"printf('parallel resonant frequency \n%f hz\n',fp)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.5_6: Calculate_new_level_of_output_voltage_when_it_has_fallen_by_4db.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 5.6')\n", +"printf('\n')\n", +"disp('Calculate new level of output voltage when it has fallen by 4db')\n", +"printf('Given\n')\n", +"//output voltage of an amplifier is 2V when frequency 1khz\n", +"V1=2\n", +"//power in db\n", +"Po=-4\n", +"//new level of output voltage\n", +"V2=10^(Po/20)*V1\n", +"printf('new output voltage \n%f volt\n',V2)" + ] + } +], +"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/Basic_Electronics_by_R_D_S_Samuel/6-Operational_Amplifier.ipynb b/Basic_Electronics_by_R_D_S_Samuel/6-Operational_Amplifier.ipynb new file mode 100644 index 0000000..b01f91f --- /dev/null +++ b/Basic_Electronics_by_R_D_S_Samuel/6-Operational_Amplifier.ipynb @@ -0,0 +1,608 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 6: Operational Amplifier" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.6_15: Calculate_maximum_frequency_at_which_output_is_faithful_reproduction_of_input.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 6.15')\n", +"printf('\n')\n", +"disp('calculate the maximum frequency at which output is faithful reproduction of input')\n", +"printf('given')\n", +"disp('slew rate=3Mv/s')\n", +"sr=3*10^6\n", +"Vm=12\n", +"//calculate Frequency\n", +"fmax=(sr/(2*%pi*Vm))\n", +"printf('maximum frequency=%d hz',fmax)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.6_19: Calculate_common_mode_output_voltage.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 6.19')\n", +"printf('\n')\n", +"disp('calculate common mode gain & output voltage')\n", +"printf('Given')\n", +"disp('differential gain=500')\n", +"disp('CMRR=80dB,Input signal is 2*sin100*%pi*t')\n", +"Ad=500\n", +"CMRR=80\n", +"t=1/200\n", +"Vc=2*sin(100*%pi*t)\n", +"//calculate common mode gain\n", +"Ac=Ad/(10^(CMRR/20))\n", +"//calculate common mode output voltage\n", +"Vcmov=Ac*Vc\n", +"printf('Common mode gain =%f\n',Ac)\n", +"printf('Common mode output voltage =%f volt\n',Vcmov)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.6_20: Express_CMRR_in_dB.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 6.20')\n", +"printf('\n')\n", +"disp('To express CMRR in dB')\n", +"printf('given')\n", +"disp('Ad=10^4,Ac=0.1')\n", +"Ad=10^4\n", +"Ac=0.1\n", +"//to find CMMR in dB\n", +"CMRR=20*log10(Ad/Ac)\n", +"printf('CMRR in dB=%d dB',CMRR)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.6_24: Calculate_and_sketch_the_output.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 6.24')\n", +"printf('\n')\n", +"disp('calculate output voltage for inverting amplifier & sketch the waveform')\n", +"printf('given')\n", +"disp('Peak to peak input votage=200mV,Rf/R1=10')\n", +"Vpp=200*10^(-3)\n", +"Vm=Vpp/2\n", +"RfdivR1=10\n", +"wt=0:0.2:3*%pi\n", +"Vi=Vm*sin(wt)\n", +"Vo=-(RfdivR1)*Vi\n", +"disp(Vo)\n", +"a= gca ();\n", +"subplot(221)\n", +"a= gca();\n", +"a. x_location = 'origin';\n", +"a. y_location = 'origin';\n", +"plot2d(wt,Vi)\n", +"xtitle('Vi V/s wt','wt','Vi in volt')\n", +"a.thickness=2\n", +"subplot(222)\n", +"a= gca();\n", +"a. x_location = 'origin';\n", +"a. y_location = 'origin';\n", +"plot2d(wt,Vo)\n", +"xtitle('Vo V/s wt','wt','Vo in volt')\n", +"a.thickness=2\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.6_25: Calculate_design_value_of_inverting_amplifier.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 6.25')\n", +"printf('\n')\n", +"disp('Design An Inverting Amplifier for the given closed loop gain')\n", +"printf('given')\n", +"disp('closed loop gain=-15')\n", +"Af=(-15)\n", +"R1=10^3\n", +"Rf=(-Af)*R1\n", +"printf('The resistance values are=\n%f ohm,\n%f ohm',R1,Rf)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.6_26: Calculate_output_voltage_of_inverting_amplifier.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 6.26')\n", +"printf('\n')\n", +"disp('calculate the output voltage for a given input voltages')\n", +"printf('given')\n", +"disp('input voltages=0.2,0.5sin314t,-0.4')\n", +"Rf=200*10^3\n", +"R1=20*10^3\n", +"Af=(-Rf)/R1// calculate open loop gain\n", +"t=%pi/(2*314)//intialise t value\n", +"Vi=[0.2,0.5*(sin(314*t)),-0.4]\n", +"Vo=Af*Vi//calculate output voltage\n", +"printf('Output voltages are=\n%f volt,\n%f volt,\n%f volt',Vo)\n", +"\n", +"\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.6_27: Calculate_closed_loop_gain_and_input_voltage_for_a_specified_output_voltage.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 6.27')\n", +"printf('\n')\n", +"disp('Calculate closed loop gain & input voltage to get output voltage 2v')\n", +"printf('given')\n", +"disp('Rf=1M,R1=20K,output voltage=2V')\n", +"Rf=10^6\n", +"R1=20*10^3\n", +"Vo=2\n", +"//calculate closed loop gain\n", +"Af=(-Rf/R1)\n", +"//calculate input voltage\n", +"Vi=Vo/Af\n", +"printf('closed loop voltage gain=%f\n',Af)\n", +"printf('Input voltage=%f volt',Vi)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.6_28: Calculate_feedback_resistor_and_closed_loop_gain.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 6.27')\n", +"printf('\n')\n", +"disp('Calculate closed loop gain & input voltage to get output voltage 2v')\n", +"print('given')\n", +"disp('Rf=1M,R1=20K,output voltage=2V')\n", +"Rf=10^6\n", +"R1=20*10^3\n", +"Vo=2\n", +"//calculate closed loop gain\n", +"Af=(-Rf/R1)\n", +"//calculate input voltage\n", +"Vi=Vo/Af\n", +"printf('closed loop voltage gain=%f\n',Af)\n", +"printf('Input voltage=%f',Vi)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.6_31: Calculate_output_voltage_for_given_input_voltage_of_non_inverting_amplifier.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 6.31')\n", +"printf('\n')\n", +"disp('calculate output voltage for given specification')\n", +"printf('given')\n", +"disp('Rf=360k,R1=120k,Vi=0.5,0.6sin314t,-0.3')\n", +"Rf=360*10^3\n", +"R1=120*10^3\n", +"Af=1+(Rf/R1)\n", +"t=0 //initialise t value\n", +"Vi=[0.5, 0.6*cos(314*t),-0.3]\n", +"Vo=Af*Vi //calculate output voltage\n", +"printf('output voltage =%f volt,\n%f volt,\n%f volt',Vo)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.6_32: EX6_6_32.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 6.32')\n", +"printf('\n')\n", +"disp('Calculate Gain & input voltage')\n", +"printf('Given')\n", +"disp('Rf=100K,R1=10K')\n", +"Rf=100*10^3\n", +"R1=10^4\n", +"//calculate voltage gain\n", +"Af=1+(Rf/R1)\n", +"Vo=4\n", +"//calculate input voltage\n", +"Vi=Vo/Af\n", +"//display values\n", +"printf('Closed loop gain =%f\n',Af)\n", +"printf('Input voltage=%f volt',Vi)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.6_33: Calculate_output_voltage_for_inverting_amplifier.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 6.33')\n", +"printf('\n')\n", +"disp('Calculate output voltage if input voltage is 1V')\n", +"printf('Given')\n", +"disp('R1=1K,Rf=100K,V+=15V,V-=-15,Vi=1v')\n", +"Rf=10^5\n", +"R1=10^3\n", +"//supply votage\n", +"Vplus=15\n", +"Vminus=(-15)\n", +"//calculate voltage gain\n", +"Af=(-Rf)/R1\n", +"Vi=1\n", +"// calculate output voltage\n", +"Vo=Af*Vi\n", +"//condition to check output votage is greater than Vplus\n", +"if(Vo>Vplus) then\n", +" printf('The Maximum positive output voltage=%f volt',Vplus)\n", +"//condition to check output voltage is less than Vminus\n", +"elseif (Vo<Vminus) then\n", +" printf('The maximum negative output voltage=%f volt',Vminus)\n", +"//else display Vo\n", +" else\n", +" printf('The output voltage=%f volt',Vo)\n", +"end" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.6_34: Calculate_output_voltage_for_non_inverting_amplifier.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 6.34')\n", +"printf('\n')\n", +"disp('Calculate output voltage')\n", +"printf('Given')\n", +"disp('R1=2K,Rf=200K,V+=12V,V-=-12,Vi=1.5V')\n", +"Rf=20^4\n", +"R1=2*10^3\n", +"Vplus=12\n", +"Vminus=-12\n", +"Af=1+(Rf/R1)\n", +"Vi=1.5\n", +"Vo=Af*Vi\n", +"//condition to check output votage is greater than Vplus\n", +"if(Vo>Vplus) then\n", +" printf('The Maximum positive output voltage=%f volt',Vplus)\n", +"//condition to check output voltage is less than Vminus\n", +"elseif(Vo<Vminus)\n", +" printf('The maximum negative output voltage=%f volt',Vminus)\n", +" //else display Vo\n", +"else\n", +" printf('The output voltage=%f volt',Vo)\n", +"end" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.6_37: Calculate_closed_loop_gain_and_current.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('example 6.37')\n", +"printf('\n')\n", +"disp('calculate voltage gain,input resistance,current through R1')\n", +"printf('Given')\n", +"disp('Rf=100k,R1=10k')\n", +"disp('input voltage is 0.5v')\n", +"Rf=10^5\n", +"R1=10^4\n", +"Af=-Rf/R1\n", +"Rif=R1\n", +"Vi=0.5\n", +"I1=(Vi/R1)\n", +"printf('closed loop voltage gain is %3.1f\n',Af)\n", +"printf('input resistance is\n %3.1f ohm\n',Rif)\n", +"printf('current flowing through R1 is %f ampere\n',I1)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.6_45: Calculate_output_voltage_for_summer.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 6.45')\n", +"printf('\n')\n", +"disp('Calculate output votage')\n", +"printf('Given')\n", +"disp('input voltage V1=-1v,V2=-2v,V3=3v')\n", +"disp('Resistance Rf=60k,R1=10k,R2=20k,R3=30k')\n", +"Rf=60*10^3;R1=10^4;R2=20*10^3;R3=30*10^3;\n", +"V1=-1;V2=-2;V3=3;\n", +"Vo=-[(Rf/R1)*V1+(Rf/R2)*V2+(Rf/R3)*V3]\n", +"printf('The output voltage is %f volt',Vo)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.6_55: Calculate_bandwidth.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 6.55')\n", +"printf('\n')\n", +"disp('Calculate Bandwidth with feedback')\n", +"printf('Given')\n", +"disp('Open loop voltage gain=2*10^5 \n')\n", +"disp('Break frequency is 5Hz,10% negative feedback\n')\n", +"A=2*10^5\n", +"B=0.1\n", +"Fi=5\n", +"//bandwidth with feedback\n", +"Fb=Fi*(1+A*B)\n", +"printf('Bandwidth with feedback is %f hz\n',Fb)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.6_56: Calculate_the_design_value_of_amplifier_circuit.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 6.56')\n", +"printf('\n')\n", +"printf('Given')\n", +"disp('open loop gain is 100')\n", +"disp('Gain Bandwidth Product is 1MHz')\n", +"Af=100\n", +"GBW=10^6\n", +"ReqBandwidth=GBW/Af\n", +"RfbyR1=Af-1\n", +"printf('the ratio of resistance is=%f',RfbyR1)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.6_57: Calculate_design_value_of_circuit.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 6.57')\n", +"printf('\n')\n", +"printf('given')\n", +"disp('gain is 200 & gain bandwidth product is 1MHz')\n", +"Af=200\n", +"GBW=10^6\n", +"BW=10^4\n", +"reqBW=GBW/Af\n", +"if(reqBW>BW) then\n", +" printf('Required bandwidth is=%f',reqBW)\n", +" else\n", +" Af2=10\n", +" Af1=200/Af2\n", +" R1fbyR11=Af1-1\n", +" R2fbyR21=Af2-1\n", +" printf('The ratio of resistance of both amplifier circuit is=\n%d,\n%d',R1fbyR11,R2fbyR21)\n", +"end" + ] + } +], +"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/Basic_Electronics_by_R_D_S_Samuel/7-Communication_System.ipynb b/Basic_Electronics_by_R_D_S_Samuel/7-Communication_System.ipynb new file mode 100644 index 0000000..de80eb2 --- /dev/null +++ b/Basic_Electronics_by_R_D_S_Samuel/7-Communication_System.ipynb @@ -0,0 +1,517 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 7: Communication System" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7.7_25: Determine_sideband_frequencies_and_Bandwidth.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc \n", +"disp('Example 7.25')\n", +"printf('\n')\n", +"disp('calculate side band frequencies & bandwidth \n')\n", +"printf('Given')\n", +"disp('Fc=600khz,Fm=1khz')\n", +"Fc=6*10^5\n", +"Fm=10^3\n", +"Flsb=Fc-Fm\n", +"Fusb=Fc+Fm\n", +"BW=2*Fm\n", +"printf('Side band frequencies are= %d hz,\t%d hz\n',Flsb,Fusb)\n", +"printf('Bandwidth is=%d hz',BW)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7.7_27: Calculate_total_power_in_modulated_wave.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 7.27')\n", +"printf('\n')\n", +"disp('Calculate the total power in the modulated wave')\n", +"printf('Given')\n", +"disp('carrier power=400W,modulation index=75%')\n", +"Pc=400\n", +"Ma=0.75\n", +"Pt=Pc*(1+(Ma^2/2))\n", +"printf('The total power in modulated wave =\n%f watt',Pt)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7.7_28: Determine_radiated_power.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 7.28')\n", +"printf('\n')\n", +"disp('Determine the radiated power at a modulation index of 0.6')\n", +"printf('Given')\n", +"disp('carrier power=50Khz, modulation index=0.6')\n", +"Pc=5*10^4\n", +"Ma=0.6\n", +"Pt=Pc*(1+(Ma^2/2))\n", +"printf('The total power in modulated wave =\n%f watt',Pt)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7.7_34: Calculate_carrier_power.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 7.34')\n", +"printf('\n')\n", +"disp('calculate carrier power')\n", +"printf('Given\n')\n", +"disp('total power=10KW,modulation index=0.6')\n", +"Pt=10^4\n", +"Ma=0.6\n", +"Pc=Pt/(1+(Ma^2/2))\n", +"printf('The carrier power is=%f watt\n',Pc)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7.7_35: Determine_power_content_of_carrier_and_sidebands.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 7.35')\n", +"printf('\n')\n", +"disp('Determine power content of carrier & each sideband')\n", +"printf('Given\n')\n", +"disp('Total power=2.64KW,modulation index=80%')\n", +"Pt=2.64*10^3\n", +"Ma=0.8\n", +"Pc=Pt/(1+(Ma^2/2))\n", +"Plsb=Ma^2*Pc/4\n", +"Pusb=Plsb\n", +"printf('The total power is=%f watt\n',Pc)\n", +"printf('The sideband power is=\n%f watt,\t%f watt',Plsb,Pusb)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7.7_36: Calculate_sideband_frequencies_and_bandwidth_and_total_power.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 7.36')\n", +"printf('\n')\n", +"disp('Calculate sideband frequencies,bandwidth,power in sidebands,Total power')\n", +"printf('Given')\n", +"disp('carrier power=1KW,carrier frequency=2MHz,Modulation frequency=2KHz,Modulation index=0.6')\n", +"Pc=10^3\n", +"Fc=2*10^6\n", +"Fm=2*10^3\n", +"Ma=0.6\n", +"Flsb=Fc-Fm\n", +"Fusb=Fc+Fm\n", +"BW=2*Fm\n", +"Plsb=Ma^2*Pc/4\n", +"Pusb=Plsb\n", +"Pt=Pc*(1+(Ma^2/2))\n", +"printf('Sideband frequencies are=\n%d hz,\t%d hz\n',Flsb,Fusb)\n", +"printf('Bandwidth=%d hz\n',BW)\n", +"printf('Power in sidebands=\n%f watt,\t%f watt\n',Plsb,Pusb)\n", +"printf('Total power=\n%f watt',Pt)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7.7_37: Calculate_modulation_index.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 7.37')\n", +"printf('\n')\n", +"disp('Calculate the modulation index')\n", +"printf('Given\n')\n", +"disp('carrier voltage=100V,Total modulated voltage in rms=110V')\n", +"Vt=110\n", +"Vcar=100\n", +"//assume R value as 1\n", +"R=1\n", +"Pt=Vt^2/R\n", +"Pc=Vcar^2/R\n", +"Ma=sqrt(2*((Pt/Pc)-1))\n", +"printf('Modulation index =%f',Ma)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7.7_38: Determine_antenna_current.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 7.38')\n", +"printf('\n')\n", +"disp('Determine modulation index & Antenna current when MOdulation index changes to 0.8')\n", +"printf('given\n')\n", +"disp('carrier current=8A,Modulated carrier current=8.93A')\n", +"Icar=8\n", +"It=8.93\n", +"//assume R=1\n", +"R=1\n", +"Pc=Icar^2*R\n", +"Pt=It^2*R\n", +"Ma=sqrt(2*((Pt/Pc)-1))\n", +"//Modulated carrier current when Ma changes to 8\n", +"Ma1=0.8\n", +"It1=Icar*sqrt(1+(Ma1^2/2))\n", +"printf('Modulation index =%f\n',Ma)\n", +"printf('Modulated carrier current when Ma changes to 8 is =%f ampere',It1)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7.7_39: Calculate_tranmission_power_efficiency_and_average_power_in_carrier_component.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 7.39')\n", +"printf('\n')\n", +"disp('Calculate transmission power efficiency and average power in carrier component')\n", +"printf('Given \n')\n", +"disp('Total power=20KW,Modulation index=0.7')\n", +"Pt=2*10^4\n", +"Ma=0.7\n", +"Pc=Pt/(1+(Ma^2/2))\n", +"%n=(Ma^2/(2+Ma^2))*100\n", +"printf('The carrier Power =%f watt\n',Pc)\n", +"printf('The transmission power efficiency =%f',%n)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7.7_40: Calculate_modulation_index.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 7.40')\n", +"printf('\n')\n", +"disp('Calculate modulation index')\n", +"printf('Given\n')\n", +"disp('maximum & minimum amplitudes are 600mv,200mv')\n", +"Vmax=600*10^-3\n", +"Vmin=200*10^-3\n", +"Ma=(Vmax-Vmin)/(Vmax+Vmin)\n", +"printf('Modulation Index is =\n%f',Ma)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7.7_41: Sketch_the_frequency_spectrum.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 7.41')\n", +"printf('\n')\n", +"disp('sketch the frequency spectrum')\n", +"printf('Given\n')\n", +"disp('carrier amplitude=10V,carrier frequency=10MHz,Modulating frequency=1Khz,MI=0.5')\n", +"Vc=10\n", +"fc=10^7\n", +"fm=10^3\n", +"ma=0.5\n", +"wc=2*%pi*fc\n", +"wm=2*%pi*fm\n", +"t=10^-7\n", +"v=Vc*(1+(ma*sin(wm*t)))*cos(wc*t)\n", +"Vs=(ma*Vc)/2\n", +"flsb=fc-fm\n", +"fusb=fc+fm\n", +"// take below values just for plotting graph with intial values\n", +"f1=9.9989*10^6\n", +"v1=0\n", +"f=[f1 flsb fc fusb]\n", +"a=[v1 Vs Vc Vs]\n", +"plot2d3(f,a)\n", +"xtitle('Frequency Spectrum')\n", +"xlabel('Frequency')\n", +"ylabel('Amplitude')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7.7_42: Find_the_saving_power_in_LSB_alone.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 7.42')\n", +"printf('\n')\n", +"disp('Find the saving power if power contained in the LSB alone is used')\n", +"printf('Given\n')\n", +"disp('Total power=20KW,Modulation Index=0.8')\n", +"Pt=20*10^3\n", +"Ma=0.8\n", +"Pc=Pt/(1+(Ma^2/2))\n", +"Plsb=(Pt-Pc)/2\n", +"%Ps=((Pt-Plsb)/Pt)*100\n", +"printf('power in sideband=%f watt\n',Plsb)\n", +"printf('Saving in power=\n%f\n',%Ps)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7.7_55: Find_maximum_frequency_deviation_and_modulation_index.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 7.55')\n", +"printf('\n')\n", +"disp('Find the maximum frequency deviation & modulation index')\n", +"printf('Given\n')\n", +"disp('Kf=1KHz/v,Modulating voltage=15v,frequency=3KHz')\n", +"K=10^3\n", +"Vm=15\n", +"Fm=3*10^3\n", +"del=K*Vm\n", +"Mf=del/Fm\n", +"printf('Maximum frequency Deviation is =\n%d hz\n',del)\n", +"printf('Modulation Index=\n%f\n',Mf)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7.7_56: Calculate_frequency_deviation_and_modulation_index.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 7.56')\n", +"printf('\n')\n", +"disp('find the frequency deviation & modulation index')\n", +"printf('Given\n')\n", +"del=5*10^3\n", +"Vm=2.5\n", +"Kf=del/Vm\n", +"//when Vm=7.5\n", +"Vm=7.5\n", +"del1=Kf*Vm\n", +"//when Vm=10v\n", +"Vm=10\n", +"del2=Kf*Vm\n", +"Fm1=500\n", +"Mf1=del/Fm1\n", +"Mf2=del1/Fm1\n", +"Fm2=250\n", +"Mf3=del2/Fm2\n", +"printf('Frequency deviation at different modulating Voltage =\n%d hz\n%d hz\n',del1,del2)\n", +"printf('Modulation index at different frequency deviation & modulating frequency =\n%d\n%d\n%d\n',Mf1,Mf2,Mf3)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7.7_92: Find_the_peak_value_of_unknown_voltage.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 7.92')\n", +"printf('\n')\n", +"disp('Find the Peak Value')\n", +"printf('Given\n')\n", +"disp('Vpp=100v,deflection=5cm')\n", +"Vpp=100\n", +"D=5\n", +"DS=Vpp/D\n", +"//another sinusoidal produces a deflection of 8cm\n", +"D1=8\n", +"Vpp1=DS*D1\n", +"printf('The peak value of unknown voltage=\n%d volt\n',Vpp1)" + ] + } +], +"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/Basic_Electronics_by_R_D_S_Samuel/8-Digital_Logic.ipynb b/Basic_Electronics_by_R_D_S_Samuel/8-Digital_Logic.ipynb new file mode 100644 index 0000000..3aba9e6 --- /dev/null +++ b/Basic_Electronics_by_R_D_S_Samuel/8-Digital_Logic.ipynb @@ -0,0 +1,1746 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 8: Digital Logic" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.8_10: convert_the_decimal_to_binary_numbers.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"disp('Example 8.10')\n", +"printf('\n')\n", +"disp('convert the following decimal to binary numbers')\n", +"disp('a)47.8125 b)100.0001 c)29.3749')\n", +"//given decimal number\n", +"i=1;x=1\n", +"dec=47.8125\n", +"//separating integer part\n", +"IP=floor(dec)\n", +"IP1=IP \n", +"//separating decimal part \n", +"DP=modulo(dec,1)\n", +"//storing each integer digit in I(i)\n", +"while(IP>0) \n", +" I(i)=(modulo(floor(IP),2))\n", +" IP=floor(IP)/2\n", +" i=i+1\n", +"end\n", +"if(IP1>0)\n", +"IP=0\n", +"for j=1:length(I)\n", +"//multipliying bits of integer part with their position values and adding \n", +" IP=IP+(I(j)*10^(j-1));\n", +" end\n", +"else\n", +" IP=0\n", +"end\n", +"\n", +"//storing each decimal digit in D(x)\n", +"while(x<=4)\n", +" DP=DP*2\n", +" D(x)=floor(DP)\n", +" x=x+1\n", +" DP=modulo(DP,1)\n", +"end \n", +"\n", +"DP=0 \n", +"for j=1:length(D)\n", +"//multipliying bits of decimal part with their position values and adding \n", +" DP=DP+(10^(-1*j)*D(j))\n", +"end\n", +"Binary=IP+DP;\n", +"printf('Binary format is')\n", +"disp(Binary)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.8_12: convert_the_octal_to_decimal.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"disp('Example 8.12')\n", +"printf('\n')\n", +"disp('convert the following octal to decimal')\n", +"disp('a)243 b)124.21 c)0.65')\n", +"//Given octal number\n", +"i=1;w=1\n", +"oct=243\n", +"//separating integer part \n", +"IP=floor(oct)\n", +"IP1=IP\n", +"//separating decimal part\n", +"DP=modulo(oct,1) \n", +"DP1=DP\n", +"//converting decimal value to interger\n", +"p=2\n", +"DP=DP*10^p //should change power of 10 as according to number of digits in decimal digit\n", +"//storing each integer digit in I(i)\n", +"while(IP>0)\n", +" I(i)=modulo(IP,10);\n", +" IP=floor(IP/10);\n", +" i=i+1;\n", +" end\n", +"//storing each decimal digit in D(w)\n", +"while(DP>0)\n", +" D(w)=modulo(DP,10)\n", +" DP=(DP/10)\n", +" DP=floor(DP)\n", +" w=w+1;\n", +" end\n", +"//to do zero padding of remaining erm of D(w)\n", +"if(DP1<1)\n", +" if(DP1>0)\n", +"if(length(D)<p)\n", +" q=length(D)\n", +" for f=q+1 :p\n", +" D(f)=0\n", +" end\n", +" end\n", +"end\n", +"end\n", +"\n", +"if(IP1>0)\n", +"for i=1:length(I)//checking whether it is a octal number or not\n", +" if(I(i)>8) then\n", +" disp('not a octal number')\n", +" abort\n", +" end\n", +" end\n", +"end\n", +"if(IP1>0)\n", +"IP=0\n", +"for i=1:length(I)\n", +"//multipliying bits of integer part with their position values and adding \n", +" IP=IP+(I(i)*8^(i-1))\n", +" end\n", +"end\n", +"\n", +"if(DP1<1)\n", +" if(DP1>0)\n", +"DP=0\n", +"for z=1:length(D)\n", +" //multipliying bits of decimal part with their position values and adding\n", +" if(D(z)<8) \n", +" DP=DP+(D(z)*8^(-1*(length(D)+1-z)))\n", +" else\n", +" IP=0\n", +" DP=0\n", +" printf('not a octal number')\n", +" abort\n", +" end\n", +"end\n", +"end\n", +"\n", +"decimal=IP+DP\n", +"//displaying the output\n", +"printf('Decimal format')\n", +"disp(decimal)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.8_13: convert_the_decimael_numbers_to_Octal.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"disp('Example 8.13')\n", +"printf('\n')\n", +"disp('convert the following decimael numbers to Octal')\n", +"disp('a)283 b)847.951 c)0.728')\n", +"//given decimal number\n", +"i=1;x=1\n", +"dec=283\n", +"//separating integer part\n", +"IP=floor(dec)\n", +"IP1=IP \n", +"//separating decimal part \n", +"DP=modulo(dec,1)\n", +"//storing each integer digit in I(i)\n", +"while(IP>0) \n", +" I(i)=(modulo(floor(IP),8))\n", +" IP=floor(IP)/8\n", +" i=i+1\n", +"end\n", +"if(IP1>0)\n", +"IP=0\n", +"for j=1:length(I)\n", +"//multipliying bits of integer part with their position values and adding \n", +" IP=IP+(I(j)*10^(j-1));\n", +" end\n", +"else\n", +" IP=0\n", +"end\n", +"\n", +"//storing each decimal digit in D(x)\n", +"if(DP<1)\n", +" if(DP>0)\n", +"while(x<=4)\n", +" DP=DP*8\n", +" D(x)=floor(DP)\n", +" x=x+1\n", +" DP=modulo(DP,1)\n", +"end \n", +"\n", +"DP=0 \n", +"for j=1:length(D)\n", +"//multipliying bits of decimal part with their position values and adding \n", +" DP=DP+(10^(-1*j)*D(j))\n", +" end\n", +"end \n", +"end\n", +"octal=IP+DP\n", +"printf('Octal format')\n", +"disp(octal)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.8_14: convert_the_binary_number_to_Octal.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"disp('Example 8.14')\n", +"printf('\n')\n", +"disp('convert the following binary number to Octal')\n", +"disp('a)101111 b)1010101 c)1110.01101')\n", +"i=1;x=1;w=1\n", +"//convert binary to decimal\n", +"bin=101111\n", +"//separating integer part \n", +"IP=floor(bin)\n", +"IP1=IP\n", +"//separating decimal part\n", +"DP=modulo(bin,1) \n", +"DP1=DP\n", +"//converting decimal value to interger\n", +"p=5\n", +"DP=DP*10^p //should change power of 10 as according to number of digits in decimal digit\n", +"//storing each integer digit in I(i)\n", +"while(IP>0)\n", +" I(i)=modulo(IP,10);\n", +" IP=floor(IP/10);\n", +" i=i+1;\n", +" end\n", +"//storing each decimal digit in D(w)\n", +"while(DP>0)\n", +" D(w)=modulo(DP,2)\n", +" DP=(DP/10)\n", +" DP=floor(DP)\n", +" w=w+1;\n", +" end\n", +" //to do zero padding of remaining erm of D(w)\n", +" if(DP1>0)\n", +" if(DP1<1)\n", +"if(length(D)<p)\n", +" q=length(D)\n", +" for f=q+1 :p\n", +" D(f)=0\n", +" end\n", +" end\n", +"end\n", +"end\n", +"if(IP1>0)\n", +"for i=1:length(I)//checking whether it is a binary number or not\n", +" if(I(i)>1) then\n", +" disp('not a binary number')\n", +" abort\n", +" end\n", +" end\n", +"end\n", +"if(IP1>0)\n", +"IP=0\n", +"for i=1:length(I)\n", +"//multipliying bits of integer part with their position values and adding \n", +" IP=IP+(I(i)*2^(i-1))\n", +" end\n", +"end\n", +"if(DP1>0)\n", +" if(DP1<1)\n", +"DP=0\n", +"for z=1:length(D)\n", +"//multipliying bits of decimal part with their position values and adding \n", +" DP=DP+(D(z)*2^(-1*(length(D)+1-z)))\n", +" end\n", +" else\n", +" DP=0\n", +"end\n", +"else\n", +"DP=0\n", +"end\n", +"decimal=IP+DP\n", +"//displaying the output\n", +"disp(decimal)\n", +"\n", +"\n", +"\n", +"//convert decimal to octal\n", +"i=1;\n", +"//separating integer part\n", +"IP2=floor(decimal)\n", +"IP3=IP2 \n", +"//separating decimal part \n", +"DP2=modulo(decimal,1)\n", +"//storing each integer digit in I(i)\n", +"while(IP2>0) \n", +" J(i)=(modulo(floor(IP2),8))\n", +" IP2=floor(IP2)/8\n", +" i=i+1\n", +"end\n", +"if(IP3>0)\n", +"IP2=0\n", +"for j=1:length(J)\n", +"//multipliying bits of integer part with their position values and adding \n", +" IP2=IP2+(J(j)*10^(j-1));\n", +" end\n", +"else\n", +" IP2=0\n", +"end\n", +"\n", +"//storing each decimal digit in D(x)\n", +"if(DP2<1)\n", +" if(DP2>0)\n", +"while(x<=4)\n", +" DP2=DP2*8\n", +" E(x)=floor(DP2)\n", +" x=x+1\n", +" DP2=modulo(DP2,1)\n", +"end \n", +"\n", +"DP2=0 \n", +"for j=1:length(E)\n", +"//multipliying bits of decimal part with their position values and adding \n", +" DP2=DP2+(10^(-1*j)*E(j))\n", +" end\n", +"end \n", +"end\n", +"octal=IP2+DP2\n", +"printf('Octal format')\n", +"disp(octal)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.8_15: convert_the_octal_to_binary_number.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"disp('Example 8.15')\n", +"printf('\n')\n", +"disp('convert the following octal to binary number')\n", +"disp('a)724 b)365.217 c)0.506')\n", +"//Given binary number\n", +"i=1;w=1\n", +"bin=724\n", +"//separating integer part \n", +"IP=floor(bin)\n", +"IP1=IP\n", +"//separating decimal part\n", +"DP=modulo(bin,1) \n", +"DP1=DP\n", +"//converting decimal value to interger\n", +"p=2\n", +"DP=DP*10^p //should change power of 10 as according to number of digits in decimal digit\n", +"//storing each integer digit in I(i)\n", +"while(IP>0)\n", +" I(i)=modulo(IP,10);\n", +" IP=floor(IP/10);\n", +" i=i+1;\n", +" end\n", +"//storing each decimal digit in D(w)\n", +"while(DP>0)\n", +" D(w)=modulo(DP,10)\n", +" DP=(DP/10)\n", +" DP=floor(DP)\n", +" w=w+1;\n", +" end\n", +"//to do zero padding of remaining erm of D(w)\n", +"if(DP1<1)\n", +" if(DP1>0)\n", +"if(length(D)<p)\n", +" q=length(D)\n", +" for f=q+1 :p\n", +" D(f)=0\n", +" end\n", +" end\n", +"end\n", +"end\n", +"\n", +"if(IP1>0)\n", +"for i=1:length(I)//checking whether it is a octal number or not\n", +" if(I(i)>8) then\n", +" disp('not a octal number')\n", +" abort\n", +" end\n", +" end\n", +"end\n", +"if(IP1>0)\n", +"IP=0\n", +"for i=1:length(I)\n", +"//multipliying bits of integer part with their position values and adding \n", +" IP=IP+(I(i)*8^(i-1))\n", +" end\n", +"end\n", +"\n", +"if(DP1<1)\n", +" if(DP1>0)\n", +"DP=0\n", +"for z=1:length(D)\n", +" //multipliying bits of decimal part with their position values and adding\n", +" if(D(z)<8) \n", +" DP=DP+(D(z)*8^(-1*(length(D)+1-z)))\n", +" else\n", +" IP=0\n", +" DP=0\n", +" printf('not a octal number')\n", +" abort\n", +" end\n", +"end\n", +"end\n", +"\n", +"decimal=IP+DP\n", +"//displaying the output\n", +"disp(decimal)\n", +"\n", +"\n", +"\n", +"//decimal to Binary\n", +"//given decimal number\n", +"i=1;x=1\n", +"//separating integer part\n", +"IP2=floor(decimal)\n", +"IP3=IP2\n", +"//separating decimal part \n", +"DP2=modulo(decimal,1)\n", +"//storing each integer digit in I(i)\n", +"while(IP2>0) \n", +" J(i)=(modulo(floor(IP2),2))\n", +" IP2=floor(IP2)/2\n", +" i=i+1\n", +"end\n", +"if(IP3>0)\n", +"IP2=0\n", +"for j=1:length(J)\n", +"//multipliying bits of integer part with their position values and adding \n", +" IP2=IP2+(J(j)*10^(j-1));\n", +" end\n", +"else\n", +" IP2=0\n", +"end\n", +"\n", +"//storing each decimal digit in D(x)\n", +"while(x<=4)\n", +" DP2=DP2*2\n", +" E(x)=floor(DP)\n", +" x=x+1\n", +" DP2=modulo(DP2,1)\n", +"end \n", +"\n", +"DP2=0 \n", +"for j=1:length(E)\n", +"//multipliying bits of decimal part with their position values and adding \n", +" DP2=DP2+(10^(-1*j)*E(j))\n", +"end\n", +"Binary=IP2+DP2;\n", +"printf('Binary format')\n", +"disp(Binary)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.8_17: convert_the_hexadecimael_numbers_to_decimal.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"disp('Example 8.17')\n", +"printf('\n')\n", +"disp('convert the following hexadecimael numbers to decimal')\n", +"disp('a)FACE b)31C c)CAD')\n", +"//this progra, converts only integer part to decimal\n", +"Hdec='FACE'\n", +"dec=hex2dec(Hdec);\n", +"printf('decimal=%d',dec)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.8_18: convert_the_decimael_numbers_to_hexadecimal.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"disp('Example 8.17')\n", +"printf('\n')\n", +"disp('convert the following decimael numbers to hexadecimal')\n", +"disp('a)2146 b)843 c)2604')\n", +"//this program, converts only integer part to hexadecimal\n", +"dec=843\n", +"Hdec=dec2hex(dec);\n", +"printf('decimal=%s',Hdec)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.8_19: convert_the_binary_numbers_to_hexadecimal.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"disp('Example 8.19')\n", +"printf('\n')\n", +"disp('convert the following binary numbers to hexadecimal')\n", +"disp('a)101110 b)11010 c)1011101')\n", +"//this program, converts only integer part to decimal\n", +"bin='101110'\n", +"dec=bin2dec(bin)\n", +"Hdec=dec2hex(dec)\n", +"printf('decimal=%s',Hdec)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.8_21: Add_the_binary_numbers.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"kclc\n", +"clear\n", +"disp('Example 8.21')\n", +"printf('\n')\n", +"disp('Add the following binary numbers')\n", +"disp('a)11011 & 10110 b)1100 & 111 c)10.1011 & 11.011')\n", +"//Given binary number\n", +"i=1;w=1\n", +"a=11011\n", +"b=10110\n", +"//Given binary number\n", +"i=1;w=1\n", +"bin=11.101\n", +"//separating integer part \n", +"IPa=floor(a)\n", +"IP1a=IPa\n", +"//separating decimal part\n", +"DPa=modulo(a,1) \n", +"DP1a=DPa\n", +"//converting decimal value to interger\n", +"p=4\n", +"DPa=DPa*10^p //should change power of 10 as according to number of digits in decimal digit\n", +"\n", +"//storing each integer digit in I(i)\n", +"while(IPa>0)\n", +" Ia(i)=modulo(IPa,10);\n", +" IPa=floor(IPa/10);\n", +" i=i+1;\n", +" end\n", +"//storing each decimal digit in D(w)\n", +"while(DPa>0)\n", +" Da(w)=modulo(DPa,2)\n", +" DPa=(DPa/10)\n", +" DPa=floor(DPa)\n", +" w=w+1;\n", +" end\n", +" //to do zero padding of remaining erm of D(w)\n", +" if(DP1a<1)\n", +" if(DP1a>0)\n", +"if(length(Da)<p)\n", +" q=length(Da)\n", +" for f=q+1 :p\n", +" Da(f)=0\n", +" end\n", +" end\n", +"end\n", +"end\n", +"\n", +"if(IP1a>0)\n", +"for i=1:length(Ia)//checking whether it is a binary number or not\n", +" if(Ia(i)>1) then\n", +" disp('not a binary number')\n", +" abort\n", +" end\n", +" end\n", +"end\n", +"if(IP1a>0)\n", +"IPa=0\n", +"for i=1:length(Ia)\n", +"//multipliying bits of integer part with their position values and adding \n", +" IPa=IPa+(Ia(i)*2^(i-1))\n", +" end\n", +" end\n", +" DPa=0\n", +" if(DP1a>0)\n", +" if(DP1a<1)\n", +"for z=1:length(Da)\n", +"//multipliying bits of decimal part with their position values and adding \n", +" DPa=DPa+(Da(z)*2^(-1*(length(Da)+1-z)))\n", +" end\n", +"end\n", +"end\n", +"decimala=IPa+DPa\n", +"//displaying the output\n", +"disp(decimala)\n", +"\n", +"//for b\n", +"//Given binary number\n", +"i=1;w=1\n", +"//separating integer part \n", +"IPb=floor(b)\n", +"IP1b=IPb\n", +"//separating decimal part\n", +"DPb=modulo(b,1) \n", +"DP1b=DPb\n", +"//converting decimal value to interger\n", +"p=3\n", +"DPb=DPb*10^p //should change power of 10 as according to number of digits in decimal digit\n", +"\n", +"//storing each integer digit in I(i)\n", +"while(IPb>0)\n", +" Ib(i)=modulo(IPb,10);\n", +" IPb=floor(IPb/10);\n", +" i=i+1;\n", +" end\n", +"//storing each decimal digit in D(w)\n", +"while(DPb>0)\n", +" Db(w)=modulo(DPb,2)\n", +" DPb=(DPb/10)\n", +" DPb=floor(DPb)\n", +" w=w+1;\n", +" end\n", +" //to do zero padding of remaining erm of D(w)\n", +" if(DP1b>0)\n", +" if(DP1b<1)\n", +"if(length(Db)<p)\n", +" q=length(Db)\n", +" for f=q+1 :p\n", +" Db(f)=0\n", +" end\n", +" end\n", +"end\n", +"end\n", +"if(IP1b>0)\n", +"for i=1:length(Ib)//checking whether it is a binary number or not\n", +" if(Ib(i)>1) then\n", +" disp('not a binary number')\n", +" abort\n", +" end\n", +" end\n", +"end\n", +"if(IP1b>0)\n", +"IPb=0\n", +"for i=1:length(Ib)\n", +"//multipliying bits of integer part with their position values and adding \n", +" IPb=IPb+(Ib(i)*2^(i-1))\n", +" end\n", +" end\n", +"DPb=0\n", +"if(DP1b>0)\n", +" if(DP1b<1)\n", +" for z=1:length(Db)\n", +"//multipliying bits of decimal part with their position values and adding \n", +" DPb=DPb+(Db(z)*2^(-1*(length(Db)+1-z)))\n", +" end\n", +"end\n", +"end\n", +"decimalb=IPb+DPb\n", +"//displaying the output\n", +"disp(decimalb)\n", +"\n", +"sum1=decimala+decimalb\n", +"i=1;x=1\n", +"\n", +"//separating integer part\n", +"IP=floor(sum1)\n", +"IP1=IP \n", +"//separating decimal part \n", +"DP=modulo(sum1,1)\n", +"//storing each integer digit in I(i)\n", +"while(IP>0) \n", +" I(i)=(modulo(floor(IP),2))\n", +" IP=floor(IP)/2\n", +" i=i+1\n", +"end\n", +"if(IP1>0)\n", +"IP=0\n", +"for j=1:length(I)\n", +"//multipliying bits of integer part with their position values and adding \n", +" IP=IP+(I(j)*10^(j-1));\n", +" end\n", +"else\n", +" IP=0\n", +"end\n", +"\n", +"//storing each decimal digit in D(x)\n", +"while(x<=4)\n", +" DP=DP*2\n", +" D(x)=floor(DP)\n", +" x=x+1\n", +" DP=modulo(DP,1)\n", +"end \n", +"\n", +"DP=0 \n", +"for j=1:length(D)\n", +"//multipliying bits of decimal part with their position values and adding \n", +" DP=DP+(10^(-1*j)*D(j))\n", +"end\n", +"Binary=IP+DP;\n", +"printf('Sum')\n", +"disp(Binary)\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.8_23: Add_the_octal_numbers.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"disp('Example 8.23')\n", +"printf('\n')\n", +"disp('Add the following octal numbers')\n", +"disp('a)46 & 375 b)27.34 & 11.76')\n", +"//Given octal number\n", +"i=1;w=1\n", +"a=46\n", +"b=375\n", +"//separating integer part \n", +"IPa=floor(a)\n", +"IP1a=IPa\n", +"//separating decimal part\n", +"DPa=modulo(a,1) \n", +"DP1a=DPa\n", +"//converting decimal value to interger\n", +"p=2\n", +"DPa=DPa*10^p //should change power of 10 as according to number of digits in decimal digit\n", +"//storing each integer digit in I(i)\n", +"while(IPa>0)\n", +" Ia(i)=modulo(IPa,10);\n", +" IPa=floor(IPa/10);\n", +" i=i+1;\n", +" end\n", +"//storing each decimal digit in D(w)\n", +"while(DPa>0)\n", +" Da(w)=modulo(DPa,10)\n", +" DPa=(DPa/10)\n", +" DPa=floor(DPa)\n", +" w=w+1;\n", +" end\n", +"//to do zero padding of remaining erm of D(w)\n", +"if(DP1a<1)\n", +" if(DP1a>0)\n", +"if(length(Da)<p)\n", +" q=length(Da)\n", +" for f=q+1 :p\n", +" Da(f)=0\n", +" end\n", +" end\n", +"end\n", +"end\n", +"\n", +"if(IP1a>0)\n", +"for i=1:length(Ia)//checking whether it is a octal number or not\n", +" if(Ia(i)>8) then\n", +" disp('not a octal number')\n", +" abort\n", +" end\n", +" end\n", +"end\n", +"if(IP1a>0)\n", +"IPa=0\n", +"for i=1:length(Ia)\n", +"//multipliying bits of integer part with their position values and adding \n", +" IPa=IPa+(Ia(i)*8^(i-1))\n", +" end\n", +"end\n", +"\n", +"if(DP1a<1)\n", +" if(DP1a>0)\n", +"DPa=0\n", +"for z=1:length(Da)\n", +" //multipliying bits of decimal part with their position values and adding\n", +" if(Da(z)<8) \n", +" DPa=DPa+(Da(z)*8^(-1*(length(Da)+1-z)))\n", +" else\n", +" IPa=0\n", +" DPa=0\n", +" printf('not a octal number')\n", +" abort\n", +" end\n", +"end\n", +"end\n", +"\n", +"decimala=IPa+DPa\n", +"//displaying the output\n", +"disp(decimala)\n", +"\n", +"//for b\n", +"//Given octal number\n", +"i=1;w=1\n", +"//separating integer part \n", +"IPb=floor(b)\n", +"IP1b=IPb\n", +"//separating decimal part\n", +"DPb=modulo(b,1) \n", +"DP1b=DPb\n", +"//converting decimal value to interger\n", +"p=2\n", +"DPb=DPb*10^p //should change power of 10 as according to number of digits in decimal digit\n", +"//storing each integer digit in I(i)\n", +"while(IPb>0)\n", +" Ib(i)=modulo(IPb,10);\n", +" IPb=floor(IPb/10);\n", +" i=i+1;\n", +" end\n", +"//storing each decimal digit in D(w)\n", +"while(DPb>0)\n", +" Db(w)=modulo(DPb,10)\n", +" DPb=(DPb/10)\n", +" DPb=floor(DPb)\n", +" w=w+1;\n", +" end\n", +"//to do zero padding of remaining erm of D(w)\n", +"if(DP1b<1)\n", +" if(DP1b>0)\n", +"if(length(Db)<p)\n", +" q=length(Db)\n", +" for f=q+1 :p\n", +" Db(f)=0\n", +" end\n", +" end\n", +"end\n", +"end\n", +"\n", +"if(IP1b>0)\n", +"for i=1:length(Ib)//checking whether it is a octal number or not\n", +" if(Ib(i)>8) then\n", +" disp('not a octal number')\n", +" abort\n", +" end\n", +" end\n", +"end\n", +"if(IP1b>0)\n", +"IPb=0\n", +"for i=1:length(Ib)\n", +"//multipliying bits of integer part with their position values and adding \n", +" IPb=IPb+(Ib(i)*8^(i-1))\n", +" end\n", +"end\n", +"\n", +"if(DP1b<1)\n", +" if(DP1b>0)\n", +"DPb=0\n", +"for z=1:length(Db)\n", +" //multipliying bits of decimal part with their position values and adding\n", +" if(Db(z)<8) \n", +" DPb=DPb+(Db(z)*8^(-1*(length(Db)+1-z)))\n", +" else\n", +" IPb=0\n", +" DPb=0\n", +" printf('not a octal number')\n", +" abort\n", +" end\n", +"end\n", +"end\n", +"\n", +"decimalb=IPb+DPb\n", +"//displaying the output\n", +"disp(decimalb)\n", +"\n", +"sum1=decimala+decimalb\n", +"i=1;x=1\n", +"//separating integer part\n", +"IP=floor(sum1)\n", +"IP1=IP \n", +"//separating decimal part \n", +"DP=modulo(sum1,1)\n", +"//storing each integer digit in I(i)\n", +"while(IP>0) \n", +" I(i)=(modulo(floor(IP),8))\n", +" IP=floor(IP)/8\n", +" i=i+1\n", +"end\n", +"if(IP1>0)\n", +"IP=0\n", +"for j=1:length(I)\n", +"//multipliying bits of integer part with their position values and adding \n", +" IP=IP+(I(j)*10^(j-1));\n", +" end\n", +"else\n", +" IP=0\n", +"end\n", +"\n", +"//storing each decimal digit in D(x)\n", +"if(DP<1)\n", +" if(DP>0)\n", +"while(x<=4)\n", +" DP=DP*8\n", +" D(x)=floor(DP)\n", +" x=x+1\n", +" DP=modulo(DP,1)\n", +"end \n", +"\n", +"DP=0 \n", +"for j=1:length(D)\n", +"//multipliying bits of decimal part with their position values and adding \n", +" DP=DP+(10^(-1*j)*D(j))\n", +" end\n", +"end \n", +"end\n", +"octal=IP+DP\n", +"printf('Sum')\n", +"disp(octal)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.8_25: Add_the_hexadecimal_numbers.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"disp('Example 8.25')\n", +"printf('\n')\n", +"disp('Add the following hexadecimal numbers')\n", +"disp('a)ABC & ABCDE b) DEF & 12EF')\n", +"//this program add only integer part\n", +"a='ABC'\n", +"b='ABCDE'\n", +"a1=hex2dec(a)\n", +"a2=hex2dec(b)\n", +"sum1=a1+a2\n", +"sumhex=dec2hex(sum1)\n", +"printf('%s',sumhex)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.8_30a: perform_the_decimal_subtraction_using_9s_complements.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"disp('Example 8.30a')\n", +"printf('\n')\n", +"disp('perform the following decimal subtraction using 9s complements')\n", +"disp('a)49-24 b)321-578')\n", +"//given numbers\n", +"a=49\n", +"b=-24\n", +"//should set to 99 if input is 2 digit number,999 if 3digit number\n", +"c=99\n", +"//add c with 2nd operand\n", +"e=c+b\n", +"N=a+e\n", +"if(N>100)\n", +" if(N<199)\n", +" M=N-100\n", +" M=M+1\n", +" N=M\n", +"end\n", +"end\n", +"if(N>1000)\n", +" if(N<1999)\n", +" M=N-1000\n", +" M=M+1\n", +" N=M\n", +"end\n", +"end\n", +" M=N\n", +"if(-b>a)\n", +" M=-(999-M)\n", +"end\n", +"printf('result=%d',M)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.8_30b: perform_the_decimal_subtraction_using_10s_complements.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"disp('Example 8.30b')\n", +"printf('\n')\n", +"disp('perform the following decimal subtraction using 10s complements')\n", +"disp('a)49-24 b)321-578')\n", +"//given numbers\n", +"a=49\n", +"b=-24\n", +"//should set to 100 if input is 2 digit number,1000 if 3digit number\n", +"c=1000\n", +"//add c with 2nd operand\n", +"e=c+b\n", +"N=a+e\n", +"if(N>100)\n", +" if(N<199)\n", +" M=N-100\n", +" N=M\n", +"end\n", +"end\n", +"if(N>1000)\n", +" if(N<1999)\n", +" M=N-1000\n", +" N=M\n", +"end\n", +"end\n", +" M=N\n", +"if(-b>a)\n", +" M=-(999-M+1)\n", +"end\n", +"printf('result=%d',M)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.8_31a: perform_the_binary_substraction_using_1s_complement.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"disp('Example 8.31a')\n", +"printf('\n')\n", +"disp('perform the following binary substraction using 1s complement')\n", +"disp('a)1010-0111 b)0110-1101')\n", +"a=[1 0 1 0]\n", +"b=~[0 1 1 1]\n", +"d=0\n", +"for i=1:length(a)\n", +" c(i)=a(length(a)+1-i)+b(length(a)+1-i)+d\n", +" if(c(i)==1)\n", +" d=0\n", +" end\n", +" if[c(i)==2]\n", +" d=1\n", +" c(i)=0\n", +" end\n", +"end\n", +"f=1\n", +"if(d==1)\n", +" for i=1:length(a)\n", +" g(i)=c(i)+f\n", +" if(g(i)==1)\n", +" f=0\n", +" end\n", +" if(g(i)==2)\n", +" f=1\n", +" g(i)=0\n", +" end\n", +" \n", +" end\n", +" for i=1:length(a)\n", +" c(i)=g(i)\n", +" end\n", +"end\n", +"if(d==0)\n", +" for i=1:length(a)\n", +" c(i)=~c(i)\n", +" end\n", +"end\n", +"printf('result =%d%d%d%d',c(4),c(3),c(2),c(1))\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.8_31b: perform_the_binary_substraction_using_2s_complement.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"disp('Example 8.31b')\n", +"printf('\n')\n", +"disp('perform the following binary substraction using 2s complement')\n", +"disp('a)1010-0111 b)0110-1101')\n", +"a=[1 0 1 0]\n", +"b=~[0 1 1 1]\n", +"d=0\n", +"h=1\n", +"for i=1:length(b)\n", +" n(i)=b(length(b)+1-i)+h\n", +" if(n(i)==1)\n", +" h=0\n", +" end\n", +" if(n(i)==2)\n", +" h=1\n", +" n(i)=0\n", +" end\n", +" \n", +" end\n", +" for i=1:length(a)\n", +" b(i)=n(i)\n", +" end\n", +"\n", +"\n", +"for i=1:length(a)\n", +" c(i)=a(length(a)+1-i)+b(length(a)+1-i)+d\n", +" if(c(i)==1)\n", +" d=0\n", +" end\n", +" if[c(i)==2]\n", +" d=1\n", +" c(i)=0\n", +" end\n", +"end\n", +"\n", +"\n", +"if(d==0)\n", +" for i=1:length(a)\n", +" c(i)=~c(i)\n", +"end\n", +"j=1\n", +"for i=1:length(b)\n", +" m(i)=c(i)+j\n", +" if(m(i)==1)\n", +" f=0\n", +" end\n", +" if(m(i)==2)\n", +" j=1\n", +" m(i)=0\n", +" end\n", +" \n", +" end\n", +" for i=1:length(a)\n", +" c(i)=m(i)\n", +" end\n", +"end\n", +"for i=1:length(a)\n", +" C(i)=c(i)\n", +"end\n", +"printf('result =%d%d%d%d',c(4),c(3),c(2),c(1))" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.8_48a: Prove_the_boolean_thereom.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"disp('Example 8.48a')\n", +"printf('\n')\n", +"disp('Prove the following boolean thereom')\n", +"disp('A+AB=A')\n", +"disp('A=a,B=b,AB=s,A+AB=d')\n", +"a=[0 0 1 1]\n", +"b=[0 1 0 1]\n", +"for i=1:length(a)\n", +" s(i)=a(i)*b(i)\n", +"end\n", +"for i=1:length(a)\n", +" d(i)=s(i)+a(i)\n", +" if(d(i)==2)\n", +" d(i)=1\n", +" end\n", +" \n", +"end\n", +"\n", +"for i=1:length(a)\n", +" if(a(i)==d(i))\n", +" printf('')\n", +" else\n", +" printf('not')\n", +" abort\n", +" end\n", +" \n", +"end\n", +"printf('yes')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.8_48b: Prove_the_boolean_thereom.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"disp('Example 8.48b')\n", +"printf('\n')\n", +"disp('Prove the following boolean thereom')\n", +"disp('A+AB=A')\n", +"disp('A=a,B=b,A1B=s,A+A1B=d')\n", +"a=[0 0 1 1]\n", +"b=[0 1 0 1]\n", +"for i=1:length(a)\n", +" s(i)=(~a(i))*b(i)\n", +"end\n", +"for i=1:length(a)\n", +" d(i)=s(i)+a(i)\n", +" if(d(i)==2)\n", +" d(i)=1\n", +" end\n", +" \n", +"end\n", +"\n", +"for i=1:length(a)\n", +" e(i)=a(i)+b(i)\n", +" if(e(i)==2)\n", +" e(i)=1\n", +" end\n", +"end\n", +"\n", +"for i=1:length(a)\n", +" if((e(i)==d(i)))\n", +" printf('_')\n", +" else\n", +" printf('not')\n", +" abort\n", +" end\n", +" \n", +"end\n", +"printf('yes')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.8_49a: Prove_the_boolean_identities.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"disp('Example 8.49a')\n", +"printf('\n')\n", +"disp('Prove the following boolean identities')\n", +"disp('A+BC=(A+B)(A+C)')\n", +"A=[0 0 0 0 1 1 1 1]\n", +"B=[0 0 1 1 0 0 1 1]\n", +"C=[0 1 0 1 0 1 0 1]\n", +"for i=1:length(A)\n", +" Y(i)=A(i)+(B(i)*C(i))\n", +" if(Y(i)==2)\n", +" Y(i)=1\n", +" end\n", +"end\n", +"for i=1:length(A)\n", +" Z(i)=(A(i)+B(i))*(A(i)+C(i))\n", +" if(Z(i)==2)\n", +" Z(i)=1\n", +" end\n", +" if(Z(i)==3)\n", +" Z(i)=1\n", +" end\n", +" if(Z(i)==4)\n", +" Z(i)=1\n", +" end\n", +"end\n", +"for i=1:length(A)\n", +" if(Z(i)==Y(i))\n", +" printf('_')\n", +" else\n", +" printf('NOT')\n", +" abort\n", +" end\n", +"end\n", +"\n", +" printf('proved')\n", +" \n", +" " + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.8_49b: Prove_the_boolean_identities.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"disp('Example 8.49b')\n", +"printf('\n')\n", +"disp('Prove the following boolean identities')\n", +"disp('ABC+AB1C+ABC1=AB+AC')\n", +"A=[0 0 0 0 1 1 1 1]\n", +"B=[0 0 1 1 0 0 1 1]\n", +"C=[0 1 0 1 0 1 0 1]\n", +"for i=1:length(A)\n", +" Y(i)=(A(i)*B(i)*C(i))+(A(i)*(~B(i))*C(i))+(A(i)*B(i)*(~C(i)))\n", +" if(Y(i)==3)\n", +" Y(i)=1\n", +" end\n", +" if(Y(i)==2)\n", +" Y(i)=1\n", +" end\n", +"end\n", +"for i=1:length(A)\n", +" Z(i)=(A(i)*B(i))+(A(i)*C(i))\n", +" if(Z(i)==2)\n", +" Z(i)=1\n", +" end\n", +"end\n", +"for i=1:length(A)\n", +" if(Z(i)==Y(i))\n", +" printf('_')\n", +" else\n", +" printf('NOT')\n", +" abort\n", +" end\n", +"end\n", +" printf('proved')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.8_50a: Construct_the_Truth_Table_for_logic_expression.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"disp('Example 8.50a')\n", +"printf('\n')\n", +"disp('Construct the Truth Table for logic expression')\n", +"disp('AB1+C1')\n", +"A=[0 0 0 0 1 1 1 1]\n", +"B=[0 0 1 1 0 0 1 1]\n", +"C=[0 1 0 1 0 1 0 1]\n", +"for i=1:length(A)\n", +" f(i)=(A(i)*(~(B(i))))+(~C(i))\n", +" if(f(i)==2)\n", +" f(i)=1\n", +" end\n", +"end\n", +"printf('truth table =%d%d%d%d%d%d%d%d',f(1),f(2),f(3),f(4),f(5),f(6),f(7),f(8))" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.8_50b: Construct_the_Truth_Table_for_logic_expression.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"disp('Example 8.50b')\n", +"printf('\n')\n", +"disp('Construct the Truth Table for logic expression')\n", +"disp('AB1+A1B')\n", +"A=[0 0 1 1]\n", +"B=[0 1 0 1]\n", +"for i=1:length(A)\n", +" f(i)=(A(i)*(~(B(i))))+(B(i)*(~(A(i))))\n", +" if(f(i)==2)\n", +" f(i)=1\n", +" end\n", +"end\n", +"printf('truth table =%d%d%d%d',f(1),f(2),f(3),f(4))" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.8_50c: Construct_the_Truth_Table_for_logic_expression.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"disp('Example 8.50c')\n", +"printf('\n')\n", +"disp('Construct the Truth Table for logic expression')\n", +"disp('C1((B+D)1)')\n", +"B=[0 0 0 0 1 1 1 1]\n", +"C=[0 0 1 1 0 0 1 1]\n", +"D=[0 1 0 1 0 1 0 1]\n", +"for i=1:length(B)\n", +" f(i)=(~(C(i)))*(~(B(i)+D(i)))\n", +" if (f(i)==2)\n", +" f(i)=1\n", +" end\n", +"end\n", +"printf('truth table =%d%d%d%d%d%d%d%d',f(1),f(2),f(3),f(4),f(5),f(6),f(7),f(8))" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.8_7: Convert_the_binary_number_to_decimal_without_decimal_point.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"disp('Example 8.7')\n", +"printf('\n')\n", +"disp('convert the following binary numbers to decimal')\n", +"disp('a)1011 b)110101 c)10101')\n", +"//Given binary number \n", +"bin=1011\n", +"i=1 \n", +"//storing each integer digit in b(i)\n", +"while(bin>0)\n", +" b(i)=modulo(bin,10)\n", +" bin=floor(bin/10)\n", +" i=i+1;\n", +"end\n", +"//checking whether it is a binary number or not\n", +"for i=1:length(b)\n", +" if(b(i)>1) then\n", +" disp('not a binary number')\n", +" abort \n", +" end\n", +" end\n", +"dec=0\n", +"for i=1:length(b)\n", +"//multipliying bits of integer part with their position values and adding \n", +" dec=dec+(b(i)*2^(i-1))\n", +"end\n", +"//displaying the output\n", +"printf('decimal format is')\n", +"disp(dec)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.8_8: Convert_the_binary_number_to_decimal_with_decimal_point.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"disp('Example 8.8')\n", +"printf('\n')\n", +"disp('convert the following binary numbers to decimal')\n", +"disp('a)11.101 b)0.0111 c)110.1101')\n", +"//Given binary number\n", +"i=1;w=1\n", +"bin=11.101\n", +"//separating integer part \n", +"IP=floor(bin)\n", +"IP1=IP\n", +"//separating decimal part\n", +"DP=modulo(bin,1) \n", +"//converting decimal value to interger\n", +"p=4\n", +"DP=DP*10^p //should change power of 10 as according to number of digits in decimal digit\n", +"//storing each integer digit in I(i)\n", +"while(IP>0)\n", +" I(i)=modulo(IP,10);\n", +" IP=floor(IP/10);\n", +" i=i+1;\n", +" end\n", +"//storing each decimal digit in D(w)\n", +"while(DP>0)\n", +" D(w)=modulo(DP,2)\n", +" DP=(DP/10)\n", +" DP=floor(DP)\n", +" w=w+1;\n", +" end\n", +"//to do zero padding of remaining erm of D(w)\n", +"if(length(D)<p)\n", +" q=length(D)\n", +" for f=q+1 :p\n", +" D(f)=0\n", +" end\n", +"end\n", +"if(IP1>0)\n", +"for i=1:length(I)//checking whether it is a binary number or not\n", +" if(I(i)>1) then\n", +" disp('not a binary number')\n", +" abort\n", +" end\n", +" end\n", +"end\n", +"if(IP1>0)\n", +"IP=0\n", +"for i=1:length(I)\n", +"//multipliying bits of integer part with their position values and adding \n", +" IP=IP+(I(i)*2^(i-1))\n", +" end\n", +" end\n", +"DP=0\n", +"for z=1:length(D)\n", +"//multipliying bits of decimal part with their position values and adding \n", +" DP=DP+(D(z)*2^(-1*(length(D)+1-z)))\n", +"end\n", +"decimal=IP+DP\n", +"//displaying the output\n", +"printf('Decimal format is')\n", +"disp(decimal)" + ] + } +], +"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 +} |