{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Chapter 13 Waveform Generators" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 13.1 Pg 378" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "the frequency selective element resistor is = 6.50 K ohm \n", "The feedback resistance is = 188.4 K ohm\n" ] } ], "source": [ "from math import sqrt, pi\n", "from __future__ import division\n", "# to design RC phase shift oscillator for the oscillation frequency f = 1 KHz\n", "f =1 # # KHz\n", "C = 0.01 # # uF\n", "\n", "# The oscillation frequency of practical RC phase shift oscillator is defined as\n", "#w = 1/(sqrt(6)*R*C)#\n", "\n", "# gain of practical RC phase shift oscillator is\n", "#A = R1/R = 29 equation 1\n", "# the frequency selective element resistor\n", "#R = 1/(sqrt(6)*w*C)#\n", "R = 1/(sqrt(6)*2*pi*f*C)#\n", "print 'the frequency selective element resistor is = %0.2f'%R,' K ohm '\n", "\n", "# The feedback resistance\n", "R1 = 29*R # # from equation 1\n", "print 'The feedback resistance is = %0.1f'%R1,' K ohm'" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 13.2 Pg 379" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "the oscillator frequency of practical RC phase shift oscillator f is = 0.52 KHz \n" ] } ], "source": [ "from math import sqrt, pi\n", "from __future__ import division\n", "# to determine the oscillaton frequency of the phase shift oscillator\n", "C = 0.05 # # uF\n", "R = 2.5 # # K ohm\n", "\n", "# the oscillator frequency of practical RC phase shift oscillator f\n", "f = 1/(2*pi*(sqrt(6)*(R*C)))#\n", "print 'the oscillator frequency of practical RC phase shift oscillator f is = %0.2f'%f,' KHz '" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 13.3 Pg 380" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "the oscillator frequency of practical RC phase shift oscillator f is = 6.63 kHz \n" ] } ], "source": [ "from math import sqrt, pi\n", "from __future__ import division\n", "# to calculate the frequency of a wein bridge oscillator\n", "C = 2400*10**-12 # # F\n", "R = 10*10**3 # # ohm\n", "\n", "# the oscillator frequency of practical RC phase shift oscillator f\n", "f = 1/(2*pi*R*C)/1e3#\n", "print 'the oscillator frequency of practical RC phase shift oscillator f is = %0.2f'%f,' kHz '" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 13.4 Pg 380" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "the resistor R is = 15.9 K ohm \n", "The resistor R2 value is = 20.00 K ohm \n" ] } ], "source": [ "from math import sqrt, pi\n", "from __future__ import division\n", "# to design the wien bridge oscillator for the oscillation frequency f = 1 KHz\n", "f = 1 # # K ohm\n", "C = 0.01 # # uF\n", "\n", "\n", "# the frequency f is define as\n", "# f = 1/(2*pi*R*C)#\n", "\n", "# the resistor R is\n", "R = 1/(2*pi*f*C)#\n", "print 'the resistor R is = %0.1f'%R,' K ohm '\n", "\n", "# the loop gain of the wien bridge oscillator is unity which is defined as\n", "# A = (1+(R2/R1))*(1/3) = 1 #\n", "# R2/R1 = 2 #\n", "R1 = 10 # # K ohm we assume\n", "R2 = 2*R1 #\n", "print 'The resistor R2 value is = %0.2f'%R2,' K ohm '" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 13.5 Pg 382" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "the frequency of wien bridge oscillator f is = 159.155 Hz \n" ] } ], "source": [ "from math import sqrt, pi\n", "from __future__ import division\n", "# to calculate the frequency of a wein bridge oscillator\n", "C = 0.05*10**-6 # # F\n", "R = 20*10**3 # # ohm\n", "R1 = 10*10**3 # # ohm\n", "R2 = 20*10**3 # #ohm\n", "\n", "# the frequency of wien bridge oscillator f\n", "f = 1/(2*pi*R*C)#\n", "print 'the frequency of wien bridge oscillator f is = %0.3f'%f,' Hz '" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 13.6 Pg 382" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The frequency of the astable multivibrator is = 0.87/(C*R)\n" ] } ], "source": [ "from sympy import symbols, log, N\n", "R, C = symbols('R C')\n", "# Determine the frequency response of the astable multivibrator circuit\n", "Vsat = 2.5 #\n", "VT = 0.7 #\n", "\n", "# The frequency of the astable multivibrator is\n", "f = (1/(2*R*C*log((Vsat+VT)/(Vsat-VT))))#\n", "print 'The frequency of the astable multivibrator is =',N(f,2)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 13.7 Pg 383" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The value of resistance R2 is = 32.86 K ohm \n", "The value of resistor R is = 10.52 K ohm\n" ] } ], "source": [ "from math import log\n", "# Design astable multivibrator for the frequency f = 10 KHz\n", "f = 10 # # K ohm\n", "Vsat = 3 #\n", "VT = 0.7 #\n", "\n", "# The saturation voltage of an astable multivibrator is defined as\n", "# Vsat = (R1+R2/R1)+VT #\n", "R1 = 10 # # K ohm we choose\n", "R2 = ((Vsat/VT)-1)*R1 #\n", "print 'The value of resistance R2 is = %0.2f'%R2,' K ohm '\n", "\n", "# The frequency of an astable multivibrator is defined as\n", "C = 0.01 # # uF\n", "# f = (1/(2*R*C*log(1+(2*R1/R2))))#\n", "\n", "R = 1/(2*f*C*log(1+2*R1/R2))#\n", "print 'The value of resistor R is = %0.2f'%R,' K ohm'" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 13.8 Pg 384" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The value of resistor R is = 200.00 ohm \n" ] } ], "source": [ "# to design astable multivibrator \n", "f = 25*10**3 #\n", "\n", "# The output frequency of practical astable multivibrator is defined as\n", "# f = 1/(2*R*C)#\n", "C = 0.1*10**-6 # # uF we choose\n", "R = 1/(2*f*C)#\n", "print 'The value of resistor R is = %0.2f'%R,'ohm '" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 13.9 Pg 385" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The value of resistance R is = 579.7 ohm \n", "The value of resistance R2 is = 9.94 K ohm \n" ] } ], "source": [ "# Design a monostable circuit with frequency f = 25 KHz\n", "f =25*10**3 # # Hz\n", "\n", "# The output frequency of monostable multivibrator is defined as \n", "# f = 1/(0.69*R*C)#\n", "C = 0.1*10**-6 #\n", "R = 1/(0.69*f*C)#\n", "print 'The value of resistance R is = %0.1f'%R,' ohm '\n", "\n", "# In the practical monostable multivibrator\n", "# ln(1+(R2/R1))= 0.69 #\n", "R1 = 10*10**3 # # we choose\n", "R2 = R1*(1.99372-1)#\n", "print 'The value of resistance R2 is = %0.2f'%(R2/1000),' K ohm ' # Round Off Error " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 13.10 Pg 386" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "the output of monostable multivibrator is = 6.01 kHz\n" ] } ], "source": [ "from math import log\n", "# Determine the frequency of the monostable multivibrator\n", "R1 = 5*10**3 #\n", "R2 =15*10**3 #\n", "C = 0.01*10**-6 #\n", "R = 12*10**3 #\n", "\n", "# the output of monostable multivibrator is defined as\n", "f = 1/(R*C*(log(1+(R2/R1))))/1e3 # kHz\n", "print 'the output of monostable multivibrator is = %0.2f'%f,' kHz'" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 13.11 Pg 386" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "the output of monostable multivibrator is = 4.00 KHz\n" ] } ], "source": [ "from __future__ import division\n", "# Determine the frequency of the monostable multivibrator\n", "R1 = 5*10**3 #\n", "R2 =15*10**3 #\n", "C = 0.01 #\n", "R = 25 #\n", "\n", "# the output of monostable multivibrator is defined as\n", "f = 1/(R*C)#\n", "print 'the output of monostable multivibrator is = %0.2f'%f,' KHz'" ] } ], "metadata": { "kernelspec": { "display_name": "Python 2", "language": "python", "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.9" } }, "nbformat": 4, "nbformat_minor": 0 }