summaryrefslogtreecommitdiff
path: root/sample_notebooks/ParitoshMehta/ch4.ipynb
blob: c94b7f1ecda297775f647bc6d29a1301ee4242cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
{
 "metadata": {
  "name": "",
  "signature": "sha256:6400e06363df718a0205b64ca5c3fc7d61a14e362b1dd10172150d22b3db1e89"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 4 : Communication Filters and Signal Transmission"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.5  Page No : 120"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "from numpy import array,log10,sqrt\n",
      "\n",
      "# Variables\n",
      "f = array([500., 2000., 10000.]);    #frequency in Hz\n",
      "\n",
      "# Calculations\n",
      "Af = 1/sqrt(1+(f/1000)**8);   #Linear amplitude response\n",
      "AdBf = 20*log10(Af);\n",
      "\n",
      "# Results\n",
      "print '   f,Hz     (Af)        (AdBf)'\n",
      "for i in range(3):\n",
      "    print ' %5i Hz   %.5f     %.3f dB'%(f[i],Af[i],AdBf[i])\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "   f,Hz     (Af)        (AdBf)\n",
        "   500 Hz   0.99805     -0.017 dB\n",
        "  2000 Hz   0.06238     -24.099 dB\n",
        " 10000 Hz   0.00010     -80.000 dB\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.6  Page No : 123"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "L = 4.*10**-6;   #Henry\n",
      "C = 9.*10**-12;  #Farad\n",
      "R = 20.*10**3;    #ohm\n",
      "\n",
      "# Calculations and Results\n",
      "f0 = 1/(2*math.pi*math.sqrt(L*C));    #frequency in Hz\n",
      "print 'a) The resonant frequency is f0 = %.2f  MHz'%(f0*10**-6)\n",
      "Q = R*math.sqrt(C/L)\n",
      "print ' b) The Q is %i'%(Q);\n",
      "B = f0/Q;\n",
      "print ' c) The 3-dB bandwidth is B = %i KHz'%(B*10**-3);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "a) The resonant frequency is f0 = 26.53  MHz\n",
        " b) The Q is 30\n",
        " c) The 3-dB bandwidth is B = 884 KHz\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.7  Page No : 125"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "#misprinted example number\n",
      "pulse_width = 2*10**-6;    #second\n",
      "rise_time = 10*10**-9;      #second\n",
      "\n",
      "# Calculations and Results\n",
      "B = .5/pulse_width;       #in Hz\n",
      "print 'a) The aproximate bandwidth for coarse reproduction is B = %i  KHz'%(B*10**-3)\n",
      "B = .5/rise_time;\n",
      "print ' b) The aproximate bandwidth for fine reproduction is B = %i  MHz'%(B*10**-6)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "a) The aproximate bandwidth for coarse reproduction is B = 250  KHz\n",
        " b) The aproximate bandwidth for fine reproduction is B = 50  MHz\n"
       ]
      }
     ],
     "prompt_number": 7
    }
   ],
   "metadata": {}
  }
 ]
}