{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Chapter 6: Application of Operational Amplifier" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.10: To_determine_the_range_of_the_differential_voltage_gain.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Example6.10 // To determine the range of the differential voltage gain\n", "clc;\n", "clear;\n", "close;\n", "//R1 = 1 K ohm to 25 K ohm ;\n", "R2 = 50 ; // K ohm\n", "R3 = 10 ; // K ohm\n", "R4 = 10 ; // K ohm\n", "\n", "// the output of instrumentation amplifier is given by\n", "//Vo = (R4/R3)*(1+(2*R2/R1))*(VI@-VI1);\n", "\n", "// the differential voltage gain of the instrumentation amplifier can be written as\n", "//Av = (Vo/(VI2-VI1)) = (R4/R3)*(1+(2R2/R1));\n", "\n", "// For R1 = 1 K ohm the maximum differential voltage gain of the instrumentation amplifier is\n", "R1 = 1 ; // K ohm\n", "Av = (R4/R3)*(1+(2*R2/R1));\n", "disp('the maximum differential voltage gain of the instrumentation amplifier is = '+string(Av)+ ' ');\n", "\n", "// For R1 = 25 K ohm the mminimum differential voltage gain of the instrumentation amplifier is\n", "R1 = 25 ; // K ohm\n", "Av = (R4/R3)*(1+(2*R2/R1));\n", "disp('the minimum differential voltage gain of the instrumentation amplifier is = '+string(Av)+ ' ');\n", "\n", "disp(' the range of the differential voltage gain of the instrumentation amplifier is ');\n", "disp(' 5 <= Av <= 101 ');" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.11: To_design_an_instrumentation_amplifier.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Example6.11 // To design an instrumentation amplifier\n", "clc;\n", "clear;\n", "close;\n", "// 4 <= Av <= 1000 ; gain\n", "Ad = 2 ;\n", "Res = 100 ; // K ohm\n", "\n", "// we cosider the variable resistance is R1 , the maximum and the minimum range of variable resistance \n", "// R1min = R1 ; \n", "// R1max = R1+100 ;\n", "\n", "// the gain of difference amplifier \n", "//A3 = Ad = Vo/(Vo2-Vo1) = (R4/R3)\n", "\n", "// the maximum range of differential voltage gain Avmax = 1000 when R1min = R1\n", "//Avmax = R4/R3*(1+(2*R2/R1min));\n", "\n", "// by solvin we get following equation\n", "// 499*R1-2*R2=0 equation 1\n", "\n", "// the maximum range of differential voltage gain Avmin =4 when R1max = R1+100 K ohm\n", "// Avmin = (R4/R3)*(1+(2R2/R1max));\n", "\n", "// by solving above equation we get\n", "// R1 -2 R2 = -200 K ohm equation 2\n", "\n", "//by solving equation 1 and 2 we get\n", "R1 = 401 ; // ohm\n", "R2 = 100.2 ; // ohm\n", "disp('The variable resistance R1 varies is 401 ohm <= R1 <= 100.2 K-ohm ') ;" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.12: Determine_the_time_constant_of_the_integrator.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Example6.12 // Determine the time constant of the integrator\n", "clc;\n", "clear;\n", "close;\n", "Vo = 10 ;\n", "t = 2*10^-3 ;\n", "VI = -1 ; // at t =0 ;\n", "\n", "// The output voltage of an integrator is define as\n", "RC = t/10 ;\n", "disp(' The time constant of the given filter is RC = '+string(RC)+ ' sec ');" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.13: Determine_the_time_constant_of_the_integrator.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Example6.13 // Determine the time constant of the integrator\n", "clc;\n", "clear;\n", "close;\n", "Vo = 20 ;\n", "t = 1*10^-3 ;\n", "VI = -1 ; // at t =0 ;\n", "\n", "// The output voltage of an integrator is define as\n", "RC = t/10 ;\n", "disp(' The time constant of the given filter is RC = '+string(RC)+ ' sec ');\n", "\n", "R = 1*10^3 ; // we assume \n", "C = RC/R ;\n", "disp('The capacitor value is = '+string(C)+ ' F');" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.14: to_design_a_summing_amplifier.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Example6.14 // to design a summing amplifier\n", "clc;\n", "clear;\n", "close;\n", "\n", "// the output of the summing amplifier is given by\n", "//Vo = -R2*((VIa/RIa)+(VIb/RIb)+(VIc/RIc)+(VId/RId)); equation 1\n", "\n", "// the equation given is\n", "//Vo = -(3*VIa+12*VIb+15*VIc+18*VId); equation 2\n", "\n", "// comparing equation 1 and 2\n", "//R2/RIa = 3 ;\n", "//R2/RIb = 12 ;\n", "//R2/RIc = 15 ;\n", "//R2/RId = 18 ; \n", "\n", "// the feedback resistance R2= 270 K ohm \n", "R2 = 270 ; // K ohm\n", "RIa = R2/3 ;\n", "disp('The value of resistance RIa is = '+string(RIa)+ ' K ohm ');\n", "\n", "RIb = R2/12 ;\n", "disp('The value of resistance RIb is = '+string(RIb)+ ' K ohm ');\n", "\n", "RIc = R2/15 ;\n", "disp('The value of resistance RIc is = '+string(RIc)+ ' K ohm ');\n", "\n", "RId = R2/18 ;\n", "disp('The value of resistance RId is = '+string(RId)+ ' K ohm ');" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.15: for_the_instrumentation_amplifier_find_Vo1_Vo2_Vo.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Example6.15 // for the instrumentation amplifier find Vo1 , Vo2 , Vo \n", "clc;\n", "clear;\n", "close;\n", "// Vi1 = -25 sin wt ; // mV\n", "// Vi2 = 25 sin wt ; // mV\n", "R1 = 10*10^3 ;\n", "R2 = 20*10^3 ;\n", "R3 = 20*10^3 ;\n", "R4 = 10*10^3 ;\n", "\n", "// the output of first op-amp A1 is given by\n", "// Vo1 = (1+(R2/R1))*Vi1-(R2/R1)*Vi2 ;\n", "//by solving above equation we get\n", "disp('The output of first op-amp A1 is = -275*sin wt mV ');\n", "\n", "// the output of second op-amp A2 is given by\n", "// Vo2 = (1+(R2/R1))*Vi2-(R2/R1)*Vi1 ;\n", "//by solving above equation we get\n", "disp('The output of second op-amp A2 is = 275*sin wt mV ');\n", "\n", "// the output of third op-amp A3 is given by\n", "// Vo = (R4/R3)-(1+(2R2/R1)*(Vi2-Vi1) ;\n", "//by solving above equation we get\n", "disp('The output of third op-amp A3 is = 825*sin wt mV ');\n", "\n", "// current through the resistor R1 and R2 is\n", "//i = (Vi1-Vi2)/R1 ;\n", "disp('current through the resistor R1 and R2 is = 5 sin wt uA ');\n", "\n", "// current through the non-inverting terminal resistor R3 and R4 \n", "//i3 = Vo2/(R3+R4);\n", "disp('current through the non-inverting terminal resistor R3 and R4 = 5.5 sin wt uA ');\n", "\n", "// current through the inverting terminal resistor R3 and R4 \n", "//i2 = Vo1-(R3/(R3+R4))*Vo2/R3 ;\n", "disp('current through the inverting terminal resistor R3 and R4 = 22 sin wt uA ');" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.16: for_the_a_current_to_voltage_converter.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Example6.16 // for the a current to voltage converter show a) Rin = (Rf/1+Aop) b) Rf = 10 K ohm Aop = 1000 \n", "clc;\n", "clear;\n", "close;\n", "\n", "//a) The input resistance given as\n", "//Rin = (Rf)/(1+Aop) ;\n", "\n", "// The input resistance of the circuit can be written as\n", "//Rin = (V1/i!);\n", "\n", "// the feedback current of the given circuit is defined as\n", "//i1 =(V1-Vo)/RF ;\n", "\n", "// the feedback resistance RF is \n", "//RF =(V1-Vo)/i1 ;\n", "\n", "// The output voltage Vo is\n", "//Vo = -Aop*V1 ;\n", "\n", "//by using this output feedback currenty i1 can be reformed as\n", "//i1 = (V1-(-Aop*V1))/RF ;\n", "\n", "//i1 = V1*(1+Aop)/RF ;\n", "\n", "// Then Rin Becomes \n", "//Rin =Rf/(1+Aop);\n", "\n", "Rf =10*10^3 ;\n", "Aop = 1000 ;\n", "\n", "// the input current and output voltage of the circuit are defined as\n", "//i1 =(Rs)/(Rs+Rin) ;\n", "// Vo = -(Aop*(RF/1+Aop))*i1 ;\n", "\n", "//the input resistance Rin is \n", "Rin =(Rf/(1+Aop)) ;\n", "\n", "// subsituting the value of RF Aop Rin and Vo we get \n", "RF = 10 ;\n", "Rin = RF/(1+Aop)\n", "disp('The input resistance Rin is = '+string(Rin)+ ' ohm ');\n", "\n", "Aop = 1000 ;\n", "//(1000/1001)*(Rs/(Rs*0.00999))> 0.99 ;\n", "// by solving above equation we get \n", "Rs = 1.099 ; // K ohm \n", "disp(' The value of Resistance Rs is = '+string(Rs)+ ' K ohm ');" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.17: determine_the_closed_loop_gain.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Example6.17 // determine the closed loop gain\n", "clc;\n", "clear;\n", "close;\n", "\n", "// the output of the voltage follower is given as\n", "//Vo = Aop(V1-Vo);\n", "\n", "// the closed loop gain of the voltage follower \n", "//A = 1/(1+(1/Aop));\n", " \n", "// for Aop = 10^4 closed loop gain\n", "Aop = 10^4 ;\n", "A = 1/(1+(1/Aop));\n", "disp('for Aop = 10^4 closed loop gain is = '+string(A)+ ' ');\n", "\n", "// for Aop = 10^3 closed loop gain\n", "Aop = 10^3 ;\n", "A = 1/(1+(1/Aop));\n", "disp('for Aop = 10^3 closed loop gain is = '+string(A)+ ' ');\n", "\n", "// for Aop = 10^2 closed loop gain\n", "Aop = 10^2 ;\n", "A = 1/(1+(1/Aop));\n", "disp('for Aop = 10^2 closed loop gain is = '+string(A)+ ' ');\n", "\n", "// for Aop = 10^1 closed loop gain\n", "Aop = 10^1 ;\n", "A = 1/(1+(1/Aop));\n", "disp('for Aop = 10^1 closed loop gain is = '+string(A)+ ' ');" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.18: To_determine_the_output_voltage_of_integrator.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Example6.18 // To determine the output voltage of integrator\n", "clc;\n", "clear;\n", "close;\n", "Vin = 1 ;\n", "R = 150*10^3 ;// ohm\n", "C = 1*10^-9 ; // F\n", "\n", "// the output voltage of an integrator is given as\n", "//Vo = (fc/f)*Vin ;\n", "\n", "//fc = 1/(2*%pi*R*C);\n", "\n", "//Vo = (1/(2*%pi*R*C*f))*Vin;\n", "\n", "//for the frequency f = 10 Hz the output is\n", "f = 10 ; // Hz\n", "Vo = (1/(2*%pi*R*C*f))*Vin;\n", "disp('for the frequency f = 10 Hz the output is = '+string(Vo)+ ' V ');\n", "\n", "//for the frequency f = 1000 Hz the output is\n", "f = 1000 ; // Hz\n", "Vo = (1/(2*%pi*R*C*f))*Vin;\n", "disp('for the frequency f = 1000 Hz the output is = '+string(Vo)+ ' V ');\n", "\n", "//for the frequency f = 10000 Hz the output is\n", "f = 10000 ; // Hz\n", "Vo = (1/(2*%pi*R*C*f))*Vin;\n", "disp('for the frequency f = 10000 Hz the output is = '+string(Vo)+ ' V ');\n", "" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.19: To_determine_the_magnitude_gain_of_the_integrator.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Example6.19 // To determine the magnitude gain of the integrator\n", "clc;\n", "clear;\n", "close;\n", "Vin = 1 ;\n", "f = 50*10^3 ;\n", "Rf = 120*10^3 ;\n", "R = 10*10^3 ;\n", "C = 0.1*10^-9 ;\n", "\n", "// the magnitude gain of the integrator is given by\n", "//A = (Rf/R)/(sqrt(1+(f/fc)^2));\n", "\n", "// the cutoff frequency of the integrator \n", "fc = 1/(2*%pi*Rf*C);\n", "disp('The cutoff frequency of the integrator is = '+string(fc)+ ' Hz');\n", "\n", "\n", "A = (Rf/R)/(sqrt(1+(f/fc)^2));\n", "disp('The gain of the integrator is = '+string(A)+ ' ');" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.1: design_an_inverting_amplifier_with_a_closed_loop_voltage_gain_is_given.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Example6.1 // design an inverting amplifier with a closed loop voltage gain of Av = -5\n", "clc;\n", "clear;\n", "close;\n", "Av = -5 ;\n", "Is = 5*10^-6 ; // A\n", "Rs = 1*10^3 ; // ohm\n", "// input voltage source Vs = sinwt volts\n", "\n", "// in an inverting amplifier frequency effect is neglected then i/p volt Vin = 1 V and total resistance equal to Rs+R1\n", "\n", "// the input current can be written as Iin=Is\n", "// Is = (Vin/Rs+R1);\n", "Iin = Is;\n", "Vin = 1 ; // V\n", "R1 = (1-(Iin*Rs))/Iin ;\n", "disp('the value of resistance R1 is = '+string(R1)+' ohm');\n", "\n", "// closed loop voltage gain of an inverting amplifier\n", "//Av = -(R2/Rs+R1)\n", "R2 = -(Av*(Rs+R1));\n", "disp('the value of resistance R2 is = '+string(R2)+' ohm');" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.20: To_determine_the_magnitude_gain_of_the_differentiator.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Example6.20 // To determine the magnitude gain of the differentiator\n", "clc;\n", "clear;\n", "close;\n", "Vin = 1 ;\n", "f = 50*10^3 ;\n", "R = 75*10^3 ;\n", "R1 = 50*10^3 ;\n", "C = 0.1*10^-9 ;\n", "\n", "// the magnitude gain of the differentiator is given by\n", "//A = (f/fa)/(sqrt(1+(f/fb)^2));\n", "\n", "// the break frequency fa is defined as\n", "fa = 1/(2*%pi*R1*C) ;\n", "disp('the break frequency fa is = '+string(fa)+ ' Hz ');\n", "\n", "// the break frequency fb is defined as\n", "fb = 1/(2*%pi*R*C) ;\n", "disp('the break frequency fb is = '+string(fb)+ ' Hz ');\n", "\n", "\n", "A = (f/fa)/(sqrt(1+(f/fb)^2));\n", "disp('The gain of the differentiator is = '+string(A)+ ' ');\n", "" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.21: to_determine_the_input_voltage_of_an_op_amp.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "// Example6.21 // to determine the input voltage of an op-amp\n", "clc;\n", "clear;\n", "close;\n", "Vo = 2 ; // V\n", "R1 = 20*10^3 ; // ohm\n", "R2 = 1*10^6 ; // ohm\n", "\n", "// the input voltage of an op-amp\n", "Vin = -(R1/R2)*Vo ;\n", "disp('The input voltage of an op-amp is = '+string(Vin)+ ' V');" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.22: To_determine_the_output_voltage.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Example6.22 // To determine the output voltage\n", "clc;\n", "clear;\n", "close;\n", "Vin = 2 ;\n", "R2 = 20*10^3 ;\n", "R1 = 2*10^3 ;\n", "\n", "// the output voltage of follower Vo1 is\n", "Vo1 = Vin ;\n", "disp('the output voltage of follower Vo1 is = '+string(Vo1)+ ' V');\n", "// the output voltage of an inverting amplifier\n", "Vo = -(R2/R1)*Vo1 ;\n", "disp('The output voltage of an inverting amplifier is = '+string(Vo)+ ' V ');\n", "" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.23: to_determine_the_output_voltage_of_an_op_amp.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "// Example6.23 // to determine the output voltage of an op-amp\n", "clc;\n", "clear;\n", "close;\n", "Vin = 5 ; // V\n", "R1 = 25*10^3 ; // ohm\n", "R2 = 75*10^3 ; // ohm\n", "\n", "// in this problem op-amp A1 perform the voltage follower and op-amp A2 perform inverting amplifier and op-amp A3 perform non-inverting amplifier\n", "\n", "// the output voltage of follower op-amp A1\n", "Vo1 = Vin ;\n", "\n", "// the output of the inverting amplifier A2\n", "Vo2 = -((R2/R1)*Vo1) ;\n", "disp('The output of the inverting amplifier is = '+string(Vo2)+ ' V');\n", "\n", "// the output of the non-inverting amplifier A3\n", "Vo =(1+(R2/R1))*Vo1 ;\n", "disp('The output of the non-inverting amplifier is = '+string(Vo)+ ' V');" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.24: To_determine_the_output_voltage.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Example6.24 // To determine the output voltage\n", "clc;\n", "clear;\n", "close;\n", "Vin = 2.5 ;\n", "Rf = 100*10^3 ;\n", "R1 = 10*10^3 ;\n", "RI1 = 25*10^3 ;\n", "RI2 = 10*10^3 ;\n", "R2 = 100*10^3 ;\n", "\n", "// the output voltage of an inverting amplifier\n", "Vo1 = (1+(R2/R1))*Vin ; ;\n", "disp('The output voltage of an inverting amplifier is = '+string(Vo1)+ ' V ');\n", "\n", "// the output voltage of follower Vo2 is\n", "Vo2 = Vin ;\n", "disp('the output voltage of follower Vo1 is = '+string(Vo2)+ ' V');\n", "\n", "// the output of the inverting summing amplifier\n", "R2 = 75*10^3 ;\n", "Vo = R2*((Vo1/RI1)+(Vo2/RI2));\n", "disp('the output of the inverting summing amplifier is = '+string(Vo)+ ' V ');\n", "\n", "" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.25: To_calculate_the_output_voltage.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Example6.25 // To calculate the output voltage\n", "clc;\n", "clear;\n", "close;\n", "Vin = 2.5 ; \n", "R1 = 10*10^3 ;\n", "R2 = 10*10^3 ;\n", "R3 = 10*10^3 ;\n", "Rf = 30*10^3 ;\n", "\n", "// the total gain of the circuit \n", "//Av =A1v*A2v*A3v ;\n", "Av = (1+(Rf/R1))*(-Rf/R2)*(-Rf/R3);\n", "disp('the total gain of the circuit is = '+string(Av)+ ' ');\n", "\n", "// The output voltage of the op-amp \n", "Vo = Av*Vin ;\n", "disp('The output voltage of the op-amp is = '+string(Vo)+ ' V');" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.26: to_calculate_the_output_voltage_of_op_amp_circuit.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "\n", "//Example6.26 // to calculate the output voltage of op-amp circuit\n", "clc;\n", "clear;\n", "close;\n", "Rf = 100*10^3 ; // ohm\n", "R1 = 10*10^3 ; // ohm\n", "R2 = 25*10^3 ; // ohm\n", "R3 = 50*10^3 ; // ohm\n", "\n", "// the output of op-amp A1 is\n", "// VA1 = (-Rf/R1)*V1 ;\n", "VA1 = (-Rf/R1);\n", "disp('The output of op-amp A1 is = '+string(VA1)+'V1' ); // *V1 because the output is come from 1 op-amp\n", "\n", "// the output of op-amp A2 is\n", "// Vo = -Rf*((VA1/R2)+(V2/R3));\n", "//Vo = -100*(-0.4*V1+0.02V2);\n", "disp('The output of op-amp A2 is Vo = 40V1 - 2V2 '); \n", "\n", "disp('The output is equal to the difference between 40V1 and 2V2 '); " ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.27: to_determine_the_hysteresis_width_of_a_schmitt_trigger.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Example6.27 // to determine the hysteresis width of a schmitt trigger\n", "clc;\n", "clear;\n", "close;\n", "R1 = 25*10^3 ; // ohm\n", "R2 = 75*10^3 ; // ohm\n", "VTH = 4 ; // V\n", "VTL = -4 ; // V\n", "\n", "// the upper crossover voltage of schmitt trigger is defined as\n", "VU = (R1/(R1+R2))*VTH;\n", "disp('the upper crossover voltage of schmitt trigger is = '+string(VU)+' V' );\n", "\n", "// the lower crossover voltage of schmitt trigger is defined as\n", "VL = (R1/(R1+R2))*VTL;\n", "disp('the lower crossover voltage of schmitt trigger is = '+string(VL)+' V' );\n", "\n", "// the hysteresis width of schmitt trigger is\n", "HW = VU-VL ;\n", "disp('the hysteresis width HW of schmitt trigger is = '+string(HW)+' V' );" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.28: to_determine_the_hysteresis_width_of_a_schmitt_trigger.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Example6.28 // to determine the hysteresis width of a schmitt trigger\n", "clc;\n", "clear;\n", "close;\n", "R1 = 15*10^3 ; // ohm\n", "R2 = 90*10^3 ; // ohm\n", "VTH = 10 ; // V\n", "VTL = -10 ; // V\n", "\n", "// the upper crossover voltage of schmitt trigger is defined as\n", "VU = (R1/(R1+R2))*VTH;\n", "disp('the upper crossover voltage of schmitt trigger is = '+string(VU)+' V' );\n", "\n", "// the lower crossover voltage of schmitt trigger is defined as\n", "VL = (R1/(R1+R2))*VTL;\n", "disp('the lower crossover voltage of schmitt trigger is = '+string(VL)+' V' );\n", "\n", "// the hysteresis width of schmitt trigger is\n", "HW = VU-VL ;\n", "disp('the hysteresis width HW of schmitt trigger is = '+string(HW)+' V' );" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.29: EX6_29.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Example6.29 // to determine the resistance R1 when low and high saturated output states are given\n", "clc;\n", "clear;\n", "close;\n", "R2 = 20*10^3 ; // ohm\n", "VH = 2 ; // V crossover voltage\n", "VL = -2 ; // V crossover voltage\n", "VOH = 10 ; // V saturated output states\n", "VOL = -10 ; // V saturated output states\n", "\n", "// the upper crossover voltage of schmitt trigger is defined as\n", "// V = (R1/(R1+R2))*VOH;\n", "// solving above equation we get \n", "// 2R1+2R2 = 10R1 ;\n", "R1 = (2*R2)/8 ;\n", "disp('the value of resistance R1 is = '+string(R1)+' ohm' );" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.2: design_an_inverting_amplifier_with_a_closed_loop_voltager_gain_is_given.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Example6.2 // design an inverting amplifier with a closed loop voltage gain of Av = 10\n", "clc;\n", "clear;\n", "close;\n", "Av = 10 ;\n", "Vin = 0.8 ; //V\n", "Iin = 100*10^-6 ; // A\n", "// in an non- inverting amplifier the input voltage Vin=V1=V2 because of vortual short effect then the i/p current In = Vin/R1\n", "R1 = Vin/Iin;\n", "disp('the value of resistance R1 is = '+string(R1)+' ohm');\n", "\n", "// closed loop voltage gain of an non-inverting amplifier\n", "//Av = Vo/Vin = (1+R2/R1)\n", "R2 = (Av-1)*R1;\n", "disp('the value of resistance R2 is = '+string(R2)+' ohm');" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.30: EX6_30.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Example6.30 // to determine the value of resistance R1 and R2 when low and high saturated output states are given\n", "clc;\n", "clear;\n", "close;\n", "VH = 3 ; // V crossover voltage\n", "VL = -3 ; // V crossover voltage\n", "VOH = 12 ; // V saturated output states\n", "VOL = -12 ; // V saturated output states\n", "\n", "// the upper crossover voltage of schmitt trigger is defined as\n", "// V = (R1/(R1+R2))*VOH;\n", "// solving above equation we get \n", "// 3R1+3R2 = 12R1 ;\n", "\n", "// 3*R1 = R2 ;\n", "R1 = 10*10^3 ; // ohm we assume\n", "R2 = 3*R1 ;\n", "disp('the value of resistance R2 is = '+string(R2)+' ohm' );" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.31: Design_an_inverting_amplifier.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Example6_31 // Design an inverting amplifier\n", "clc;\n", "clear;\n", "close;\n", "Av = -5 ;\n", "//V1 = 0.1 sin wt ;\n", "V1 = 0.1 ; // *sin wt ;\n", "i = 5*10^-6 ;\n", "\n", "// the input resistance \n", "R1 = V1/i ;\n", "disp('the input resistance is = '+string(R1)+ ' ohm');\n", "\n", "// The resistance R2\n", "//Av = -(R2/R1);\n", "R2 = -(Av*R1);\n", "disp('The resistance R2 is = '+string(R2)+ ' ohm');\n", "" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.32: Design_an_non_inverting_amplifier.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Example 6_32 // Design an non inverting amplifier\n", "clc;\n", "clear;\n", "close;\n", "Av = 5 ;\n", "//V1 = 0.1 sin wt ;\n", "V1 = 0.1 ;\n", "i = -5*10^-6 ;\n", "\n", "// the input resistance \n", "R1 = -V1/i ;\n", "disp('the input resistance is = '+string(R1)+ ' ohm');\n", "\n", "// The resistance R2\n", "//Av = 1+(R2/R1);\n", "R2 = (Av-1)*R1;\n", "disp('The resistance R2 is = '+string(R2)+ ' ohm');\n", "\n", "" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.33: To_calculate_phase_shift_between_two_extremes.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Example6_33 // To calculate phase shift between two extremes \n", "clc;\n", "clear;\n", "close;\n", "C = 0.22*10^-6 ;\n", "R = 1*10^3 ;\n", "f = 1*10^3 ;\n", "\n", "// the cut off frequency of phase shifter \n", "fc = 1/(2*%pi*R*C) ;\n", "disp('the cut off frequency of phase shifter is = ' +string(fc)+ 'Hz');\n", "\n", "// the phase shift\n", "f = 1 ; // KHz\n", "fc = 7.23 ; // KHz \n", "PS = -2*atand(f/fc);\n", "disp('The phase shift is = '+string(PS)+ ' ');" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.34: To_design_a_phase_shifter.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Example6_34 // To design a phase shifter\n", "clc;\n", "clear;\n", "close;\n", "f = 2*10^3 ;\n", "PS = -135 ;\n", "// the phase shift\n", "// PS = -2*atand(2*%pi*R*C);\n", "//RC = 192.1*10^-6 ;\n", "C = 0.1*10^-6 ;\n", "R = (192.1*10^-6)/C\n", "disp('The value of resistance is = '+string(R)+ ' ohm');\n", "" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.35: Design_a_difference_amplifier.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Example6_35 // Design a difference amplifier\n", "clc;\n", "clear;\n", "close;\n", "Ri = 50*10^3 ;\n", "Ad = 30 \n", "\n", "R1 = Ri/2 ;\n", "disp('The value of resistance R1 is = '+string(R1)+ ' ohm');\n", "R3 = R1 ;\n", "disp('The value of resistance R3 is = '+string(R3)+ ' ohm');\n", "\n", "// the differential gain\n", "//Ad = R2/R1 ;\n", "R2 = 30*R1 ;\n", "disp('The value of resistance R2 is = '+string(R2)+ ' ohm');\n", "\n", "R4 = R2 ;\n", "disp('The value of resistance R4 is = '+string(R4)+ ' ohm'); " ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.36: Calculate_CMRR_ratio.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Example6_36 // Calculate CMRR ratio\n", "clc;\n", "clear;\n", "close;\n", "Ad = 10.24 ;\n", "Acm = 0.48 ;\n", "\n", "// the common mode rejection ratio CMRR is defined as\n", "CMRRdB = 20*log10(Ad/Acm);\n", "disp('THe common mode rejection ratio is = '+string(CMRRdB)+ ' dB' );" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.37: Design_current_to_voltage_converter.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Example6_37 // Design current to voltage converter\n", "clc;\n", "clear;\n", "close;\n", "Vo =-10 ;\n", "is = 100*10^-6 ;\n", "\n", "// the output voltage of current to voltage converter is defined as\n", "//Vo =-1s*R2 \n", "R2 = -Vo/is ;\n", "disp(' The feedback resistance is = '+string(R2)+ ' ohm');\n", "\n", "R1 = R2 ;\n", "disp(' The value of resistance R1 is = '+string(R1)+ ' ohm');" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.38: Design_high_sensitivity_current_to_voltage_converter.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Example6_38 // Design high sensitivity current to voltage converter\n", "clc;\n", "clear;\n", "close;\n", "R1 = 5*10^3 ;\n", "is = 1 ;\n", "KR = 0.01/10^9 ; // V / nA\n", "\n", "// the output voltage of high sensitivity current to voltage converter\n", "Vo =-KR*is ;\n", "KR = 10*10^6 ;\n", "R = 1*10^6 ; //we assume then\n", "K = 10 ;\n", "//1 + (R2/R1)+(R2/R) = 10 ;\n", "// solving above equation we get\n", "\n", "R2 = 9*((5*10^6)/(10^3+5)) ;\n", "disp ('The value of resistance R2 is = '+string(R2)+ ' ohm'); " ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.39: Determine_a_load_current_in_a_V_to_I_converter.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Example6_39 // Determine a load current in a V to I converter\n", "clc;\n", "clear;\n", "close;\n", "R1 = 10*10^3 ;\n", "R2 = 10*10^3 ;\n", "R3 = 1*10^3 ;\n", "R4 = 1*10^3 ;\n", "VI = -5 ;\n", "\n", "// The Load Current\n", "iL = -VI/R3 ;\n", "disp('The load current iL is = '+string(iL)+ ' A');\n", "\n", "VL = 0.5 ;\n", "// The Current i3 and iA\n", "i3 = VL/R3 ;\n", "disp('The current i3 is = '+string(i3)+ ' A');\n", "\n", "iA = i3+iL ;\n", "disp('The current iA is = '+string(iA)+ ' A');\n", "\n", "// the output voltage \n", "Vo = (iA*R3)+VL ;\n", "disp('The output voltage is = '+string(Vo)+ ' V');\n", "\n", "ZL =100 ;\n", "// The current i1 and i2 \n", "//i1 = (VI-iL*ZL)/R1 ;\n", "i1 = (iL*ZL-Vo)/R2 ;\n", "disp('The current i1 is = '+string(i1)+ ' A');\n", "\n", "i2 = i1 ;\n", "disp('The current i2 is = '+string(i2)+ ' A');" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.3: design_an_non_inverting_amplifier_with_colsed_loop_gain_of_5.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Example6.3 // design an non-inverting amplifier with colsed loop gain of 5 limited voltage of -5 V <= Vo <= 5 V and maximum i/p c/n 50 uA\n", "clc;\n", "clear;\n", "close;\n", "R1 = 8*10^3 ; // ohm\n", "R2 = 72*10^3 ; // ohm\n", "Iin = 50*10^-6 ; // A\n", "Vo = 5 ; // V \n", "\n", "// closed loop gain\n", "//Av = Vo/Vin = (1+R2/R1)\n", "Av = 1+(R2/R1);\n", "// but \n", "Av = 5 ;\n", "// then\n", "// (R2/R1) = 4 ;\n", "\n", "// the output voltage of the amplifier is Vo = 5 V \n", "//i.e\n", "Vin = 1 ; // V\n", "// Iin = Vin/R1 ;\n", "R1 = Vin/Iin ;\n", "disp('the value of resistance R1 is = '+string(R1)+' ohm');\n", "\n", "R2 = 4*R1 ;\n", "disp('the value of resistance R2 is = '+string(R2)+' ohm');\n", "\n", "// the output current I2 is given as\n", "I2 = (Vo-Vin)/R2 ;\n", "disp('the output current I2 is = '+string(I2)+' A');" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.40: Design_an_instrumentation_amplifier.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Example6_40 // Design an instrumentation amplifier\n", "clc;\n", "clear;\n", "close;\n", "//A = 5 to 500 ; adjustable gain\n", "VR = 100*10^3 ;\n", "\n", "// the maximum differential gain of instrumentation amplifier is 500 \n", "//Amax = (R4/R3)*(1+(2R2/R1));\n", "//by solving above equation we get following equation\n", "// 2R2 -249R1f = 0 equation 1\n", "\n", "// the minimum differential gain of instrumentation amplifier is 5\n", "// Amin = (R4/R3)*(1+(2R2/R1)) ;\n", "//by solving above equation we get following equation\n", "// 2R2 -1.5R1f = 150*10^3 equation 2\n", "\n", "//by solving equation 1 and 2 we get\n", "disp('The value of resistance R1f is = 0.0606 K ohm ');\n", "\n", "disp('The value of resistance R2 is = 75.5 K ohm ');\n", "" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.41: To_find_the_value_of_resistance_R1_for_instrumentation_amplifier.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Example6_41 // To find the value of resistance R1 for instrumentation amplifier\n", "clc;\n", "clear;\n", "close;\n", "A =100 ;\n", "R2 = 450*10^3 ;\n", "R3 = 1*10^3 ;\n", "R4 = 1*10^3 ;\n", "\n", "// The gain of differential amplifier \n", "// A = (R4/R3)*(1+(2R2/R1)) ;\n", "//but R3 = R4 then\n", "// A = 1+(2R2/R1) ;\n", "R1 = 2*R2/(A-1);\n", "disp('The value of resistane R1 is = '+string(R1)+ ' ohm'); " ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.42: determine_the_time_constant_of_an_integrator.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Example6_42 // determine the time constant of an integrator\n", "clc;\n", "clear;\n", "close;\n", "Vo = 10 ; // at t= 1 m sec\n", "t = 1 ; // m sec\n", "\n", "// the output of integrator \n", "//Vo = t/RC ; when t is from 0 to 1\n", "RC = t/Vo ;\n", "disp(' At t = 1 msec the time constant RC is = '+string(RC)+ ' m sec');\n", "\n", "disp (' if C = 0.01 uF then R of RC time constant is = 10 K ohm ');\n", "\n", "disp (' if C = 0.001 uF then R of RC time constant is = 100 K ohm ');" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.43: Design_an_integrator_circuit.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Example6_43 // Design an integrator circuit\n", "clc;\n", "clear;\n", "close;\n", "A = 10 ;\n", "f =20*10^3 ;\n", "R = 10*10^3 ; // we assume \n", "Rf =10*R ;\n", "\n", "disp(' THe feedback resistance Rf is = '+string(Rf)+ ' ohm');\n", "\n", "// for proper integration f>= 10fa \n", "fa = f/10 ;\n", "disp('The frequency fa is = '+string(fa)+ ' Hz');\n", "\n", "// in practical integrator\n", "//fa = 1/(2*%pi*Rf*C);\n", "\n", "C = 1/(2*%pi*Rf*fa);\n", "disp(' The value of capacitor C is = '+string(C)+ ' F ');" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.4: Design_a_op_amp_circuit_to_provide_the_output_voltage_is_given.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "// Example6.4 // Design a op-amp circuit to provide the output voltage Vo = -2(3 V1 +4 V2 +2 V3)\n", "clc;\n", "clear;\n", "close;\n", "// Vo = -2(3 V1 + 4 V2+ 2 V3); equation 1\n", "// the output of the summer circuit is given as\n", "// Vo = -R2((Via/Ria)+(Vib/Rib)+(Vic/Ric)) equation 2\n", "\n", "// compare equation 1 and 2 of Vo we get \n", "\n", "// (R2/Ria)= 6 ;\n", "// (R2/Rbi=8 ;\n", "// (R2/Ric)=4 ;\n", "\n", "R2 = 120*10^3 ; // we choose then \n", "\n", "Ria = R2/6 ;\n", "disp('the value of resistance Ria is = '+string(Ria)+' ohm');\n", "\n", "Rib = R2/8 ;\n", "disp('the value of resistance Rib is = '+string(Rib)+' ohm');\n", "\n", "Ric = R2/4 ;\n", "disp('the value of resistance Ric is = '+string(Ric)+' ohm');" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.5: Design_a_summing_amplifier_circuit.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "// Example6.5 // Design a summing amplifier circuit to provide the output voltage Vo = -(7 V11 + 15 V12 + 10 V13 + 3 V14)\n", "clc;\n", "clear;\n", "close;\n", "R2 = 630*10^3 ; // Assume feedback resistance\n", "// Vo = -(7 V11 + 15 V12 + 10 V13 + 3 V14); equation 1\n", "// the output of the summer circuit is given as\n", "// Vo = -R2((Via/Ria)+(Vib/Rib)+(Vic/Ric)+(Vid/Rid)) equation 2\n", "\n", "// compare equation 1 and 2 of Vo we get \n", "\n", "// (R2/Ria)= 7 ;\n", "// (R2/Rbi= 15 ;\n", "// (R2/Ric)= 10 ;\n", "// (R2/Rid)= 3 ;\n", "\n", "Ria = R2/7 ;\n", "disp('the value of resistance Ria is = '+string(Ria)+' ohm');\n", "\n", "Rib = R2/15 ;\n", "disp('the value of resistance Rib is = '+string(Rib)+' ohm');\n", "\n", "Ric = R2/10 ;\n", "disp('the value of resistance Ric is = '+string(Ric)+' ohm');\n", "\n", "Rid = R2/3 ;\n", "disp('the value of resistance Rid is = '+string(Rid)+' ohm');" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.6: Design_a_op_amp_circuit_to_provide_the_given_output_voltage.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "// Example6.6 // Design a op-amp circuit to provide the output voltage Vo = V2 - 3 V1 with Ri1 =Ri2 = 100*10^3\n", "clc;\n", "clear;\n", "close;\n", "Ri1 = 100*10^3 ; // ohm\n", "Ri2 = 100*10^3 ; // ohm\n", "// the i/p resistance \n", "R1 = Ri1 ;\n", "R3 = Ri2 ;\n", "\n", "// Vo = V2 - 3 V1; equation 1\n", "// the output of the summer circuit is given as\n", "// Vo = [(R4/(R3+R4)*(1+(R2/R1))*Vi2-(R2/R1)*Vi1] equation 2\n", "\n", "// compare equation 1 and 2 of Vo we get \n", "// (R4/(R3+R4)*(1+(R2/R1)) = 1 ; equation 3\n", "// R2/R1 = 3 ; equation 4\n", "\n", "// by subsituting the value of R1 and R3 in equation 3 and 4\n", "\n", "// from equation 4\n", "R2 = 3*R1 ;\n", "disp('the value of resistance R2 is = '+string(R2)+' ohm');\n", "\n", "// from equation 3\n", "R4 = (100*10^3)/3 ;\n", "disp('the value of resistance R4 is = '+string(R4)+' ohm');\n", "\n", "" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.7: determine_the_load_current_and_output_voltage.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Example6.7 // determine the load current and output voltage\n", "clc;\n", "clear;\n", "close;\n", "Vin = -5 ; // V\n", "ZL = 200 ; // ohm\n", "R1 = 10*10^3 ; // ohm\n", "R2 = 10*10^3 ; // ohm\n", "R3 = 1*10^3 ; // ohm\n", "R4 = 1*10^3 ; // ohm\n", "\n", "// the load c/n of the given voltage to c/n converter circuit is given by\n", "iL =-Vin/(R1*R4)*R2 ;\n", "disp('The load current iL is = '+string(iL)+' A');\n", "\n", "// the voltage across the load \n", "VL = iL*ZL;\n", "disp('The voltage across load VL is = '+string(VL)+' V');\n", "\n", "// the non-inverting current across i3 and i4 are\n", "i3 = VL/R3 ;\n", "disp('The non-inverting current across i3 is = '+string(i3)+' A');\n", "\n", "i4 = iL+i3 ;\n", "disp('The non-inverting current across i4 is = '+string(i4)+' A');\n", "\n", "// the output voltage of given voltage to current converter is given by\n", "Vo = (iL*R3)+VL ;\n", "disp('The output voltage of given voltage to current converter is = '+string(Vo)+' V');" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.8: determine_the_common_mode_rejection_ratio_CMRR.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "// Example6.8 // determine the common mode rejection ratio CMRR\n", "clc;\n", "clear;\n", "close;\n", "// R2/R1 = 10 ;\n", "// R4/R3 = 11 ;\n", "\n", "// the output of the difference amplifier is given by\n", "// Vo = (((R4)/(R3+R4))*(((1+(R2/R1))*VI2))-((R2/R1)*VI1));\n", "\n", "// putting R1 R2 R3 R4 value in above equation we get Vo as\n", "\n", "// Vo =(121/12)*VI2-10VI1 ; equation 1\n", "\n", "// the differential mode input of difference amplifier is given by\n", "// Vd = VI2-VI1 ; eqution 2\n", "\n", "// the common mode input of difference amplifier is given by\n", "// VCM = (VI2+VI1)/2 ; equation 3\n", "\n", "// from equation 2 and 3 \n", "\n", "// VI1 = VCM-Vd/2 ; equation 4\n", "\n", "// VI2 = VCM+Vd/2 ; equation 5\n", "\n", "// substitute equation 4 and 5 in 1 we get \n", "// Vo = (VCM/12)+(241Vd/24); equation6\n", "\n", "// Vd = Ad*Vd+ACM*VCM ; equation 7\n", "\n", "//equation from equation 6 and 7 we get\n", "\n", "Ad = 241/24 ;\n", "ACM = 1/12 ;\n", "\n", "// the common mode rejection ratio CMRR is \n", "CMRR = abs(Ad/ACM);\n", "disp('The common mode rejection ratio CMRR is = '+string(CMRR)+' ');\n", "\n", "// in decibal it can be expressed as\n", "\n", "CMRR = 20*log10(CMRR);\n", "disp('The common mode rejection ratio CMRR in decibel is = '+string(CMRR)+' dB ');" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.9: determine_output_voltage_for_different_condition_of_input_voltage.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "// Example6.9 // determine Vo when 1) VI1 = 2 V VI2 = -2 V and 2) VI1 = 2 V VI2 = 2 V\n", "// and common mode rejection ratio CMRR\n", "clc;\n", "clear;\n", "close;\n", "R1 = 10*10^3 ; // ohm\n", "R2 = 20*10^3 ; // ohm\n", "R3 = 10*10^3 ; // ohm\n", "R4 = 22*10^3 ; // ohm\n", "\n", "\n", "// the output of the difference amplifier is given by\n", "// Vo = (((R4)/(R3+R4))*(((1+(R2/R1))*VI2))-((R2/R1)*VI1));\n", "\n", "// Case 1 when VI1 = 2 V VI2 = -2 V\n", "VI1 = 2 ;\n", "VI2 = -2 ;\n", "\n", "Vo = (((R4)/(R3+R4))*(((1+(R2/R1))*VI2))-((R2/R1)*VI1));\n", "disp('The output of the difference amplifier is = '+string(Vo)+' V ');\n", "\n", "// case 2 when VI1 = 2 V VI2 = 2 V\n", "VI1 = 2 ;\n", "VI2 = 2 ;\n", "\n", "Vo = (((R4)/(R3+R4))*(((1+(R2/R1))*VI2))-((R2/R1)*VI1));\n", "disp('The output of the difference amplifier is = '+string(Vo)+' V ');\n", "\n", "// the common mode input of difference amplifier is given by\n", "VCM = (VI2+VI1)/2 ;\n", "disp('the common mode input of difference amplifier is = '+string(VCM)+' ');\n", "\n", "// the common mode gain ACM of difference amplifier is given by\n", "ACM = Vo/VCM\n", "disp('the common mode gain ACM of difference amplifier is = '+string(ACM)+' ');\n", "\n", "// the differential gain of the difference amplifier is given \n", "Ad = R2/R1 ; \n", "disp('the differential gain of the difference amplifier is = '+string(Ad)+' ');\n", "\n", "// the common mode rejection ratio CMRR is \n", "CMRR = abs(Ad/ACM);\n", "disp('The common mode rejection ratio CMRR is = '+string(CMRR)+' ');\n", "\n", "// in decibal it can be expressed as\n", "CMRR = 20*log10(CMRR);\n", "disp('The common mode rejection ratio CMRR in decibel is = '+string(CMRR)+' dB ');\n", "" ] } ], "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 }