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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
|
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Chapter 16: Oscillators"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 16.1: Wien_bridge_oscillator.sce"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"//ex16.1\n",
"R1=10*10^3;\n",
"R2=R1;\n",
"R=R1;\n",
"C1=0.01*10^-6;\n",
"C2=C1;\n",
"C=C1;\n",
"R3=1*10^3;\n",
"r_ds=500;\n",
"f_r=1/(2*%pi*R*C);\n",
"disp(f_r,'resonant frequency of the Wein-bridge oscillator in Hertz')\n",
"//closed loop gain A_v=3 to sustain oscillations\n",
"A_v=3;\n",
"//A_v=(R_f+R_i)+1 where R_i is composed of R3 and r_ds\n",
"R_f=(A_v-1)*(R3+r_ds);\n",
"disp(R_f,'value of R_f in ohms')"
]
}
,
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 16.2: Phase_shift_oscillator.sce"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"//ex16.2\n",
"A_cl=29; //A_cl=R_f/R_i;\n",
"R3=10*10^3;\n",
"R_f=A_cl*R3;\n",
"disp(R_f,'value of R_f in ohms')\n",
"//let R1=R2=R3=R and C1=C2=C3=C\n",
"R=R3;\n",
"C3=0.001*10^-6;\n",
"C=C3;\n",
"f_r=1/(2*%pi*sqrt(6)*R*C);\n",
"disp(f_r,'frequency of oscillation in Hertz')"
]
}
,
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 16.3: FET_Colpitts_oscillator.sce"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"//ex16.3\n",
"C1=0.1*10^-6;\n",
"C2=0.01*10^-6;\n",
"L=50*10^-3; //in Henry\n",
"C_T=C1*C2/(C1+C2); //total capacitance\n",
"f_r=1/(2*%pi*sqrt((L*C_T)));\n",
"disp(f_r,'frequency of oscillation in Hertz when Q>10')\n",
"Q=8; //when Q drops to 8\n",
"f_r=(1/(2*%pi*sqrt((L*C_T))))*sqrt((Q^2/(1+Q^2)));\n",
"disp(f_r,'frequency of oscillation in hertz when Q=8')"
]
}
,
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 16.4: Triangular_wave_oscillator.sce"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"//ex16.4\n",
"R1=10*10^3;\n",
"R2=33*10^3;\n",
"R3=10*10^3;\n",
"C=0.01*10^-6;\n",
"f_r=(1/(4*R1*C))*(R2/R3);\n",
"disp(f_r,'frequency of oscillation in hertz')\n",
"//the value of R1 when frequency of oscillation is 20 kHz\n",
"f=20*10^3;\n",
"R1=(1/(4*f*C))*(R2/R3);\n",
"disp(R1,'value of R1 in ohms to make frequency 20 kiloHertz')"
]
}
,
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 16.5: Sawtooth_VCO.sce"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"//ex16.5\n",
"V=15;\n",
"C=0.0047*10^-6;\n",
"R3=10*10^3;\n",
"R4=R3;\n",
"R2=10*10^3;\n",
"R1=68*10^3;\n",
"R_i=100*10^3;\n",
"V_G=R4*V/(R3+R4); //gate voltage at which PUT turns on\n",
"V_p=V_G; //neglecting 0.7V, this the peak voltage of sawtooth wave\n",
"disp(V_p,'neglecting 0.7V, this the peak voltage of sawtooth wave in volts')\n",
"V_F=1; //minimum peak value of sawtooth wave\n",
"V_pp=V_p-V_F;\n",
"disp(V_pp,'peak to peak amplitude of the sawtooth wave in volts')\n",
"V_IN=-V*R2/(R1+R2);\n",
"f=(abs(V_IN)/(R_i*C))*(1/(V_pp));\n",
"disp(f,'frequency of the sawtooth wave')\n",
"T=1/f;\n",
"xtitle('Sawtooth voltage controlled oscillator')\n",
"x=[];\n",
"for t=0:1*10^-5:4*10^-3 \n",
" tcor = t- floor(t/T)*T;\n",
" x_temp = (V_pp/T)*tcor + 1;\n",
" x = [x, x_temp];\n",
" end;\n",
" t=0:1*10^-5:4*10^-3\n",
" plot(t,x)"
]
}
,
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 16.6: 555_timer.sce"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"//ex16.6\n",
"R1=2.2*10^3;\n",
"R2=4.7*10^3;\n",
"C_ext=0.022*10^-6;\n",
"f_r=1.44/((R1+2*R2)*C_ext);\n",
"disp(f_r,'frequency of the 555 timer in hertz')\n",
"duty_cycle=((R1+R2)/(R1+2*R2))*100;\n",
"disp(duty_cycle,'duty cycle in percentage')"
]
}
],
"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
}
|