summaryrefslogtreecommitdiff
path: root/Basic_Electronics_by_R_D_S_Samuel/6-Operational_Amplifier.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Basic_Electronics_by_R_D_S_Samuel/6-Operational_Amplifier.ipynb')
-rw-r--r--Basic_Electronics_by_R_D_S_Samuel/6-Operational_Amplifier.ipynb608
1 files changed, 608 insertions, 0 deletions
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
+}