{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Chapter 11: signal generators" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 11.1: maximum_and_minimum_output_frequencies.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "// to calculate the maximum and minimmum output frequencies of oscillator in fig 11-1\n", "// example 11-1 in page 317\n", "clc;\n", "// Data Given\n", "R=[5e+3 500];// resistance R2 and R1 all in ohm\n", "C1=300D-9; C2=C1;// Capacitance=300 nF\n", "// calculation\n", "f=['f(min)' 'f(max)'];\n", "for n=1:2\n", " printf('%s=%d Hz\n',f(n),1/(2*%pi*C1*R(n)));// frequency in hertz\n", "end\n", "//result\n", "//f(min)=106 Hz\n", "//f(max)=1061 Hz" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 11.2: find_the_resistor_values.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//to find the resistor values in fig 11-3\n", "// example 11-2 in page 319\n", "clc;\n", "//data given\n", "Vi=5; //input sine wave voltage in volt\n", "VR3=[0.1 1];// range of voltage across resistor R3 in volt\n", "IB=500D-9;// input current to the op-amp in ampere\n", "//calculation\n", "V=Vi-VR3(1);// with R1 and R2 in the circuit, V=VR1+VR2 in volt\n", "I3=100D-6;// as I3>>IB, select I3=100 micro ampere\n", "R3=VR3(1)/I3;// resistance in ohm\n", "R=V/I3;//R=R1+R2 in ohm\n", "//with R2 switched off the circuit\n", "I3=VR3(2)/R3;// current in ampere\n", "VR1=Vi-VR3(2);// voltage in volt\n", "R1=VR1/I3;// here I3=I1, resistance in ohm\n", "R2=R-R1;// resistance in ohm\n", "printf('R1=%d K-ohm\nR2=%d K-ohm\nR3=%d K-ohm',R1/1000,R2/1000,R3/1000);\n", "//result\n", "//R1=4 K-ohm\n", "//R2=45 K-ohm\n", "//R3=1 K-ohm " ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 11.3: find_the_output_frequency.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "// to find the output frequency of the circuit 11-8\n", "// example 11-3 in page 326\n", "clc;\n", "// Data given\n", "Vcc=15;// supply voltage=15 V\n", "C1=0.1D-6;// capacitance in farad\n", "R1=1e+3; R2=10e+3;// resistances in ohm\n", "utp=3; ltp=-3;// upper and lower trigger points in volt \n", "//calculation\n", "a=['For contact at top of R1' 'For R1 contact at 10% from bottom'];\n", "V3=Vcc-1;// voltage in volt\n", "dV=utp-ltp;//change in voltage in volt\n", "V1=[V3 10*V3/100];// V1 when R1 is at the top and 10% from the bottom of R1 in volt\n", "for n=1:2\n", " I2=V1(n)/R2;// current in ampere\n", " t=C1*dV/I2;// time in seconds\n", " f=1/(2*t);// frequency in hertz\n", " printf('%s,\nfrequency=%.2f Hz\n\n',a(n),f);\n", "end\n", "//result\n", "//For contact at top of R1,\n", "//frequency=1166.67 Hz\n", "//For R1 contact at 10% from bottom,\n", "//frequency=116.67 Hz" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 11.4: output_square_wave_frequency.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "// to find the out put square wave frequency in 11-14\n", "// example 11-4 in page 332\n", "clc;\n", "//Data given\n", "Vcc=12;//supply voltage (+/-)12 V\n", "R=10^3*[20 6.2 5.6];//resistance R1, R2 and R3 all in ohm\n", "C1=0.2D-6;// capacitance=0.2 micro farad\n", "// calculation\n", "Vo=Vcc-1;// out put voltage = (+/-)(Vcc-1) in volt\n", "utp=Vo*R(3)/(R(2)+R(3));// upper trigger point in volt\n", "ltp=-utp;// lower trigger point in volt\n", "t=C1*R(1)*log((Vo-ltp)/(Vo-utp));// time in seconds\n", "printf('out put frequency=%d Hz',1/(2*t));\n", "//result\n", "//out put frequency=121 Hz" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 11.5: output_pulse_width_and_the_capacitance.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "// to find the output pulse width and capacitance for the given pulse width in figure 11-15\n", "// example 11-5 in page 334\n", "clc;\n", "//data given\n", "Vcc=10;//supply voltage in Volt\n", "Vee=10;// supply voltage in volt\n", "VB=1;// base voltage in volt\n", "R=1e+3*[22 10];//resistances R1 in ohm and R2 in ohm\n", "C=[100D-12 0.01D-6];//capacitance C1 in farad and C2 in farad\n", "//calculation\n", "Vop=Vcc-1;// positive output voltage in volt\n", "Von=-(Vee-1);// negative output voltage in volt\n", "PW=C(2)*R(2)*log((Vop-Von)/VB);//pulse width in seconds\n", "printf('PULSE WIDTH=%d micro-sec\n',PW*10^6);\n", "PW=6e-3;//to calculate C2 for PW=6 ms\n", "C2=PW/(R(2)*log((Vop-Von)/VB));// capacitance in farad\n", "printf('For pulse width of 6 ms,\nC2=%.1f micro-F',C2*10^6);\n", "//result\n", "//PULSE WIDTH=289 micro-sec\n", "//For pulse width of 6 ms,\n", "//C2=0.2 micro-F " ] } ], "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 }