summaryrefslogtreecommitdiff
path: root/Basic_Electronics_by_R_D_S_Samuel/5-Amplifiers_and_Oscillators.ipynb
blob: f1f6f5ac628a75cf92dbb9fcf4028bddee5d2ef0 (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
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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
{
"cells": [
 {
		   "cell_type": "markdown",
	   "metadata": {},
	   "source": [
       "# Chapter 5: Amplifiers and Oscillators"
	   ]
	},
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 5.5_10: EX5_5_10.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clc\n",
"disp('Example 5.10')\n",
"printf('\n')\n",
"disp('Calculate overall voltage gain in db & output voltage when input voltage is 1uV for cascaded amplifier')\n",
"printf('Given\n')\n",
"//Voltage gain of amplifier\n",
"Av1=10\n",
"Av2=100\n",
"Av3=1000\n",
"//input voltage\n",
"Vi=10^-6\n",
"//overall voltage gain\n",
"Av=Av1*Av2*Av3\n",
"//in db\n",
"Avdb=20*log10(Av)\n",
"//output voltage when input voltage is 10^-6V\n",
"Vo=Av*Vi\n",
"printf('overall voltage gain in dB \n%f dB\n',Avdb)\n",
"printf('output voltage \n%f volt\n',Vo)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 5.5_11: Calculate_overall_voltage_gain_in_db_of_cascaded_2_stage_amplifier.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clc\n",
"disp('Example 5.11')\n",
"printf('\n')\n",
"disp('Calculate overall voltage gain in db of cascaded 2 stage amplifier')\n",
"printf('Given\n')\n",
"//Voltage gain\n",
"Av1=10\n",
"Av2=20\n",
"//overall voltage gain \n",
"Av=Av1*Av2\n",
"//in db\n",
"Avdb=20*log10(Av)\n",
"printf('Overall gain is \n%f dB\n',Avdb)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 5.5_12: EX5_5_12.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clc\n",
"disp('Example 5.12')\n",
"printf('\n')\n",
"disp('Calculate overall voltage gain ,gain of 2nd & 3rd stage,input voltage of 2nd stage & all in db of three stage amplifier')\n",
"printf('Given\n')\n",
"//input voltage \n",
"Vi=0.05\n",
"//output voltage\n",
"Vo=150\n",
"//voltage gain of 1st stage\n",
"Av1=20\n",
"//input to 3rd stage\n",
"V2=15\n",
"//overall voltage gain \n",
"Av=Vo/Vi\n",
"//input to 2nd stage\n",
"V1=Av1*Vi\n",
"//voltage gain of 2nd stage\n",
"Av2=V2/V1\n",
"//voltage gain of 3rd stage\n",
"Av3=Vo/V2\n",
"//all stages gain in db\n",
"Av1db=20*log10(Av1)\n",
"Av2db=20*log10(Av2)\n",
"Av3db=20*log10(Av3)\n",
"//overall gain in db\n",
"Av=Av1db+Av2db+Av3db\n",
"printf('overall voltage gain \n%f\n',Av)\n",
"printf('voltage gain of 2nd & 3rd stages \n%f\n%f\n',Av2,Av3)\n",
"printf('input voltage of 2nd stage \n%f volt\n',V1)\n",
"printf('Decibal voltage gain of 1st, 2nd, 3rd stage \n%fdB\n%fdB\n%fdB\n',Av1db,Av2db,Av3db)\n",
"printf('Overall gain in db \n%f dB\n',Av)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 5.5_15: For_CE_amplifier_find_R1_R2_Re_and_Rc.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clc\n",
"disp('Example 5.15')\n",
"printf('\n')\n",
"disp('For CE amplifier shown in fig 5.5 find R1,R2,Re & Rc')\n",
"printf('Given\n')\n",
"Vcc=24\n",
"//load resistance\n",
"RL=120*10^3\n",
"//since Rc<<RL\n",
"Rc=RL/10\n",
"//select Ve & Vce\n",
"Ve=5\n",
"Vce=3\n",
"Vrc=Vcc-Vce-Ve  //from circuit\n",
"Ic=Vrc/Rc\n",
"//find Re\n",
"Re=Ve/Ic\n",
"R2=10*Re\n",
"//Vbe for si transistor\n",
"Vbe=0.7\n",
"Vb=Vbe+Ve\n",
"I2=Vb/R2\n",
"R1=(Vcc-Vb)/I2\n",
"printf('The resistance values are\nR1=%f ohm\nR2=%f ohm\nRe=%f ohm\nRc=%f ohm\n',R1,R2,Re,Rc)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 5.5_16: For_CE_amplifier_find_R1_R2_Re_and_Rc.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clc\n",
"disp('Example 5.16')\n",
"printf('\n')\n",
"disp('For CE amplifier shown in fig 5.5 find R1,R2,Re & Rc')\n",
"printf('Given\n')\n",
"Vcc=18\n",
"//load resistance\n",
"RL=56*10^3\n",
"//since Rc<<RL\n",
"Rc=RL/10\n",
"//select Ve & Vce\n",
"Ve=5\n",
"Vce=3\n",
"Vrc=Vcc-Vce-Ve  //from circuit\n",
"Ic=Vrc/Rc\n",
"//find Re\n",
"Re=Ve/Ic\n",
"R2=10*Re\n",
"//Vbe for si transistor\n",
"Vbe=0.7\n",
"Vb=Vbe+Ve\n",
"I2=Vb/R2\n",
"R1=(Vcc-Vb)/I2\n",
"printf('The resistance values are\nR1=%f ohm\nR2=%f ohm\nRe=%f ohm\nRc=%f ohm\n',R1,R2,Re,Rc)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 5.5_19: calculate_upper_cutoff_frequency_and_voltage_gain_at_lower_cutoff_frequency.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clc\n",
"disp('Example 5.19')\n",
"printf('\n')\n",
"disp('calculate upper cut-off frequency & voltage gain at lower cut-off frequency')\n",
"printf('Given\n')\n",
"//bandwidth of amplifier\n",
"BW=500*10^3\n",
"//lower cut-off frequency\n",
"f1=25\n",
"//midband gain\n",
"Ao=120\n",
"//upper cut-off frequency\n",
"f2=BW+f1\n",
"//voltage gain at lower cut-off frequency\n",
"A1=Ao/sqrt(2)\n",
"printf('upper cut-off frequency \n %f hz\n',f2)\n",
"printf('Voltage gain at lower cut-off frequency \n %f \n',A1)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 5.5_23: calculate_closed_loop_gain_for_the_negative_feedback_amplifier.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clc\n",
"disp('Example 5.23')\n",
"printf('\n')\n",
"disp('calculate closed-loop gain for the negative feedback amplifier')\n",
"printf('Given\n')\n",
"//voltage gain without feedback\n",
"Av=100000\n",
"//feedback factor\n",
"B=1/100\n",
"//voltage gain with feedback\n",
"Acl=Av/(1+(B*Av))\n",
"//when Av is changed by 50%\n",
"Av1=50*100000/100\n",
"Av2=Av+Av1\n",
"//voltage gain with feedback when Av changed by +50%\n",
"Acl1=Av2/(1+(B*Av2))\n",
"//voltage gain with feedback when Av changed by -50%\n",
"Av3=Av-Av1\n",
"Acl2=Av3/(1+(B*Av3))\n",
"printf('closed loop gain of negative feedback amplifier is \n %f \n',Acl2)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 5.5_24: calculate_closed_loop_gain_for_the_negative_feedback_amplifier.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clc\n",
"disp('Example 5.24')\n",
"printf('\n')\n",
"disp('calculate closed-loop gain for the negative feedback amplifier')\n",
"printf('Given\n')\n",
"//voltage gain without feedback\n",
"Av=1000\n",
"//feedback factor\n",
"B=0.1\n",
"//voltage gain with feedback\n",
"Acl=Av/(1+(B*Av))\n",
"printf('closed loop gain of negative feedback amplifier is \n %f \n',Acl)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 5.5_27: calculate_input_impedance_of_amplifier_with_negative_feedback.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clc\n",
"disp('Example 5.27')\n",
"printf('\n')\n",
"disp('calculate input impedance of amplifier with negative feedback')\n",
"printf('Given\n')\n",
"//input impedance without feedback\n",
"Zb=10^3\n",
"//open loop voltage gain\n",
"Av=100000\n",
"//feedback network resistance\n",
"RF1=56*10^3\n",
"RF2=560\n",
"//input side resistance\n",
"R1=68*10^3\n",
"R2=33*10^3\n",
"//feedback factor\n",
"B=RF2/(RF1+RF2)\n",
"//input impedance with feedback\n",
"Zi=Zb*(1+(B*Av))\n",
"//input impedance with feedback by considering R1 & R2\n",
"Rp=(R1*R2)/(R1+R2)\n",
"Zin=(Zi*Rp)/(Zi+Rp)\n",
"printf('input impedance with negative feedback \n%f ohm\n',Zin)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 5.5_29: calculate_input_and_output_impedance_of_amplifier_with_negative_feedback.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clc\n",
"disp('Example 5.29')\n",
"printf('\n')\n",
"disp('calculate input & output impedance of amplifier with negative feedback')\n",
"printf('Given\n')\n",
"//input impedance without feedback\n",
"Zb=10^3\n",
"//open loop voltage gain\n",
"Av=7533\n",
"//input side resistance\n",
"R1=68*10^3\n",
"R2=47*10^3\n",
"//feedback factor\n",
"B=1/101\n",
"//input impedance with feedback\n",
"Zi=Zb*(1+(B*Av))\n",
"//input impedance with feedback by considering R1 & R2\n",
"Rp=(R1*R2)/(R1+R2)\n",
"Zin=(Zi*Rp)/(Zi+Rp)\n",
"//output impedance without feedback\n",
"Zc=50*10^3\n",
"Rc=3.9*10^3\n",
"//output impedance with feedback\n",
"Zo=Zc/(1+(B*Av))\n",
"//output impedance with feedback by considering Rc\n",
"Zout=(Rc*Zo)/(Rc+Zo)\n",
"printf('input impedance with negative feedback \n%f ohm\n',Zin)\n",
"printf('output impedance with negative feedback \n%f ohm\n',Zout)\n",
""
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 5.5_35: Estimate_the_closed_loop_upper_cut_off_frequency_and_total_harmonic_distortion.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clc\n",
"disp('Example 5.35')\n",
"printf('\n')\n",
"disp('Estimate the closed loop upper cut-off frequency & total harmonic distortion')\n",
"printf('Given\n')\n",
"//open loop gain\n",
"Av=60000\n",
"//closed loop gain\n",
"Acl=300\n",
"//open loop upper cut-off frequency\n",
"F2OL=15*10^3\n",
"//closed loop upper cut-off frequency & Av/Acl=(1+BAv)\n",
"F2CL=F2OL*Av/Acl\n",
"//total harmonic distortion with feedback if there is 10% distortion without feedback\n",
"HD=10/(Av/Acl)\n",
"printf('closed loop upper cut-off frequency \n%f hz\n',F2CL)\n",
"printf('total harmonic distortion with feedback if there is 10per distortion without feedback \n%f\n',HD)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 5.5_36: calculate_open_loop_cut_off_frequency_if_the_open_loop_gain_is_200000.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clc\n",
"disp('Example 5.36')\n",
"printf('\n')\n",
"disp('calculate open loop cut-off frequency if the open loop gain is 200000')\n",
"printf('Given\n')\n",
"//open loop gain\n",
"Av=200000\n",
"//closed loop gain \n",
"Acl=250\n",
"//upper cut-off frequency with feedback\n",
"F2CL=4*10^6\n",
"//upper cut-off frequency without feedback\n",
"F2OL=F2CL/(Av/Acl)\n",
"printf('upper cut-off frequency without feedback \n%f hz\n',F2OL)\n",
""
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 5.5_37: calculate_the_phase_shift_with_negative_feedback.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clc\n",
"disp('Example 5.37')\n",
"printf('\n')\n",
"disp('calculate the phase shift with negative feedback')\n",
"printf('Given\n')\n",
"//open loop phase shift\n",
"Po=15\n",
"//open loop gain\n",
"Av=60000\n",
"//closed loop gain\n",
"Acl=300\n",
"//to calculate phase shift with feedback\n",
"AvB=(Av/Acl)-1\n",
"k=((AvB*sin(Po*%pi/180))/(1+(AvB*cos(Po*%pi/180))))\n",
"Pcl=Po-(atan(k)*180/%pi)\n",
"printf('The phase shift with negative feedback=\t%f degree\n',Pcl)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 5.5_38: calculate_bandwidth_and_gain_and_harmonic_distortion_with_feedback.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clc\n",
"disp('Example 5.38')\n",
"printf('\n')\n",
"disp('calculate bandwidth,gain & harmonic distortion with feedback')\n",
"printf('Given\n')\n",
"//open loop gain\n",
"Av=1000\n",
"//bandwidth without feedback\n",
"BWol=500*10^3\n",
"//feedback factor\n",
"B=0.1\n",
"//bandwidth with feedback\n",
"BWcl=BWol*(1+(B*Av))\n",
"//closed loop gain\n",
"Acl=Av/(1+(B*Av))\n",
"//harmonic distortion if 15% negative feedback used\n",
"HDcl=15/(1+(B*Av))\n",
"printf('bandwidth with feedback is \n %f hz \n',BWcl)\n",
"printf('closed loop gain \n %f \n',Acl)\n",
"printf('Harmonic distortion with feedback \n %f \n',HDcl)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 5.5_3: Calculate_output_power_change_in_decibel_of_amplifier.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clc\n",
"disp('Example 5.3')\n",
"printf('\n')\n",
"disp('Calculate output power change in decibel of amplifier')\n",
"printf('Given\n')\n",
"//output power when frequency is 5khz\n",
"P1=50*10^-3\n",
"//output power when frequency is 20khz\n",
"P2=25*10^-3\n",
"//output power change in decibel\n",
"delPo=10*log10(P2/P1)\n",
"printf('output power change \n%f dB\n',delPo)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 5.5_40: calculate_the_frequency_of_oscillation_and_feedback_factor_of_Hartley_oscillator.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clc\n",
"disp('Example 5.50')\n",
"printf('\n')\n",
"disp('calculate the frequency of oscillation & feedback factor of Hartley oscillator')\n",
"printf('Given\n')\n",
"//inductance\n",
"L1=2*10^-3\n",
"L2=8*10^-3\n",
"//mutual inductance\n",
"M=100*10^-6\n",
"//capacitor\n",
"C=0.001*10^-6\n",
"//total inductance \n",
"L=L1+L2+M\n",
"//frequency of oscillation\n",
"f=1/(2*%pi*sqrt(L*C))\n",
"//feedback factor\n",
"B=L1/L2\n",
"printf('frequency of oscillation of hartley oscillator \n %f hz \n',f)\n",
"printf('feedback factor \n %f \n',B)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 5.5_43: calculate_the_frequency_of_oscillation_of_RC_phase_shift_oscillator.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clc\n",
"disp('Example 5.43')\n",
"printf('\n')\n",
"disp('calculate the frequency of oscillation of RC phase shift oscillator')\n",
"printf('Given\n')\n",
"R=500\n",
"C=0.1*10^-6\n",
"//frequency of oscillation\n",
"f=1/(2*%pi*R*C*sqrt(6))\n",
"printf('frequency of oscillation \n%f hz\n',f)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 5.5_44: calculate_the_value_of_Capacitor_for_a_RC_phase_shift_oscillator.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clc\n",
"disp('Example 5.44')\n",
"printf('\n')\n",
"disp('calculate the value of Capacitor for a RC phase shift oscillator')\n",
"printf('Given\n')\n",
"R=1000\n",
"//frequency of oscillation\n",
"f=5000\n",
"//capacitor value\n",
"C=1/(2*%pi*R*f*sqrt(6))\n",
"printf('Capacitor value \n%e farad \n',C)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 5.5_45: calculate_the_value_of_R_and_C_for_RC_phase_shift_oscillator.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clc\n",
"disp('Example 5.45')\n",
"printf('\n')\n",
"disp('calculate the value of R & c for RC phase shift oscillator')\n",
"printf('Given\n')\n",
"//oscillating frequency\n",
"f=2000\n",
"//select Capacitor value\n",
"C=0.1*10^-6\n",
"//resistance value \n",
"R=1/(2*%pi*f*C*sqrt(6)) \n",
"printf('Resistance value \n%f ohm\n',R)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 5.5_49: EX5_5_49.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clc\n",
"disp('Example 5.49')\n",
"printf('\n')\n",
"disp('calculate frequency of oscillation,feedback factor & gain required for sustained oscillation of hartley oscillator')\n",
"printf('Given\n')\n",
"//inductance\n",
"L1=5*10^-3\n",
"L2=10*10^-3\n",
"//capacitor\n",
"C=0.01*10^-6\n",
"//frequency of oscillation\n",
"f=1/(2*%pi*sqrt((L1+L2)*C))\n",
"//feedback factor\n",
"B=L1/L2\n",
"//gain required for sustained oscillation\n",
"Av=L2/L1\n",
"printf('gain required for sustained oscillation=\t>%f\n',Av)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 5.5_4: Calculate_output_power_change_in_decibel_of_amplifier.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clc\n",
"disp('Example 5.4')\n",
"printf('\n')\n",
"disp('Calculate output power change in decibel of amplifier')\n",
"printf('Given\n')\n",
"//output voltage of amplifier when frequency 3khz\n",
"V1=2\n",
"//output voltage of amplifier when frequency 50khz\n",
"V2=0.5\n",
"//output power change in decibel\n",
"delPo=20*log10(V2/V1)\n",
"printf('output power change \n%f dB\n',delPo)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 5.5_51: calculate_the_value_of_L1_and_L2_of_Hartley_oscillator.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clc\n",
"disp('Example 5.51')\n",
"printf('\n')\n",
"disp('calculate the value of L1 & L2 of Hartley oscillator')\n",
"printf('Given\n')\n",
"//frequency of oscillation\n",
"f=25*10^3\n",
"C=0.02*10^-6\n",
"//feedback factor\n",
"B=0.2\n",
"//Total inductance\n",
"L=1/(4*(%pi)^2*f^2*C)\n",
"L1byL2=B\n",
"L1plusL2=L\n",
"//therefore\n",
"L2=L/1.2\n",
"L1=L-L2\n",
"printf('The values of L1=\t%f henry\nL2=\t%f henry\n',L1,L2)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 5.5_53: Design_the_value_of_L1_L2_and_C_for_a_hartley_oscillator.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clc\n",
"disp('Example 5.53')\n",
"printf('\n')\n",
"disp('Design the value of L1,L2 & C for a hartley oscillator')\n",
"printf('Given\n')\n",
"//frequency of oscillation\n",
"f=30*10^3\n",
"//then value of LC\n",
"LC=1/(4*(%pi)^2*f^2)\n",
"//select c as\n",
"C=0.1*10^-6\n",
"//Total inductance\n",
"L=LC/C\n",
"//let L1=L2\n",
"L1=L/2\n",
"L2=L1\n",
"printf('The values of L1=\t%f henry\nL2=\t%f henry\nC=\t%e farad\n',L1,L2,C)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 5.5_55: calculate_the_frequency_of_oscillation_of_Colpitts_oscillator.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clc\n",
"disp('Example 5.55')\n",
"printf('\n')\n",
"disp('calculate the frequency of oscillation of Colpitts oscillator')\n",
"printf('Given\n')\n",
"//capacitor\n",
"C1=400*10^-12\n",
"C2=C1\n",
"//inductance\n",
"L=2*10^-3\n",
"//Total capacitance\n",
"C=C1*C2/(C1+C2)\n",
"//frequency of oscillation\n",
"f=1/(2*%pi*sqrt(L*C))\n",
"printf('frequency of oscillations \n%f hz\n',f)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 5.5_56: EX5_5_56.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clc\n",
"disp('Example 5.56')\n",
"printf('\n')\n",
"disp('calculate the frequency of oscillation,feedback factor & gain required for sustained oscillation')\n",
"printf('Given\n')\n",
"//Capacitance\n",
"C1=40*10^-12\n",
"C2=10*10^-12\n",
"//inductance\n",
"L=3*10^-3\n",
"//total effective capacitance\n",
"C=C1*C2/(C1+C2)\n",
"//frequency of oscillation\n",
"f=1/(2*%pi*sqrt(L*C))\n",
"//feedback factor\n",
"B=C2/C1\n",
"//gain required for sustained oscillation\n",
"Av=C1/C2\n",
"printf('gain required for sustained oscillation =\t>%f\n',Av)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 5.5_57: calculate_the_value_of_L_of_Colpitts_oscillator.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clc\n",
"disp('Example 5.57')\n",
"printf('\n')\n",
"disp('calculate the value of L of Colpitts oscillator ')\n",
"printf('Given\n')\n",
"//capacitor\n",
"C1=100*10^-12\n",
"C2=60*10^-12\n",
"//total effective capacitance\n",
"C=C1*C2/(C1+C2)\n",
"//frequency of oscillation\n",
"f=40*10^3\n",
"//inductance\n",
"L=1/(4*(%pi)^2*f^2*C)\n",
"printf('inductance value is \n%f henry\n',L)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 5.5_58: calculate_the_value_of_C1_and_C2_of_Colpitts_oscillator.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clc\n",
"disp('Example 5.58')\n",
"printf('\n')\n",
"disp('calculate the value of C1 & C2 of Colpitts oscillator')\n",
"printf('Given\n')\n",
"//inductance\n",
"L=5*10^-3\n",
"//frequency of oscillation\n",
"f=50*10^3\n",
"//total effective capacitance\n",
"C=1/(4*(%pi)^2*f^2*L)\n",
"//feedback factor \n",
"B=0.1\n",
"//then C2/C1=0.1, so substituting in C=C1C2/(C1+C2) we get\n",
"C1=1.1*C/0.1\n",
"C2=0.1*C1\n",
"printf('The value of C1=\t%e farad\nC2=\t%e farad\n',C1,C2)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 5.5_59: calculate_the_value_of_L_and_C_for_a_colpitts_oscillator.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clc\n",
"disp('Example 5.59')\n",
"printf('\n')\n",
"disp('calculate the value of L & C for a colpitts oscillator')\n",
"printf('Given\n')\n",
"//frequency of oscillation\n",
"f=40*10^3\n",
"LC=1/(4*(%pi)^2*f^2)\n",
"//select L\n",
"L=10*10^-3\n",
"//find C\n",
"C=1/(4*(%pi)^2*f^2*L)\n",
"//let C1=C2 so we get\n",
"C1=2*C\n",
"C2=C1\n",
"printf('The values of L=\t%f henry\nC1=\t%e farad\nC2=\t%e farad\n',L,C1,C2)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 5.5_5: Calculate_power_gain_of_amplifier.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clc\n",
"disp('Example 5.5')\n",
"printf('\n')\n",
"disp('Calculate power gain of amplifier')\n",
"printf('Given\n')\n",
"//have equal input & load resistance\n",
"//input voltage\n",
"Vi=100*10^-3\n",
"//output voltage\n",
"Vo=3\n",
"//power gain of amplifier\n",
"Apdb=20*log10(Vo/Vi)\n",
"printf('power gain of amplifier \n%f\n',Apdb)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 5.5_61: calculate_the_frequency_of_oscillation_for_Wein_Bridge_Oscillator.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clc\n",
"disp('Example 5.61')\n",
"printf('\n')\n",
"disp('calculate the frequency of oscillation for Wein_Bridge Oscillator')\n",
"printf('Given\n')\n",
"//Resistance\n",
"R=2*10^3\n",
"//capacitor\n",
"C=0.1*10^-6\n",
"//frequency of oscillation\n",
"f=1/(2*%pi*R*C)\n",
"printf('frequecy of oscillation \n%f hz\n',f)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 5.5_62: calculate_the_value_of_R_and_C_for_Wein_Bridge_oscillator.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clc\n",
"disp('Example 5.62')\n",
"printf('\n')\n",
"disp('calculate the value of R & c for Wein-Bridge oscillator')\n",
"printf('Given\n')\n",
"//frequency of oscillation\n",
"f=1000\n",
"//find RC\n",
"RC=1/(2*%pi*f)\n",
"//select C<10^-6F\n",
"C=0.1*10^-6\n",
"//the value of R\n",
"R=1/(2*%pi*f*C)\n",
"printf('the value of c \n%f farad\n',C)\n",
"printf('the value of R \n%f ohm\n',R)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 5.5_65: calculate_the_Series_and_parallel_resonant_frequencies_of_Crystal.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clc\n",
"disp('Example 5.65')\n",
"printf('\n')\n",
"disp('calculate the Series & parallel resonant frequencies of Crystal')\n",
"printf('Given\n')\n",
"//indutance\n",
"L=3\n",
"//Capacitor due to mechanical mounting of crystal\n",
"Cm=10*10^-12\n",
"//electrical equivalent capacitance of crystal compliance\n",
"Cs=0.05*10^-12\n",
"//electrical equivalent resistance of crystal structure internal friction\n",
"R=2*10^3\n",
"//series resonant frequency\n",
"fs=1/(2*%pi*sqrt(L*Cs))\n",
"Cp=Cm*Cs/(Cm+Cs)\n",
"//parallel resonant frequency\n",
"fp=1/(2*%pi*sqrt(L*Cp))\n",
"printf('series resonant frequency \n%f hz\n',fs)\n",
"printf('parallel resonant frequency \n%f hz\n',fp)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 5.5_6: Calculate_new_level_of_output_voltage_when_it_has_fallen_by_4db.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clc\n",
"disp('Example 5.6')\n",
"printf('\n')\n",
"disp('Calculate new level of output voltage when it has fallen by 4db')\n",
"printf('Given\n')\n",
"//output voltage of an amplifier is 2V when frequency 1khz\n",
"V1=2\n",
"//power in db\n",
"Po=-4\n",
"//new level of output voltage\n",
"V2=10^(Po/20)*V1\n",
"printf('new output voltage \n%f volt\n',V2)"
   ]
   }
],
"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
}