Scilab Textbook Companion for Basic Electronics And Linear Circuits by N. N. Bhargava, D. C. Kulshreshtha And S. C. Gupta1 Created by Mohammad Faisal Siddiqi B.Tech (pursuing) Electronics Engineering Jamia Millia Islamia, New Delhi College Teacher Dr. Sajad A. Loan Cross-Checked by TechPassion May 19, 2016 1 Funded by a grant from the National Mission on Education through ICT, http://spoken-tutorial.org/NMEICT-Intro. This Textbook Companion and Scilab codes written in it can be downloaded from the ”Textbook Companion Project” section at the website http://scilab.in Book Description Title: Basic Electronics And Linear Circuits Author: N. N. Bhargava, D. C. Kulshreshtha And S. C. Gupta Publisher: Tata McGraw - Hill Education, New Delhi Edition: 1 Year: 2008 ISBN: 0074519654 1 Scilab numbering policy used in this document and the relation to the above book. Exa Example (Solved example) Eqn Equation (Particular equation of the above book) AP Appendix to Example(Scilab Code that is an Appednix to a particular Example of the above book) For example, Exa 3.51 means solved example 3.51 of this book. Sec 2.3 means a scilab code whose theory is explained in Section 2.3 of the book. 2 Contents List of Scilab Codes 4 1 INTRODUCTION TO ELECTRONICS 6 2 CURRENT AND VOLTAGE SOURCES 8 4 SEMICONDUCTOR DIODE 12 5 TRANSISTORS 18 6 VACUUM TUBES 25 7 TRANSISTOR BIASING AND STABILIZATION OF OPERATING POINT 30 8 SMALL SIGNAL AMPLIFIERS 44 9 MULTI STAGE AMPLIFIERS 51 10 POWER AMPLIFIERS 59 11 TUNED VOLTAGE AMPLIFIERS 62 12 FEEDBACK IN AMPLIFIERS 67 13 OSCILLATORS 71 14 ELECTRONIC INSTRUMENTS 73 3 List of Scilab Codes Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa 1.1 1.2 2.1 2.2 2.3 2.4 4.1 4.2 4.3.a 4.3.b 4.3.c 4.3.d 4.3.e 4.4 4.5 5.1 5.2 5.3 5.4.a 5.4.b Exa 5.5 Exa 5.6 Exa 5.7 Exa 5.8 Exa 6.1 Resistor Range Calculation using Colour Band Sequence Resistor Range Calculation using Colour Band Sequence Equivalent Current Source Representation . . . . . . . Equivalent Voltage Source Representation . . . . . . . Current Determination using Voltage Source and Current Source Representations . . . . . . . . . . . . . . . Output Voltage Determination . . . . . . . . . . . . . DC Voltage and PIV Calculation . . . . . . . . . . . . DC Voltage and PIV Calculation . . . . . . . . . . . . Peak Value of Current Calculation . . . . . . . . . . . DC or Average Value of Current Calculation . . . . . RMS Value of Current Calculation . . . . . . . . . . . Ripple Factor Determination . . . . . . . . . . . . . . Rectification Efficiency Calculation . . . . . . . . . . . Maximum Permissible Current Determination . . . . . Capacitance Determination on changing Bias Voltage . Collector and Base Currents Calculation . . . . . . . . Dynamic Input Resistance Determination . . . . . . . Short Circuit Current Gain Determination . . . . . . . Common Base Short Circuit Current Gain Calculation Common Emitter Short Circuit Current Gain Calculation . . . . . . . . . . . . . . . . . . . . . . . . . . . . DC Current Gain in Common Base Configuration . . . Determination of Dynamic Output Resistance and AC and DC Current Gains . . . . . . . . . . . . . . . . . . Q Point Determination . . . . . . . . . . . . . . . . . Calculation of Dynamic Drain Resistance of JFET . . Dynamic Plate Resistance of the Diode Determination 4 6 7 8 9 9 10 12 13 13 14 14 15 15 16 17 18 18 19 20 20 21 21 22 23 25 Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa 6.2 7.1 7.2 7.3 7.4.a 7.4.b 7.5 7.6 7.7 7.8 7.9 7.10 7.11 7.12 7.13 7.14 8.1 8.2.a 8.2.b 8.2.c 8.3.a 8.3.b 8.3.c 8.4 8.5 8.6 9.1 9.2 9.3 9.4.a Exa 9.4.b Exa 9.4.c Exa 9.5 Plotting of Static Plate Characteristics . . . . . . . . . Calculate Ic and Vce for given Circuit . . . . . . . . . Calculate coordinates of Operating Point . . . . . . . Quiescent Operating Point Determination . . . . . . . Calculate value of Resistance Rb . . . . . . . . . . . . Calculation of Collector Current Ic . . . . . . . . . . . Calculation of Ie and Vc in the Circuit . . . . . . . . . Calculate Minimum and Maximum Collector Currents Calculate Values of the three Currents . . . . . . . . . Calculate Minimum and Maximum Ie and corresponding Vce . . . . . . . . . . . . . . . . . . . . . . . . . . Determine the new Q Points . . . . . . . . . . . . . . Calculate the value of Rb . . . . . . . . . . . . . . . . Calculate DC bias Voltages and Currents . . . . . . . Calculate Re and Vce in the Circuit . . . . . . . . . . Calculate Ic and Vce for given Circuit . . . . . . . . . Calculate Ic and Vce for given Circuit . . . . . . . . . Determination of Hybrid Parameters . . . . . . . . . . Calculation of Input Impedance of Amplifier . . . . . . Calculation of Voltage Gain of Amplifier . . . . . . . . Calculation of Current Gain of Amplifier . . . . . . . . Calculation of Voltage Gain of Amplifier . . . . . . . . Calculation of Input Impedance of Amplifier . . . . . . Calculation of Q Point Parameters of Amplifier . . . . Calculation of Voltage Gain of Amplifier . . . . . . . . Calculation of Gain of Single Stage Amplifier . . . . . Calculation of Output Signal Voltage of FET Amplifier Calculate overall Voltage Gain in dB . . . . . . . . . . Calculate Voltage at the Output Terminal . . . . . . . To Plot the Frequency Response Curve . . . . . . . . Calculate Input Impedance of Two Stage RC Coupled Amplifier . . . . . . . . . . . . . . . . . . . . . . . . . Calculate Ouput Impedance of Two Stage RC Coupled Amplifier . . . . . . . . . . . . . . . . . . . . . . . . . Calculate Voltage Gain of Two Stage RC Coupled Amplifier . . . . . . . . . . . . . . . . . . . . . . . . . . . Calculate Maximum Voltage Gain and Bandwidth of Triode Amplifier . . . . . . . . . . . . . . . . . . . . . 5 27 30 31 32 33 34 34 35 36 36 38 39 40 40 41 42 44 45 45 46 46 47 47 48 49 49 51 51 52 55 55 56 57 Exa Exa Exa Exa Exa Exa Exa Exa Exa 10.1 10.2 10.3.a 10.3.b 11.1.a 11.1.b 11.1.c 11.1.d 11.2 Exa 11.3 Exa 12.1 Exa 12.2 Exa 12.3 Exa 12.4 Exa 12.5 Exa 13.1 Exa 13.2 Exa 13.3 Exa 14.1 Exa 14.2 Exa 14.3 Exa 14.4 Exa 14.5 Calculation of Transformer Turns Ratio . . . . . . . . Calculation of Effective Resistance seen at Primary . . Calculation of 2nd 3rd and 4th Harmonic Distortions . Percentage Increase in Power because of Distortion . . Calculation of Resonant Frequency . . . . . . . . . . . Calculation of Impedance at Resonance . . . . . . . . Calculation of Current at Resonance . . . . . . . . . . Calculation of Voltage across each Component . . . . Calculation of Parameters of the Resonant Circuit at Resonance . . . . . . . . . . . . . . . . . . . . . . . . Calculation of Impedance Q and Bandwidth of Resonant Circuit . . . . . . . . . . . . . . . . . . . . . . . Calculation of Gain of Negative Feedback Amplifier . . Calculation of Internal Gain and Feedback Gain . . . Calculation of change in overall Gain of Feedback Amplifier . . . . . . . . . . . . . . . . . . . . . . . . . . . Calculation of Input Impedance of the Feedback Amplifier . . . . . . . . . . . . . . . . . . . . . . . . . . . . Calculation of Feedback Factor and Percent change in overall Gain . . . . . . . . . . . . . . . . . . . . . . . . Calculate Frequency of Oscillation of Tuned Collector Oscillator . . . . . . . . . . . . . . . . . . . . . . . . . Calculate Frequency of Oscillation of Phase Shift Oscillator . . . . . . . . . . . . . . . . . . . . . . . . . . . . Calculate Frequency of Oscillation of Wein Bridge Oscillator . . . . . . . . . . . . . . . . . . . . . . . . . . Caculation of Series Resistance for coversion to Voltmeter Calculation of Shunt Resistance . . . . . . . . . . . . . Designing of a Universal Shunt for making a Multi Range Milliammeter . . . . . . . . . . . . . . . . . . . . . . . Determination of Peak and RMS AC Voltage . . . . . Determination of Magnitude and Frequency of Voltage Fed to Y Input . . . . . . . . . . . . . . . . . . . . . . 6 59 59 60 61 62 62 63 64 64 65 67 67 68 69 69 71 71 72 73 74 74 76 76 List of Figures 6.1 6.2 Dynamic Plate Resistance of the Diode Determination . . . Plotting of Static Plate Characteristics . . . . . . . . . . . . 26 27 9.1 To Plot the Frequency Response Curve . . . . . . . . . . . . 53 14.1 Determination of Magnitude and Frequency of Voltage Fed to Y Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 7 Chapter 1 INTRODUCTION TO ELECTRONICS Scilab code Exa 1.1 Resistor Range Calculation using Colour Band Sequence 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 // Example 1 . 1 // Program t o f i n d Range o f a R e s i s t o r s o a s t o s a t i s f y manufacturer ’ s Tolerances // C o l o u r Band S e q u e n c e : YELLOW, VIOLET , ORANGE, GOLD clear ; clc ; close ; A =4; //NUMERICAL CODE FOR BAND YELLOW B =7; //NUMERICAL CODE FOR BAND VIOLET C =3; //NUMERICAL CODE FOR BAND ORANGE D =5; //TOLERANCE VALUE FOR BAND GOLD i . e . 5% // R e s i s t o r V a l u e C a l c u l a t i o n R =( A *10+ B ) *10^ C ; // T o l e r a n c e V a l u e C a l u l a t i o n T = D * R /100; R1 =R - T ; R2 = R + T ; // D i s p l a y i n g The R e s u l t s i n Command Window 8 printf ( ” \n\n\ t R e s i s t o r V a l u e i s %f kOhms +− %f p e r c e n t . ” ,R /1000 , D ) ; 19 printf ( ” \n\n\ t R e s i s t o r V a l u e i s %f kOhms +− %f kOhms . ” ,R /1000 , T /1000) ; 20 printf ( ” \n\n\ t Range o f V a l u e s o f t h e R e s i s t o r i s %f kOhms & %f kOhms . ” , R1 /1000 , R2 /1000) ; 18 Scilab code Exa 1.2 Resistor Range Calculation using Colour Band Sequence 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 // Example 1 . 2 // Program t o f i n d Range o f a R e s i s t o r s o a s t o s a t i s f y manufacturer ’ s Tolerances // C o l o u r Band S e q u e n c e : GRAY, BLUE, GOLD, GOLD clear ; clc ; close ; A =8; //NUMERICAL CODE FOR BAND GRAY B =6; //NUMERICAL CODE FOR BAND BLUE C = -1; //NUMERICAL CODE FOR BAND GOLD D =5; //TOLERANCE VALUE FOR BAND GOLD i . e . 5% // R e s i s t o r V a l u e C a l c u l a t i o n R =( A *10+ B ) *10^ C ; // T o l e r a n c e V a l u e C a l u l a t i o n T = D * R /100; R1 =R - T ; R2 = R + T ; // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\n\ t R e s i s t o r V a l u e i s %f Ohms +− %f p e r c e n t . ” ,R , D ) ; printf ( ” \n\n\ t R e s i s t o r V a l u e i s %f Ohms +− %f Ohms . ” ,R , T ) ; printf ( ” \n\n\ t Range o f V a l u e s o f t h e R e s i s t o r i s %f Ohms & %f Ohms . ” ,R1 , R2 ) ; 9 Chapter 2 CURRENT AND VOLTAGE SOURCES Scilab code Exa 2.1 Equivalent Current Source Representation 1 2 3 4 5 6 7 8 9 10 11 12 13 // Example 2 . 1 // Program t o O b t a i n E q u i v a l e n t C u r r e n t S o u r c e R e p r e s e n t a i o n from Given V o l t a g e S o u r c e Representation clear ; clc ; close ; // V o l t a g e S o u r c e o r Thevenin ’ s R e p r e s e n t a i o n ( S e r i e s Voltage Source & R e s i s t o r ) Vs =2; // V o l t s Rs =1; //Ohm // C u r r e n t S o u r c e o r Norton ’ s R e p r e s e n t a i o n ( P a r a l l e l Current Source & R e s i s t o r ) Is = Vs / Rs ; // Amperes // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\n\ t The S h o r t C i r c u i t C u r r e n t V a l u e i s %f Amperes . ” , Is ) ; printf ( ” \n\n\ t The S o u r c e I m p e d e n c e V a l u e i s %f Ohm . ” , Rs ) ; 10 14 printf ( ” \n\n\ t The C u r r e n t S o u r c e & S o u r c e Impedance a r e connected i n P a r a l l e l . ”); Scilab code Exa 2.2 Equivalent Voltage Source Representation 1 2 3 4 5 6 7 8 9 10 11 12 13 14 // Example 2 . 2 // Program t o O b t a i n E q u i v a l e n t V o l t a g e S o u r c e R e p r e s e n t a i o n from Given C u r r e n t S o u r c e Representation clear ; clc ; close ; // C u r r e n t S o u r c e o r Norton ’ s R e p r e s e n t a i o n ( P a r a l l e l Current Source & R e s i s t o r ) Is =0.2; // Amperes Zs =100; //Ohms // V o l t a g e S o u r c e o r Thevenin ’ s R e p r e s e n t a i o n ( S e r i e s Voltage Source & R e s i s t o r ) Vs = Is * Zs ; // V o l t s // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\n\ t The Open C i r c u i t V o l t a g e i s %f V o l t s . ” , Vs ) ; printf ( ” \n\n\ t The S o u r c e I m p e d e n c e V a l u e i s %f Ohms . ” , Zs ) ; printf ( ” \n\n\ t The V o l t a g e S o u r c e & S o u r c e Impedance a r e connected i n S e r i e s . ”); Scilab code Exa 2.3 Current Determination using Voltage Source and Current Source Representations 1 2 // Example 2 . 3 // Program t o C a l c u l a t e C u r r e n t i n a Branch by U s i n g Current Source Representation 11 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 // V e r i f y t h e C i r c u i t ’ s R e s u l t f o r i t s e q u i v a l e n c e with Voltage Source R e p r e s e n t a t i o n clear ; clc ; close ; // Given C i r c u i t Data Is =1.5*10^( -3) ; // Amperes Zs =2*10^3; //Ohms Z1 =10*10^3; //Ohms Z2 =40*10^3; //Ohms // C a l c u l a t i o n f o r C u r r e n t S o u r c e R e p r e s e n t a t i o n Zl = Z1 * Z2 /( Z1 + Z2 ) ; I2 = Is * Zs /( Zs + Zl ) ; I4I = I2 * Z1 /( Z1 + Z2 ) ; // U s i n g C u r r e n t D i v i d e r Rule // C a l c u l a t i o n f o r C u r r e n t S o u r c e R e p r e s e n t a t i o n Vs = Is * Zs ; // Open C i r c u i t V o l a t g e I = Vs /( Zs + Zl ) ; I4V = I * Z1 /( Z1 + Z2 ) ; // U s i n g C u r r e n t D i v i d e r Rule // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\n\ t The Load C u r r e n t u s i n g C u r r e n t S o u r c e R e p r e s e n t a i o n i s I 4 I = %f Amperes . ” , I4I ) ; printf ( ” \n\n\ t The Load C u r r e n t u s i n g V o l t a g e S o u r c e R e p r e s e n t a i o n i s I4V = %f Amperes . ” , I4V ) ; if I4I == I4V then printf ( ” \n\n\ t Both R e s u l t s a r e E q u i v a l e n t . ” ) ; else printf ( ” \n\n\ t Both R e s u l t s a r e Not E q u i v a l e n t . ” ) ; end ; Scilab code Exa 2.4 Output Voltage Determination // Example 2 . 4 // Program t o O b t a i n Output V o l t a g e Vo from Given A . C . E q u i v a l e n t o f an A m p l i f i e r u s i n g a T r a n s i s t o r 3 clear ; 1 2 12 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 clc ; close ; // Given C i r c u i t Data // I n p u t S i d e Vs =10*10^( -3) ; // i . e . 10 mV Rs =1*10^3; // i . e . 1 kOhms // Output S i d e Ro1 =20*10^3; // i . e . 20 kOhms Ro2 =2*10^3; // i . e . 2 kOhms // C a l c u l a t i o n i = Vs / Rs ; // I n p u t C u r r e n t Io =100* i ; // Output C u r r e n t Il = Io * Ro1 /( Ro1 + Ro2 ) ; // U s i n g C u r r e n t D i v i d e r Rule Vo = Il * Ro2 ; // Output V o l a t g e // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The Output V o l t a g e Vo = %f V o l t s . ” , Vo ) ; 13 Chapter 4 SEMICONDUCTOR DIODE Scilab code Exa 4.1 DC Voltage and PIV Calculation 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 // Example 4 . 1 // Program t o d e t e r m i n e DC V o l t a g e a c r o s s t h e l o a d and PIV o f t h e Diode clear ; clc ; close ; // Given C i r c u i t Data Vrms =220; // V o l t s n2 =1; // Assumption n1 =12* n2 ; // Turns R a t i o // C a l c u l a t i o n Vp = sqrt (2) * Vrms ; //Maximum ( Peak ) Primary V o l t a g e Vm = n2 * Vp / n1 ; //Maximum S e c o n d a r y V o l t a g e Vdc = Vm / %pi ; //DC l o a d V o l t a g e // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The DC l o a d V o l t a g e i s = %f V . ” , Vdc ) ; printf ( ” \n\ t The Peak I n v e r s e V o l t a g e ( PIV ) i s = %f V . ” , Vm ) ; 14 Scilab code Exa 4.2 DC Voltage and PIV Calculation 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 // Example 4 . 2 // Program t o d e t e r m i n e DC V o l t a g e a c r o s s t h e l o a d and PIV o f t h e // C e n t r e Tap R e c t i f i e r and B r i d g e R e c t i f i e r clear ; clc ; close ; // Given C i r c u i t Data Vrms =220; // V o l t s n2 =1; // Assumption n1 =12* n2 ; // Turns R a t i o // C a l c u l a t i o n Vp = sqrt (2) * Vrms ; //Maximum ( Peak ) Primary V o l t a g e Vm = n2 * Vp / n1 ; //Maximum S e c o n d a r y V o l t a g e Vdc =2* Vm / %pi ; //DC l o a d V o l t a g e // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The DC l o a d V o l t a g e i s = %f V . ” , Vdc ) ; printf ( ” \n\ t The Peak I n v e r s e V o l t a g e ( PIV ) o f B r i d g e R e c t i f i e r i s = %f V . ” , Vm ) ; printf ( ” \n\ t The Peak I n v e r s e V o l t a g e ( PIV ) o f C e n t r e −t a p R e c t i f i e r i s = %f V . ” ,2* Vm ) ; Scilab code Exa 4.3.a Peak Value of Current Calculation 1 2 3 4 5 6 7 8 9 // Example 4 . 3 ( a ) // Program t o d e t e r m i n e t h e Peak V a l u e o f C u r r e n t clear ; clc ; close ; // Given C i r c u i t Data Rl =1*10^(3) ; //Ohms rd =10; //Ohms Vm =220; // V o l t s ( Peak V a l u e o f V o l t a g e ) 15 10 // C a l c u l a t i o n 11 Im = Vm /( rd + Rl ) ; // Peak V a l u e o f C u r r e n t 12 // D i s p l a y i n g The R e s u l t s i n Command Window 13 printf ( ” \n\ t The Peak V a l u e o f C u r r e n t i s = %f mA . ” , Im /10^( -3) ) ; Scilab code Exa 4.3.b DC or Average Value of Current Calculation 1 2 3 4 5 6 7 8 9 10 11 12 13 14 // Example 4 . 3 ( b ) // Program t o d e t e r m i n e t h e DC o r A v e r a g e V a l u e o f Current clear ; clc ; close ; // Given C i r c u i t Data Rl =1*10^(3) ; //Ohms rd =10; //Ohms Vm =220; // V o l t s ( Peak V a l u e o f V o l t a g e ) // C a l c u l a t i o n Im = Vm /( rd + Rl ) ; // Peak V a l u e o f C u r r e n t Idc =2* Im / %pi ; //DC V a l u e o f C u r r e n t // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The DC o r A v e r a g e V a l u e o f C u r r e n t i s = %f mA . ” , Idc /10^( -3) ) ; Scilab code Exa 4.3.c RMS Value of Current Calculation 1 // Example 4 . 3 ( c ) 2 // Program t o d e t e r m i n e t h e RMS V a l u e o f C u r r e n t 3 clear ; 4 clc ; 5 close ; 6 // Given C i r c u i t Data 16 7 8 9 10 11 12 13 14 Rl =1*10^(3) ; //Ohms rd =10; //Ohms Vm =220; // V o l t s ( Peak V a l u e o f V o l t a g e ) // C a l c u l a t i o n Im = Vm /( rd + Rl ) ; // Peak V a l u e o f C u r r e n t Irms = Im / sqrt (2) ; //RMS V a l u e o f C u r r e n t // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The RMS V a l u e o f C u r r e n t i s = %f mA . ” , Irms /10^( -3) ) ; Scilab code Exa 4.3.d Ripple Factor Determination 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 // Example 4 . 3 ( d ) // Program t o d e t e r m i n e t h e R i p p l e F a c t o r o f C e n t r e − t a p F u l l Wave R e c t i f i e r clear ; clc ; close ; // Given C i r c u i t Data Rl =1*10^(3) ; //Ohms rd =10; //Ohms Vm =220; // V o l t s ( Peak V a l u e o f V o l t a g e ) // C a l c u l a t i o n Im = Vm /( rd + Rl ) ; // Peak V a l u e o f C u r r e n t Idc =2* Im / %pi ; //DC V a l u e o f C u r r e n t Irms = Im / sqrt (2) ; //RMS V a l u e o f C u r r e n t r = sqrt (( Irms / Idc ) ^2 -1) // R i p p l e F a c t o r // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The R i p p l e F a c t o r r = %f . ” ,r ) ; Scilab code Exa 4.3.e Rectification Efficiency Calculation 1 // Example 4 . 3 ( e ) 17 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 // Program t o d e t e r m i n e t h e R e c t i f i c a t i o n E f f i c i e n c y o f C e n t r e −t a p F u l l Wave R e c t i f i e r clear ; clc ; close ; // Given C i r c u i t Data Rl =1*10^(3) ; //Ohms rd =10; //Ohms Vm =220; // V o l t s ( Peak V a l u e o f V o l t a g e ) // C a l c u l a t i o n Im = Vm /( rd + Rl ) ; // Peak V a l u e o f C u r r e n t Idc =2* Im / %pi ; //DC V a l u e o f C u r r e n t Irms = Im / sqrt (2) ; //RMS V a l u e o f C u r r e n t Pdc = Idc ^2* Rl ; Pac = Irms ^2*( rd + Rl ) ; n = Pdc / Pac ; // R e c t i f i c a t i o n E f f i c i e n c y // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The R e c t i f i c a t i o n E F f i c i e n c y n ( e e t a ) = %f p e r c e n t . ” ,n *100) ; Scilab code Exa 4.4 Maximum Permissible Current Determination 1 2 3 4 5 6 7 8 9 10 11 12 // Example 4 . 4 // Program t o d e t e r m i n e Maximum C u r r e n t t h e Given Z e n e r Diode can h a n d l e clear ; clc ; close ; // Given C i r c u i t Data Vz =9.1; // V o l t s P =364*10^( -3) ; // Watts // C a l c u l a t i o n Iz = P / Vz ; // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The Maximum p e r m i s s i b l e C u r r e n t i s I z ( 18 max ) = %f mA . ” , Iz /10^( -3) ) ; Scilab code Exa 4.5 Capacitance Determination on changing Bias Voltage 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 // Example 4 . 5 // Program t o d e t e r m i n e C a p a c i t a n c e o f V a r a c t o r Diode i f the // R e v e r s e −B i a s V o l t a g e i s i n c r e a s e d from 4V t o 8V clear ; clc ; close ; // Given C i r c u i t Data Ci =18*10^( -12) ; // i . e . 18 pF Vi =4; // V o l t s Vf =8; // V o l t s // C a l c u l a t i o n K = Ci * sqrt ( Vi ) ; Cf = K / sqrt ( Vf ) ; // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The F i n a l V a l u e o f C a p a c i t a n c e i s C = %f pF . ” , Cf /10^( -12) ) ; 19 Chapter 5 TRANSISTORS Scilab code Exa 5.1 Collector and Base Currents Calculation // Example 5 . 1 // Program t o C a l c u l a t e C o l l e c t o r and Base C u r r e n t s clear ; clc ; close ; // Given C i r c u i t Data alpha =0.98; // a l p h a ( dc ) Ico =1*10^( -6) ; // Ampere Ie =1*10^( -3) ; // Ampere // C a l c u l a t i o n Ic = alpha * Ie + Ico ; // C o l l e c t o r C u r r e n t Ib = Ie - Ic ; // Base C u r r e n t // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The C o l l e c t o r C u r r e n t i s I c= %f mA . ” , Ic /10^( -3) ) ; 15 printf ( ” \n\ t The Base C u r r e n t i s I b= %f uA . ” , Ib /10^( -6) ) ; 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Scilab code Exa 5.2 Dynamic Input Resistance Determination 20 1 2 3 4 5 6 7 8 9 10 11 12 // Example 5 . 2 // Program t o D e t e r m i n e Dynamic I n p u t R e s i s t a n c e o f t h e T r a n s i s t o r a t // t h e p o i n t : I e =0.5 mA and Vcb= −10 V . clear ; clc ; close ; // From t h e I n p u t C h a r a c t e r i s t i c s dIe =(0.7 -0.3) *10^( -3) ; //A dVeb =(0.7 -0.62) ; //V // C a l c u l a t i o n ri = dVeb / dIe ; // Dynamic I n p u t R e s i s t a n c e a t Vcb= −10 V // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The Dynamic I n p u t R e s i s t a n c e i s r i = %f Ohms . ” , ri ) ; Scilab code Exa 5.3 Short Circuit Current Gain Determination 1 2 3 4 5 6 7 8 9 10 11 12 // Example 5 . 3 // Program t o D e t e r m i n e S h o r t C i r c u i t C u r r e n t Gain o f the Tr a n s is t o r clear ; clc ; close ; // Given Data dIe =1*10^( -3) ; //A dIc =0.99*10^( -3) ; //A // C a l c u l a t i o n hfb = dIc / dIe ; // S h o r t C i r c u i t C u r r e n t Gain // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The S h o r t C i r c u i t C u r r e n t Gain i s a l p h a o r h f b= %f . ” , hfb ) ; 21 Scilab code Exa 5.4.a Common Base Short Circuit Current Gain Calculation 1 2 3 4 5 6 7 8 9 10 11 12 13 // Example 5 . 4 ( a ) // Program t o D e t e r m i n e Common Base S h o r t C i r c u i t C u r r e n t Gain ( a l p h a ) // o f t h e T r a n s i s t o r clear ; clc ; close ; // Given Data dIe =1*10^( -3) ; //A dIc =0.995*10^( -3) ; //A // C a l c u l a t i o n alpha = dIc / dIe ; //Common Base S h o r t C i r c u i t C u r r e n t Gain // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The Common Base S h o r t C i r c u i t C u r r e n t Gain i s a l p h a= %f . ” , alpha ) ; Scilab code Exa 5.4.b Common Emitter Short Circuit Current Gain Calculation 1 2 3 4 5 6 7 8 // Example 5 . 4 ( b ) // Program t o D e t e r m i n e Common E m i t t e r S h o r t C i r c u i t C u r r e n t Gain ( b e e t a ) // o f t h e T r a n s i s t o r clear ; clc ; close ; // Given Data dIe =1*10^( -3) ; //A 22 9 dIc =0.995*10^( -3) ; //A 10 // C a l c u l a t i o n 11 alpha = dIc / dIe ; //Common Base S h o r t C i r c u i t C u r r e n t Gain beeta = alpha /(1 - alpha ) ; //Common E m i t t e r S h o r t C i r c u i t C u r r e n t Gain 13 // D i s p l a y i n g The R e s u l t s i n Command Window 14 printf ( ” \n\ t The Common E m i t t e r S h o r t C i r c u i t C u r r e n t Gain i s b e e t a= %f . ” , beeta ) ; 12 Scilab code Exa 5.5 DC Current Gain in Common Base Configuration 1 2 3 4 5 6 7 8 9 10 11 // Example 5 . 5 // Program t o D e t e r m i n e DC C u r r e n t Gain i n Common Base C o n f i g u r a t i o n clear ; clc ; close ; // Given Data Beeta =100; // C a l c u l a t i o n Alpha = Beeta /( Beeta +1) ; //DC C u r r e n t Gain i n Common Base C o n f i g u r a t i o n // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The DC C u r r e n t Gain i n Common Base C o n f i g u r a t i o n i s Alpha= %f . ” , Alpha ) ; Scilab code Exa 5.6 Determination of Dynamic Output Resistance and AC and DC Current Gains 1 2 // Example 5 . 6 // R e f e r F i g u r e 5 . 2 0 i n t h e Textbook 23 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 // Program t o D e t e r m i n e t h e Dynamic Output R e s i s t a n c e , //DC C u r r e n t Gain & AC C u r r e n t Gain from g i v e n output c h a r a c t e r i s t i c s clear ; clc ; close ; // Given Data Vce =10; //V Ib =30*10^( -6) ; //A // C a l c u l a t i o n from Given Output C h a r a c t e r i s t i c s a t I b = 30uA dVce =(12.5 -7.5) ; //V dic =(3.7 -3.5) *10^( -3) ; //A Ic =3.6*10^( -3) ; //A ro = dVce / dic ; // Dynamic Output R e s i s t a n c e Beeta_dc = Ic / Ib ; // DC C u r r e n t Gain Beeta_ac =((4.7 -3.6) *10^( -3) ) /((40 -30) *10^( -6) ) ; //AC C u r r e n t Gain , From Graph , Bac=d e l t a ( i c ) / d e l t a ( i b ) f o r g i v e n Vce // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t Dynamic Output R e s i s t a n c e , r o = %f kOhms” , ro /10^(3) ) ; printf ( ” \n\ t DC C u r r e n t Gain , Bdc = %f ” , Beeta_dc ) ; printf ( ” \n\ t AC C u r r e n t Gain , Bac = %f ” , Beeta_ac ) ; Scilab code Exa 5.7 Q Point Determination // Example 5 . 7 // R e f e r F i g u r e 5 . 2 7 i n t h e Textbook // Program t o D e t e r m i n e t h e Q p o i n t from g i v e n collector characteristics 4 clear ; 5 clc ; 6 close ; 1 2 3 24 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 // Given Data Vcc =12; //V Rc =1*10^(3) ; //Ohms Vbb =10.7; //V Rb =200*10^(3) ; //Ohms Vbe =0.7; //V // C a l c u l a t i o n Ib =( Vbb - Vbe ) / Rb ; // V a l u e o f I b comes o u t t o be 50uA . A d o t t e d Curve i s drawn f o r // I b =40uA and I b =60uA . At t h e P o i n t o f I n t e r s e c t i o n : Vce =6; //V Ic =6*10^( -3) ; //A // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t Q p o i n t : \n\n\ t I b = %f uA” , Ib /10^( -6) ) ; printf ( ” \n\ t Vce = %f V” , Vce ) ; printf ( ” \n\ t I c = %f mA” , Ic /10^( -3) ) ; Scilab code Exa 5.8 Calculation of Dynamic Drain Resistance of JFET 1 2 3 4 5 6 7 8 9 10 11 12 // Example 5 . 8 // Program t o C a l c u l a t e Dynamic D r a i n R e s i s t a n c e o f JFET clear ; clc ; close ; // Given Data u =80; // A m p l i f i c a t i o n F a c t o r gm =200*10^( -6) ; // S , T r a n s c o n d u c t a n c e // C a l c u l a t i o n rd = u / gm ; // Dynamic D r a i n R e s i s t a n c e // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The Dynamic D r a i n R e s i s t a n c e o f JFET i s r d= %f kOhms . ” , rd /10^(3) ) ; 25 26 Chapter 6 VACUUM TUBES Scilab code Exa 6.1 Dynamic Plate Resistance of the Diode Determination 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 // Example 6 . 1 // Program t o P l o t t h e C h a r a c t e r i s t i c s and // D e t e r m i n e Dynamic P l a t e R e s i s t a n c e clear ; clc ; close ; // Given C i r c u i t Data V =[0 0.5 1 1.5 2]; //V I =[0 1.6 4 6.7 9.8]; //mA // P l o t t i n g plot (V , I ) ; a = gca () ; xlabel ( ’ P l a t e V o l t a g e ( i n V) ’ ) ; ylabel ( ’ P l a t e C u r r e n t ( i n mA) ’ ) ; title ( ’ STATIC CHARACTERISTIC CURVE OF THE DIODE ’ ) ; // C a l c u l a t i o n // V a l u e s from C h a r a c t e r i s t i c P l o t dVp =0.5; //V 27 Figure 6.1: Dynamic Plate Resistance of the Diode Determination 28 Figure 6.2: Plotting of Static Plate Characteristics 19 dIp =2.7*10^( -3) ; //A 20 rp = dVp / dIp ; // Dynamic P l a t e R e s i s t a n c e 21 // D i s p l a y i n g The R e s u l t s i n Command Window 22 printf ( ” \n\ t The Dynamic P l a t e R e s i s t a n c e i s r p= %f Ohms . ” , rp ) ; Scilab code Exa 6.2 Plotting of Static Plate Characteristics 1 2 // Example 6 . 2 // Program t o P l o t t h e S t a t i c P l a t e C h a r a c t e r i s t i c s and D e t e r m i n e // P l a t e AC R e s i s t a n c e , Mutual 29 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 Conductance & A m p l i f i c a t i o n Factor clear ; clc ; close ; // Given C i r c u i t Data // A l l V a l u e s E x t r a p o l a t e d t o Touch x−a x i s V0 =[20 50 100 150]; //V V1 =[70 100 150 200]; //V V2 =[112 150 200]; //V V3 =[177 200 250]; //V V4 =[235 250 300]; //V I0 =[0 3.5 11.2 20]; //mA I1 =[0 4 12.4 21.5]; //mA I2 =[0 5.4 14.1]; //mA I3 =[0 3.4 12.4]; //mA I4 =[0 2.5 11.3]; //mA // P l o t t i n g plot ( V0 , I0 ) ; plot ( V1 , I1 ) ; plot ( V2 , I2 ) ; plot ( V3 , I3 ) ; plot ( V4 , I4 ) ; a = gca () ; xlabel ( ’ P l a t e V o l t a g e ( i n V) ’ ) ; ylabel ( ’ P l a t e C u r r e n t ( i n mA) ’ ) ; title ( ’ STATIC PLATE CHARACTERISTIC CURVE OF THE TRIODE ’ ) ; // C a l c u l a t i o n // V a l u e s from C h a r a c t e r i s t i c P l o t dip =(14.0 -10.7) *10^( -3) ; //A dvp =20; //V rp = dvp / dip ; diP =(12.4 -5.3) *10^( -3) ; //A dvG =1; //V gm = diP / dvG ; u = gm * rp ; ut =(192 -150) /1; // D i s p l a y i n g The R e s u l t s i n Command Window 30 printf ( ” \n\ t The P l a t e AC R e s i s t a n c e i s r p= %f kOhms . ” , rp /10^(3) ) ; 40 printf ( ” \n\ t The Mutual C o n d u c t a n c e i s gm= %f mS . ” , gm /10^( -3) ) ; 41 printf ( ” \n\ t The G r a p h i c a l A m p l i f i c a t i o n F a c t o r i s u = %f . ” ,u ) ; 42 printf ( ” \n\ t The T h e o r e t i c a l A m p l i f i c a t i o n F a c t o r i s u t= %f . ” , ut ) ; 39 31 Chapter 7 TRANSISTOR BIASING AND STABILIZATION OF OPERATING POINT Scilab code Exa 7.1 Calculate Ic and Vce for given Circuit 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 // Example 7 . 1 // Program t o C a l c u l a t e // ( a ) C o l l e c t o r C u r r e n t // ( b ) C o l l e c t o r −to −E m i t t e r V o l t a g e clear ; clc ; close ; // Given C i r c u i t Data Vcc =9; //V Rb =300*10^3; //Ohms Rc =2*10^3; //Ohms Beeta =50; // C a l c u l a t i o n Ib =( Vcc ) / Rb ; Ic = Beeta * Ib ; Icsat = Vcc / Rc ; Vce = Vcc - Ic * Rc ; 32 18 19 20 21 22 23 24 25 26 27 28 // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” The d i f f e r e n t P a r a m e t e r s a r e \n\ t I b = %f uA . ” , Ib /10^( -6) ) ; if Ic < Icsat then disp ( ” T r a n s i s t o r i s n o t i n S a t u r a t i o n ” ) ; printf ( ” \n\ t I c = %f mA . ” , Ic /10^( -3) ) ; printf ( ” \n\ t Vce = %f V . ” , Vce ) ; else disp ( ” T r a n s i s t o r i s i n S a t u r a t i o n ” ) ; printf ( ” \n\ t I c = %f mA . ” , Icsat /10^( -3) ) ; printf ( ” \n\ t Vce = %f V . ” ,0) ; end Scilab code Exa 7.2 Calculate coordinates of Operating Point 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 // Example 7 . 2 // Program t o C a l c u l a t e O p e r a t i n g P o i n t C o o r d i n a t e s of the C i r c u i t clear ; clc ; close ; // Given C i r c u i t Data Vcc =10; //V Rb =100*10^3; //Ohms Rc =1*10^3; //Ohms Beeta =60; // C a l c u l a t i o n Ib =( Vcc ) / Rb ; Ic = Beeta * Ib ; Icsat = Vcc / Rc ; Vce = Vcc - Ic * Rc ; // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” The O p e r a t i n g P o i n t C o o r d i n a t e s o f t h e C i r c u i t a r e : \ n\ t I b = %f uA . ” , Ib /10^( -6) ) ; if Ic < Icsat then 33 19 disp ( ” T r a n s i s t o r i s n o t i n S a t u r a t i o n ” ) ; 20 printf ( ” \n\ t I c = %f mA . ” , Ic /10^( -3) ) ; 21 printf ( ” \n\ t Vce = %f V . ” , Vce ) ; 22 else 23 disp ( ” T r a n s i s t o r i s i n S a t u r a t i o n ” ) ; 24 printf ( ” \n\ t I c = %f mA . ” , Icsat /10^( -3) ) ; 25 printf ( ” \n\ t Vce = %f V . ” ,0) ; 26 end Scilab code Exa 7.3 Quiescent Operating Point Determination 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 // Example 7 . 3 // Program t o C a l c u l a t e O p e r a t i n g P o i n t C o o r d i n a t e s of the C i r c u i t clear ; clc ; close ; // Given C i r c u i t Data Vcc =10; //V Rb =100*10^3; //Ohms Rc =1*10^3; //Ohms Beeta =150; // C a l c u l a t i o n Ib =( Vcc ) / Rb ; Ic = Beeta * Ib ; Icsat = Vcc / Rc ; Vce = Vcc - Ic * Rc ; // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” The O p e r a t i n g P o i n t C o o r d i n a t e s o f t h e C i r c u i t a r e : \ n\ t I b = %f uA . ” , Ib /10^( -6) ) ; if Ic < Icsat then disp ( ” T r a n s i s t o r i s n o t i n S a t u r a t i o n ” ) ; printf ( ” \n\ t I c = %f mA . ” , Ic /10^( -3) ) ; printf ( ” \n\ t Vce = %f V . ” , Vce ) ; else 34 23 disp ( ” T r a n s i s t o r i s i n S a t u r a t i o n ” ) ; 24 printf ( ” \n\ t I c = %f mA . ” , Icsat /10^( -3) ) ; 25 printf ( ” \n\ t Vce = %f V . ” ,0) ; 26 end Scilab code Exa 7.4.a Calculate value of Resistance Rb 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 // Example 7 . 4 ( a ) // Program t o C a l c u l a t e V a l u e o f Rb i n t h e B i a s i n g Circuit clear ; clc ; close ; // Given C i r c u i t Data Vcc =6; //V Vbe =0.3; //V Icbo =2*10^( -6) ; //A Ic =1*10^( -3) ; //A Beeta =20; // C a l c u l a t i o n // Case 1 : C o n s i d e r i n g I c b o and Vbe i n t h e calculations Ib =( Ic -( Beeta +1) * Icbo ) / Beeta ; Rb1 =( Vcc - Vbe ) / Ib ; // Case 2 : N e g l e c t i n g I c b o and Vbe i n t h e calculations Ib = Ic / Beeta ; Rb2 = Vcc / Ib ; // P e r c e n t a g e E r r o r E =( Rb2 - Rb1 ) / Rb1 *100; // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The Base R e s i s t a n c e i s , Rb = %f kOhms . ” , Rb1 /10^3) ; printf ( ” \n\ t The Base R e s i s t a n c e ( N e g l e c t i n g I c b o and Vbe ) i s , Rb = %f kOhms . ” , Rb2 /10^3) ; 35 24 printf ( ” \n\ t P e r c e n t a g e E r r o r i s = %f p e r c e n t . ” ,E ) ; Scilab code Exa 7.4.b Calculation of Collector Current Ic 1 // Example 7 . 4 ( b ) 2 // Program t o C a l c u l a t e Rb i n t h e B i a s i n g C i r c u i t 3 clear ; 4 clc ; 5 close ; 6 // Given C i r c u i t Data 7 Icbo =10*10^( -6) ; //A 8 Ib =47.9*10^( -6) ; //A 9 Beeta =25; 10 // C a l c u l a t i o n 11 Ic = Beeta * Ib +( Beeta +1) * Icbo ; 12 // D i s p l a y i n g The R e s u l t s i n Command Window 13 printf ( ” The C o l l e c t o r C u r r e n t i s : ” ) ; 14 printf ( ” \n\ t I c = %f mA . ” , Ic /10^( -3) ) ; Scilab code Exa 7.5 Calculation of Ie and Vc in the Circuit 1 2 3 4 5 6 7 8 9 10 11 12 // Example 7 . 5 // Program t o C a l c u l a t e // ( a ) I e // ( b ) Vc clear ; clc ; close ; // Given C i r c u i t Data Vcc =10; //V Rc =500; //Ohms Rb =500*10^3; //Ohms Beeta =100; 36 13 14 15 16 17 18 19 20 21 22 // C a l c u l a t i o n Ib = Vcc /( Rb + Beeta * Rc ) ; Ic = Beeta * Ib ; Ie = Ic ; Vce = Vcc - Ic * Rc ; Vc = Vce ; // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” The D i f f e r e n t P a r a m e t e r s a r e : ” ) ; printf ( ” \n\ t I e = %f mA . ” , Ie /10^( -3) ) ; printf ( ” \n\ t Vc = %f V . ” , Vc ) ; Scilab code Exa 7.6 Calculate Minimum and Maximum Collector Currents 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 // Example 7 . 6 // Program t o C a l c u l a t e // ( a ) Minimum C o l l e c t o r C u r r e n t // ( b ) Maximum C o l l e c t o r C u r r e n t clear ; clc ; close ; // Given C i r c u i t Data Vcc =20; //V Rc =2*10^3; //Ohms Rb =200*10^3; //Ohms Beeta1 =50; Beeta2 =200; // C a l c u l a t i o n CASE−1: Minimum C o l l e c t o r C u r r e n t Ibmin = Vcc /( Rb + Beeta1 * Rc ) ; Icmin = Beeta1 * Ibmin ; // C a l c u l a t i o n CASE−2: Maximum C o l l e c t o r C u r r e n t Ibmax = Vcc /( Rb + Beeta2 * Rc ) ; Icmax = Beeta2 * Ibmax ; // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The Minimum C o l l e c t o r C u r r e n t I c ( min ) = 37 %f mA . ” , Icmin /10^( -3) ) ; 22 printf ( ” \n\ t The Maximum C o l l e c t o r C u r r e n t I c ( max ) = %f mA . ” , Icmax /10^( -3) ) ; Scilab code Exa 7.7 Calculate Values of the three Currents // Example 7 . 7 // Program t o C a l c u l a t e // ( a ) I b // ( b ) I c // ( c ) I e clear ; clc ; close ; // Given C i r c u i t Data Vcc =10; //V Rc =2*10^3; //Ohms Rb =1*10^6; //Ohms Re =1*10^3; //Ohms Beeta =100; // C a l c u l a t i o n Ib = Vcc /( Rb +( Beeta +1) * Re ) ; Ic = Beeta * Ib ; Ie = Ic + Ib ; // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The C o l l e c t o r C u r r e n t I c = %f mA . ” , Ic /10^( -3) ) ; 21 printf ( ” \n\ t The Base C u r r e n t I b = %f uA . ” , Ib /10^( -6) ) ; 22 printf ( ” \n\ t The E m i t t e r C u r r e n t I e = %f mA . ” , Ie /10^( -3) ) ; 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 38 Scilab code Exa 7.8 Calculate Minimum and Maximum Ie and corresponding Vce 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 // Example 7 . 8 // Program t o C a l c u l a t e // ( a ) Minimum E m i t t e r C u r r e n t & c o r r e s p o n d i n g Vce // ( b ) Maximum E m i t t e r C u r r e n t & c o r r e s p o n d i n g Vce clear ; clc ; close ; // Given C i r c u i t Data Vcc =6; //V Vbe =0.3; //V Rc =50; //Ohms Rb =10*10^3; //Ohms Re =100; //Ohms Beeta1 =50; Beeta2 =200; // C a l c u l a t i o n CASE−1: Minimum E m i t t e r C u r r e n t & c o r r e s p o n d i n g Vce Iemin =( Vcc - Vbe ) *( Beeta1 +1) /( Rb +( Beeta1 +1) * Re ) ; Vcemin = Vcc -( Rc + Re ) * Iemin ; // C a l c u l a t i o e n CASE−2: Maximum E m i t t e r C u r r e n t & c o r r e s p o n d i n g Vce Iemax =( Vcc - Vbe ) *( Beeta2 +1) /( Rb +( Beeta2 +1) * Re ) ; Vcemax = Vcc -( Rc + Re ) * Iemax ; // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The Minimum E m i t t e r C u r r e n t I e ( min ) = %f mA . ” , Iemin /10^( -3) ) ; printf ( ” \n\ t The C o r r e s p o n d i n g Vce = %f V . ” , Vcemin ) ; printf ( ” \n\ t The Maximum E m i t t e r C u r r e n t I e ( max ) = %f mA . ” , Iemax /10^( -3) ) ; printf ( ” \n\ t The C o r r e s p o n d i n g Vce = %f V . ” , Vcemax ) ; 39 Scilab code Exa 7.9 Determine the new Q Points 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 // Example 7 . 9 // Program t o C a l c u l a t e new Q p o i n t s f o r // Minimum and Maximum v a l u e o f B e e t a clear ; clc ; close ; // Given C i r c u i t Data Vcc =6; //V Vbe =0.3; //V Rc =1*10^3; //Ohms Rb =10*10^3; //Ohms Re =100; //Ohms Beeta1 =50; Beeta2 =200; // C a l c u l a t i o n CASE−1: Minimum E m i t t e r C u r r e n t & c o r r e s p o n d i n g Vce Iemin =( Vcc - Vbe ) *( Beeta1 +1) /( Rb +( Beeta1 +1) * Re ) ; Icmin = Iemin ; Vcemin = Vcc -( Rc + Re ) * Iemin ; // C a l c u l a t i o e n CASE−2: Maximum E m i t t e r C u r r e n t & c o r r e s p o n d i n g Vce Iemax =( Vcc - Vbe ) *( Beeta2 +1) /( Rb +( Beeta2 +1) * Re ) ; Icmax = Iemax ; Vcemax = Vcc -( Rc + Re ) * Iemax ; // D i s p l a y i n g The R e s u l t s i n Command Window Icsat = Vcc /( Rc + Re ) ; // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” For B e e t a =50 : \ n\ t ” ) ; if Icmin < Icsat then disp ( ” T r a n s i s t o r i s n o t i n S a t u r a t i o n ” ) ; printf ( ” \n\ t I c = %f mA . ” , Icmin /10^( -3) ) ; printf ( ” \n\ t Vc = %f V . ” , Vce ) ; 40 31 else 32 disp ( ” T r a n s i s t o r i s i n S a t u r a t i o n ” ) ; 33 printf ( ” \n\ t I c ( s a t ) = %f mA . ” , Icsat /10^( -3) ) ; 34 printf ( ” \n\ t Vc ( s a t ) = %f V . ” ,0) ; 35 end 36 printf ( ” \ nFor B e e t a =200 : \ n\ t ” ) ; 37 if Icmax < Icsat then 38 disp ( ” T r a n s i s t o r i s n o t i n S a t u r a t i o n ” ) ; 39 printf ( ” \n\ t I c = %f mA . ” , Icmax /10^( -3) ) ; 40 printf ( ” \n\ t Vc = %f V . ” , Vce ) ; 41 else 42 disp ( ” T r a n s i s t o r i s i n S a t u r a t i o n ” ) ; 43 printf ( ” \n\ t I c ( s a t ) = %f mA . ” , Icsat /10^( -3) ) ; 44 printf ( ” \n\ t Vc ( s a t ) = %f V . ” ,0) ; 45 end Scilab code Exa 7.10 Calculate the value of Rb 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 // Example 7 . 1 0 // Program t o C a l c u l a t e Rb i n t h e B i a s i n g C i r c u i t clear ; clc ; close ; // Given C i r c u i t Data Vcc =9; //V Vce =3; //V Re =500; //Ohms Ic =8*10^( -3) ; //A Beeta =80; // C a l c u l a t i o n Ib = Ic / Beeta ; Rb =( Vcc -( Beeta +1) * Ib * Re ) / Ib ; // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” The Base R e s i s t a n c e i s : ” ) ; printf ( ” \n\ t Rb = %f kOhms . ” , Rb /10^3) ; 41 Scilab code Exa 7.11 Calculate DC bias Voltages and Currents 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 // Example 7 . 1 1 // Program t o C a l c u l a t e DC B i a s V o l t a g e s and C u r r e n t s clear ; clc ; close ; // Given C i r c u i t Data Vcc =12; //V Vbe =0.3; //V R1 =40*10^3; //Ohms R2 =5*10^3; //Ohms Re =1*10^3; //Ohms Rc =5*10^3; //Ohms Beeta =60; // C a l c u l a t i o n Vb =( R2 /( R1 + R2 ) ) * Vcc ; Ve = Vb - Vbe ; Ie = Ve / Re ; Ic = Ie ; Vc = Vcc - Ic * Rc ; Vce = Vc - Ve ; // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” The D i f f e r e n t P a r a m e t e r s a r e : ” ) ; printf ( ” \n\ t Vb = %f V . ” , Vb ) ; printf ( ” \n\ t Ve = %f V . ” , Ve ) ; printf ( ” \n\ t I e = %f mA . ” , Ie /10^( -3) ) ; printf ( ” \n\ t I c = %f mA . ” , Ic /10^( -3) ) ; printf ( ” \n\ t Vc = %f V . ” , Vc ) ; printf ( ” \n\ t Vce = %f V . ” , Vce ) ; Scilab code Exa 7.12 Calculate Re and Vce in the Circuit 42 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 // Example 7 . 1 2 // Program t o C a l c u l a t e Re and Vce o f t h e g i v e n Circuit Specifications clear ; clc ; close ; // Given C i r c u i t Data Vcc =15; //V R1 =200; //Ohms R2 =100; //Ohms Rc =20; //Ohms Ic =100*10^( -3) ; //A // C a l c u l a t i o n Ie = Ic ; Vb =( R2 /( R1 + R2 ) ) * Vcc ; Ve = Vb ; // N e g l e c t i n g Vbe Re = Ve / Ie ; Vce = Vcc -( Rc + Re ) * Ic ; // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The E m i t t e r R e s i s t a n c e i s Re = %f Ohms . ” , Re ) ; printf ( ” \n\ t The C o l l e c t o r t o E m i t t e r V o l t a g e i s Vce = %f V . ” , Vce ) ; Scilab code Exa 7.13 Calculate Ic and Vce for given Circuit 1 2 3 4 5 6 7 8 // Example 7 . 1 3 // / Program t o C a l c u l a t e I c and Vce o f t h e g i v e n Circuit Specifications clear ; clc ; close ; // Given C i r c u i t Data Vcc =12; //V Vbe =0.3; //V 43 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 R1 =40*10^3; //Ohms R2 =5*10^3; //Ohms Re =1*10^3; //Ohms Rc =5*10^3; //Ohms Beeta =60; // C a l c u l a t i o n Vth =( R2 /( R1 + R2 ) ) * Vcc ; Rth = R1 * R2 /( R1 + R2 ) ; Ib =( Vth - Vbe ) /( Rth + Beeta * Re ) ; Ic = Beeta * Ib ; Vce = Vcc - Ic *( Rc + Re ) ; // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” The D i f f e r e n t P a r a m e t e r s a r e : ” ) ; printf ( ” \n\ t I c = %f mA . ” , Ic /10^( -3) ) ; printf ( ” \n\ t Vce = %f V . ” , Vce ) ; Scilab code Exa 7.14 Calculate Ic and Vce for given Circuit 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 // Example 7 . 1 4 // Program t o C a l c u l a t e // ( a ) I c // ( b ) Vce clear ; clc ; close ; // Given C i r c u i t Data Vcc =12; //V Vee =15; //V Rc =5*10^3; //Ohms Re =10*10^3; //Ohms Rb =10*10^3; //Ohms Beeta =100; // C a l c u l a t i o n Ie = Vee / Re ; Ic = Ie ; 44 18 Vce = Vcc - Ic * Rc ; 19 // D i s p l a y i n g The R e s u l t s i n Command Window 20 printf ( ” The P a r a m e t e r s a r e : ” ) ; 21 printf ( ” \n\ t I c = %f mA . ” , Ic /10^( -3) ) ; 22 printf ( ” \n\ t Vce = %f V . ” , Vce ) ; 45 Chapter 8 SMALL SIGNAL AMPLIFIERS Scilab code Exa 8.1 Determination of Hybrid Parameters 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 // Example 8 . 1 // R e f e r F i g u r e 8 . 1 5 and 8 . 1 6 i n t h e Textbook // Program t o f i n d t h e H y b r i d P a r a m e t e r s from t h e given Transistor C h a r a c t e r i s t i c s clear ; clc ; close ; // Given C i r c u i t Data Ic =2*10^( -3) ; //A Vce =8.5; //V // C a l c u l a t i o n // h f e=d e l t a ( i c ) / d e l t a ( i b ) , Vce=c o n s t a n t hfe =(2.7 -1.7) *10^( -3) /((20 -10) *10^( -6) ) ; // hoe=d e l t a ( i c ) / d e l t a ( Vce ) , i b=c o n s t a n t hoe =(2.2 -2.1) *10^( -3) /(10 -7) ; // h i e=d e l t a ( Vbe ) / d e l t a ( i b ) , Vce=c o n s t a n t hie =(0.73 -0.715) /((20 -10) *10^( -6) ) ; // h r e=d e l t a ( Vbe ) / d e l t a ( Vce ) , i b=c o n s t a n t hre =(0.73 -0.72) /(20 -0) ; 46 19 20 21 22 23 24 // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The H y b r i d P a r a m e t e r s a r e : ” ) ; printf ( ” \n\n\ t h f e = %f ” , hfe ) ; printf ( ” \n\ t hoe = %f uS ” , hoe /10^( -6) ) ; printf ( ” \n\ t h i e = %f kOhms” , hie /10^3) ; printf ( ” \n\ t h r e = %f ” , hre ) ; Scilab code Exa 8.2.a Calculation of Input Impedance of Amplifier 1 2 3 4 5 6 7 8 9 10 11 12 // Example 8 . 2 ( a ) // Program t o f i n d t h e I n p u t Impedance o f t h e Amplifier clear ; clc ; close ; // Given C i r c u i t Data ri =2*10^3; //Ohms Rb =150*10^3; //Ohms // C a l c u l a t i o n Zin = Rb * ri /( Rb + ri ) ; // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The I n p u t Impedance o f t h e A m p l i f i e r i s Z i n = %f kOhms . ” , Zin /10^3) ; Scilab code Exa 8.2.b Calculation of Voltage Gain of Amplifier 1 // Example 8 . 2 ( b ) 2 // Program t o f i n d t h e V o l t a g e Gain o f t h e A m p l i f i e r 3 clear ; 4 clc ; 5 close ; 6 // Given C i r c u i t Data 7 Beeta =100; 47 8 ri =2*10^3; //Ohms 9 Rac =5*10^3; //Ohms 10 // C a l c u l a t i o n 11 Av = Beeta * Rac / ri ; 12 // D i s p l a y i n g The R e s u l t s i n Command Window 13 printf ( ” \n\ t The V o l t a g e Gain o f t h e A m p l i f i e r i s Av = %f w i t h p h a s e o f 180 d e g r e e s . ” , Av ) ; Scilab code Exa 8.2.c Calculation of Current Gain of Amplifier 1 2 3 4 5 6 7 8 9 10 11 12 13 // Example 8 . 2 ( c ) // Program t o f i n d t h e C u r r e n t Gain o f t h e A m p l i f i e r clear ; clc ; close ; // Given C i r c u i t Data // L e t i n p u t C u r r e n t i b =2A ib =2 ; //A, Assumption io =100* ib ; // C a l c u l a t i o n Ai = io / ib ; // C u r r e n t Gain // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The C u r r e n t Gain o f t h e A m p l i f i e r i s Ai = %f . ” , Ai ) ; Scilab code Exa 8.3.a Calculation of Voltage Gain of Amplifier 1 // Example 8 . 3 ( a ) 2 // Program t o f i n d t h e V o l t a g e Gain o f t h e A m p l i f i e r 3 clear ; 4 clc ; 5 close ; 6 // Given C i r c u i t Data 48 7 8 9 10 11 12 13 14 15 Bac =150; rin =2*10^3; //Ohms R1 =4.7*10^3; //Ohms R2 =12*10^3; //Ohms // C a l c u l a t i o n Rac = R1 * R2 /( R1 + R2 ) ; Av = Bac * Rac / rin ; // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The V o l t a g e Gain o f t h e A m p l i f i e r i s Av = %f w i t h p h a s e o f 180 d e g r e e s . ” , Av ) ; Scilab code Exa 8.3.b Calculation of Input Impedance of Amplifier 1 2 3 4 5 6 7 8 9 10 11 12 13 // Example 8 . 3 ( b ) // Program t o f i n d t h e I n p u t Impedance o f t h e Amplifier clear ; clc ; close ; // Given C i r c u i t Data rin =2*10^3; //Ohms R3 =75*10^3; //Ohms R4 =7.5*10^3; //Ohms // C a l c u l a t i o n Zin = R3 * R4 * rin /( R3 * R4 + R4 * rin + rin * R3 ) ; // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The I n p u t Impedance o f t h e A m p l i f i e r i s Z i n = %f kOhms . ” , Zin /10^3) ; Scilab code Exa 8.3.c Calculation of Q Point Parameters of Amplifier 1 2 // Example 8 . 3 ( c ) // Program t o f i n d t h e Q P o i n t o f t h e A m p l i f i e r 49 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 clear ; clc ; close ; // Given C i r c u i t Data Vcc =15; //V R1 =75*10^3; //Ohms R2 =7.5*10^3; //Ohms Rc =4.7*10^3; //Ohms Re =1.2*10^3; //Ohms // C a l c u l a t i o n Vb = Vcc * R2 /( R1 + R2 ) ; Ve = Vb ; Ie = Ve / Re ; Vce = Vcc -( Rc + Re ) * Ie ; // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The D i f f e r e n t P a r a m e t e r s o f t h e A m p l i f i e r a r e I e = %f mA and Vce = %f V . ” , Ie /10^( -3) , Vce ) ; Scilab code Exa 8.4 Calculation of Voltage Gain of Amplifier 1 2 3 4 5 6 7 8 9 10 11 12 13 // Example 8 . 4 // Program t o f i n d t h e V o l t a g e Gain o f t h e A m p l i f i e r clear ; clc ; close ; // Given C i r c u i t Data u =20; Rl =10*10^3; //Ohms rp =10*10^3; //Ohms // C a l c u l a t i o n A = u * Rl /( rp + Rl ) ; // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The V o l t a g e Gain o f t h e A m p l i f i e r i s A = %f w i t h p h a s e o f 180 d e g r e e s . ” ,A ) ; 50 Scilab code Exa 8.5 Calculation of Gain of Single Stage Amplifier 1 2 3 4 5 6 7 8 9 10 11 12 13 14 // Example 8 . 5 // Program t o f i n d t h e Gain o f t h e A m p l i f i e r clear ; clc ; close ; // Given C i r c u i t Data gm =3000*10^( -6) ; // S Rl =22*10^3; //Ohms rp =300*10^3; //Ohms // C a l c u l a t i o n //A=−(gm∗ Rl /(1+( Rl / r p ) ) ) , For rp>>Rl we g e t A = gm * Rl ; // w i t h Phase o f 180 d e g r e e s // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The Gain o f t h e A m p l i f i e r i s A = %f w i t h p h a s e o f 180 d e g r e e s . ” ,A ) ; Scilab code Exa 8.6 Calculation of Output Signal Voltage of FET Amplifier 1 2 3 4 5 6 7 8 9 // Example 8 . 6 // Program t o f i n d t h e Output S i g n a l V o l t a g e o f t h e Amplifier clear ; clc ; close ; // Given C i r c u i t Data Rl =12*10^3; //Ohms Rg =1*10^6; //Ohms Rs =1*10^3; //Ohms 51 10 11 12 13 14 15 16 17 18 19 20 21 Cs =25*10^( -6) ; //F u =20; rd =100*10^3; //Ohms vi =0.1; //V f =1*10^3; // Hz // C a l c u l a t i o n Xcs =1/(2* %pi * f * Cs ) ; // As Xcs comes o u t t o be much s m a l l e r t h a n Rs , Rs i s completely bypassed A = u * Rl /( Rl + rd ) ; vo = A * vi ; // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The Output S i g n a l V o l t a g e o f t h e A m p l i f i e r i s vo = %f V . ” , vo ) ; 52 Chapter 9 MULTI STAGE AMPLIFIERS Scilab code Exa 9.1 Calculate overall Voltage Gain in dB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 // Example 9 . 1 // Program t o C a l c u l a t e o v e r a l l V o l t a g e Gain o f a Multistage // A m p l i f i e r i n dB clear ; clc ; close ; // Given Data A1 =30; A2 =50; A3 =80; // C a l c u l a t i o n A = A1 * A2 * A3 ; // V o l t a g e Gain Adb =20* log10 ( A ) ; // V o l t a g e Gain i n dB // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The o v e r a l l V o l t a g e Gain o f t h e M u l t i s t a g e A m p l i f i e r Adb = %f dB” , Adb ) ; Scilab code Exa 9.2 Calculate Voltage at the Output Terminal 53 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 // Example 9 . 2 // Program t o C a l c u l a t e V o l t a g e a t t h e Output Terminal o f //Two S t a g e D i r e c t Coupled A m p l i f i e r clear ; clc ; close ; // Given Data Vcc =30; //V Vi =1.4; //V Vbe =0.7; //V B =300; // B e e t a R1 =27*10^3; //Ohms R2 =680; //Ohms R3 =24*10^3; //Ohms R4 =2.4*10^3; //Ohms // C a l c u l a t i o n Ve = Vi - Vbe ; Ie1 = Vbe / R2 ; Ic1 = Ie1 ; Vc1 = Vcc - Ic1 * R1 ; Vb2 = Vc1 ; Ve2 = Vb2 - Vbe ; Ie2 = Ve2 / R4 ; Ic2 = Ie2 ; Vc2 = Vcc - Ic2 * R3 ; Vo = Vc2 ; // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The V o l t a g e a t t h e Output T e r m i n a l o f Two S t a g e D i r e c t Coupled A m p l i f i e r , Vo = %f V” , Vo ); Scilab code Exa 9.3 To Plot the Frequency Response Curve 54 Figure 9.1: To Plot the Frequency Response Curve 55 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 // Example 9 . 3 // Program t o C a l c u l a t e Gain i n dB a t C u t o f f F r e q u e n c i e s and // P l o t F r e q u e n c y R e s p o n s e Curve clear ; clc ; close ; // Given Data A =100; f1 =400; f2 =25*10^3; f3 =80; f4 =40*10^3; // C a l c u l a t i o n Adb =20* log10 ( A ) ; Adbc = Adb -3; // Lower by 3dB // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The Gain a t C u t o f f F r e q u e n c i e s i s , Adb ( a t C u t o f f F r e q u e n c i e s ) = %f dB” , Adbc ) ; // P l o t t i n g t h e F r e q u e n c y R e s p o n s e Curve x = [ f3 f1 f2 f4 ]; x1 = [1 1 1 1]; y = [ Adbc Adb Adb Adbc ]; gainplot (y , x1 ) ; a = gca () ; a . y_location = ’ l e f t ’ ; a . x_location = ’ bottom ’ ; a . x_label . text = ’ f3 f1 F r e q u e n c y ( Hz ) f2 f4 ’ ; a . y_label . text = ’ AdB 37 ’ ; a . title . text = ’FREQUENCY RESPONSE CURVE ’ ; plot2d (x , y ) ; r = [37 37]; q = [10 100000]; 56 32 plot2d2 (q ,r ,6) ; 33 r2 = [37 40 40 37]; 34 q2 = [ f3 f1 f2 f4 ]; 35 plot2d3 ( q2 , r2 ,6) ; Scilab code Exa 9.4.a Calculate Input Impedance of Two Stage RC Coupled Amplifier 1 2 3 4 5 6 7 8 9 10 11 12 13 14 // Example 9 . 4 ( a ) // Program t o C a l c u l a t e I n p u t Impedance o f t h e g i v e n //Two S t a g e RC Coupled A m p l i f i e r clear ; clc ; close ; // Given Data R1 =5.6*10^3; //Ohms R2 =56*10^3; //Ohms R3 =1.1*10^3; //Ohms // C a l c u l a t i o n Zi = R1 * R2 * R3 /( R1 * R2 + R2 * R3 + R3 * R1 ) ; // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The I n p u t Impedance , Z i = %f kOhms ” , Zi /10^3) ; Scilab code Exa 9.4.b Calculate Ouput Impedance of Two Stage RC Coupled Amplifier 1 // Example 9 . 4 ( b ) 2 // Program t o C a l c u l a t e Output Impedance o f t h e g i v e n 3 //Two S t a g e RC Coupled A m p l i f i e r 4 clear ; 5 clc ; 6 close ; 57 7 // Given Data 8 Ro1 =3.3*10^3; //Ohms 9 Ro2 =2.2*10^3; //Ohms 10 // C a l c u l a t i o n 11 Zo = Ro1 * Ro2 /( Ro1 + Ro2 ) ; 12 // D i s p l a y i n g The R e s u l t s i n Command Window 13 printf ( ” \n\ t The Output Impedance , Zo = %f kOhms ” , Zo /10^3) ; Scilab code Exa 9.4.c Calculate Voltage Gain of Two Stage RC Coupled Amplifier 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 // Example 9 . 4 ( c ) // Program t o V o l t a g e Gain o f t h e g i v e n Two S t a g e RC Coupled A m p l i f i e r clear ; clc ; close ; // Given Data Ro1 =3.3*10^3; //Ohms Ro2 =2.2*10^3; //Ohms hfe =120; hie =1.1*10^3; //Ohms R1 =6.8*10^3; //Ohms R2 =56*10^3; //Ohms R3 =5.6*10^3; //Ohms R4 =1.1*10^3; //Ohms // C a l c u l a t i o n Rac2 = Ro1 * Ro2 /( Ro1 + Ro2 ) ; A2 = - hfe * Rac2 / hie ; Rac1 = R1 * R2 * R3 * R4 /( R1 * R2 * R3 + R2 * R3 * R4 + R1 * R3 * R4 + R1 * R2 * R4 ) ; A1 = - hfe * Rac1 / hie ; A = A1 * A2 ; // O v e r a l l Gain // D i s p l a y i n g The R e s u l t s i n Command Window 58 22 printf ( ” \n\ t The O v e r a l l Gain , A = %f . ” ,A ) ; Scilab code Exa 9.5 Calculate Maximum Voltage Gain and Bandwidth of Triode Amplifier 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 // Example 9 . 5 // Program t o C a l c u l a t e Maximum V o l t a g e Gain & Bandwidth clear ; clc ; close ; // Given Data Rl =10*10^3; //Ohms Rg =470*10^3; //Ohms Cs =100*10^( -12) ; //F u =25; rp =8*10^3; //Ohms Cc =0.01*10^( -6) ; //F // C a l c u l a t i o n gm = u / rp ; Req = rp * Rl * Rg /( rp * Rl + Rl * Rg + Rg * rp ) ; Avm = gm * Req ; Avmd = Avm ^2; // V o l t a g e Gain o f Two S t a g e s Rd =( rp * Rl /( rp + Rl ) ) + Rg ; f1 =1/(2* %pi * Cc * Rd ) ; // Lower C u t o f f F r e q u e n c y f1d = f1 / sqrt ( sqrt (2) -1) ; // Lower C u t o f f F r e q u e n c y o f Two S t a g e s f2 =1/(2* %pi * Cs * Req ) ; // Upper C u t o f f F r e q u e n c y f2d = f2 * sqrt ( sqrt (2) -1) ; // Upper C u t o f f F r e q u e n c y o f Two S t a g e s BW = f2d - f1d ; // Bandwidth // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The V o l t a g e Gain o f Two S t a g e s , Avmd = %f ” , Avmd ) ; printf ( ” \n\ t The Bandwidth , BW = %f kHz ” , BW /10^3) ; 59 60 Chapter 10 POWER AMPLIFIERS Scilab code Exa 10.1 Calculation of Transformer Turns Ratio 1 2 3 4 5 6 7 8 9 10 11 12 // Example 1 0 . 1 // Program t o D e t e r m i n e t h e T r a n s f o r m e r Turns R a t i o clear ; clc ; close ; // Given C i r c u i t Data RL =16; // Ohms RLd =10*10^3; // Ohms // C a l c u l a t i o n N12 = sqrt ( RLd / RL ) ; // N12=N1/N2 // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The T r a n s f o r m e r Turns R a t i o i s N1/N2 = %d : %d . ” ,N12 ,1) ; Scilab code Exa 10.2 Calculation of Effective Resistance seen at Primary 1 2 // Example 1 0 . 2 // Program t o D e t e r m i n e t h e E f f e c t i v e R e s i s t a n c e s e e n looking into 61 3 4 5 6 7 8 9 10 11 12 13 // t h e Primary clear ; clc ; close ; // Given C i r c u i t Data Rl =8; //Ohms N12 =15; // N12=N1/N2 // C a l c u l a t i o n Rld =( N12 ) ^2* Rl ; // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The E f f e c t i v e R e s i s t a n c e s e e n l o o k i n g i n t o t h e Primary , Rld = %f kOhms . ” , Rld /10^3) ; Scilab code Exa 10.3.a Calculation of 2nd 3rd and 4th Harmonic Distortions 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 // Example 1 0 . 3 ( a ) // Program t o D e t e r m i n e t h e Second , T h i r d & F o u r t h Harmonic D i s t o r t i o n s clear ; clc ; close ; // Given C i r c u i t Data // i o =15∗ s i n ( 6 0 0 ∗ t ) +1.5∗ s i n ( 1 2 0 0 ∗ t ) +1.2∗ s i n ( 1 8 0 0 ∗ t ) +0.5∗ s i n ( 2 4 0 0 ∗ t ) I1 =15; I2 =1.5; I3 =1.2; I4 =0.5; // C a l c u l a t i o n D2 =( I2 / I1 ) *100; D3 =( I3 / I1 ) *100; D4 =( I4 / I1 ) *100; // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The S e c o n d Harmonic D i s t o r t i o n i s , D2 = 62 %f p e r c e n t . ” , D2 ) ; 18 printf ( ” \n\ t The T h i r d Harmonic D i s t o r t i o n i s , D3 = %f p e r c e n t . ” , D3 ) ; 19 printf ( ” \n\ t The F o u r t h Harmonic D i s t o r t i o n i s , D4 = %f p e r c e n t . ” , D4 ) ; Scilab code Exa 10.3.b Percentage Increase in Power because of Distortion 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 // Example 1 0 . 3 ( b ) // Program t o D e t e r m i n e t h e P e r c e n t a g e I n c r e a s e i n Power b e c a u s e o f D i s t o r t i o n clear ; clc ; close ; P1 = poly (0 , ”P1” ) ; // Given C i r c u i t Data // i o =15∗ s i n ( 6 0 0 ∗ t ) +1.5∗ s i n ( 1 2 0 0 ∗ t ) +1.2∗ s i n ( 1 8 0 0 ∗ t ) +0.5∗ s i n ( 2 4 0 0 ∗ t ) I1 =15; I2 =1.5; I3 =1.2; I4 =0.5; // C a l c u l a t i o n D2 =( I2 / I1 ) *100; D3 =( I3 / I1 ) *100; D4 =( I4 / I1 ) *100; D = sqrt ( D2 ^2+ D3 ^2+ D4 ^2) ; // D i s t o r t i o n F a c t o r P =(1+( D /100) ^2) * P1 ; Pi =(( P - P1 ) / P1 ) *100; // D i s p l a y i n g The R e s u l t s i n Command Window disp ( Pi , ” The P e r c e n t a g e I n c r e a s e i n Power b e c a u s e o f D i s t o r t i o n i s , Pi ( i n p e r c e n t )= ” ) ; 63 Chapter 11 TUNED VOLTAGE AMPLIFIERS Scilab code Exa 11.1.a Calculation of Resonant Frequency 1 2 3 4 5 6 7 8 9 10 11 12 13 // Example 1 1 . 1 ( a ) // Program t o C a l c u l a t e R e s o n a n t F r e q u e n c y o f t h e given Circuit clear ; clc ; close ; // Given C i r c u i t Data C =300*10^( -12) ; //F L =220*10^( -6) ; //H R =20; //Ohms // C a l c u l a t i o n fr =1/(2* %pi * sqrt ( L * C ) ) ; // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The R e s o n a n t F r e q u e n c y , f r = %f kHz . ” , fr /10^3) ; 64 Scilab code Exa 11.1.b Calculation of Impedance at Resonance 1 2 3 4 5 6 7 8 9 10 11 12 13 // Example 1 1 . 1 ( b ) // Program t o C a l c u l a t e Impedance a t R e s o n a n c e o f t h e given Circuit clear ; clc ; close ; // Given C i r c u i t Data C =300*10^( -12) ; //F L =220*10^( -6) ; //H R =20; //Ohms // C a l c u l a t i o n Rr = R ; // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The Impedance a t Resonance , Rr = %f Ohms . ” , Rr ) ; Scilab code Exa 11.1.c Calculation of Current at Resonance 1 2 3 4 5 6 7 8 9 10 11 12 13 14 // Example 1 1 . 1 ( c ) // Program t o C a l c u l a t e t h e C u r r e n t a t R e s o n a n c e o f the given C i r c u i t clear ; clc ; close ; // Given C i r c u i t Data V =10; //V C =300*10^( -12) ; //F L =220*10^( -6) ; //H R =20; //Ohms // C a l c u l a t i o n I=V/R; // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The C u r r e n t a t Resonance , I = %f A . ” ,I 65 ); Scilab code Exa 11.1.d Calculation of Voltage across each Component 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 // Example 1 1 . 1 ( d ) // Program t o C a l c u l a t e t h e V o l t a g e a c r o s s e a c h Component o f t h e g i v e n C i r c u i t clear ; clc ; close ; // Given C i r c u i t Data V =10; //V C =300*10^( -12) ; //F L =220*10^( -6) ; //H R =20; //Ohms // C a l c u l a t i o n fr =1/(2* %pi * sqrt ( L * C ) ) ; I=V/R; Xl =2* %pi * fr * L ; Vl = I * Xl ; Xc =1/(2* %pi * fr * C ) ; Vc = I * Xc ; Vr = I * R ; // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t V o l t a g e a c r o s s t h e I n d u c t a n c e , Vl = %f V . ” , Vl ) ; printf ( ” \n\ t V o l t a g e a c r o s s t h e C a p a c i t a n c e , Vc = %f V . ” , Vc ) ; printf ( ” \n\ t V o l t a g e a c r o s s t h e R e s i s t a n c e , Vr = %f V . ” , Vr ) ; Scilab code Exa 11.2 Calculation of Parameters of the Resonant Circuit at Resonance 66 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 // Example 1 1 . 2 // Program t o C a l c u l a t e f r , I l , I c , L i n e C u r r e n t & Impedance o f // t h e R e s o n a n t C i r c u i t a t R e s o n a n c e clear ; clc ; close ; // Given C i r c u i t Data C =100*10^( -12) ; //F L =100*10^( -6) ; //H R =10; //Ohms V =100; //V // C a l c u l a t i o n fr =1/(2* %pi * sqrt ( L * C ) ) ; Xl =2* %pi * fr * L ; Il = V / Xl ; Xc =1/(2* %pi * fr * C ) ; Ic = V / Xc ; Zp = L /( R * C ) ; I = V / Zp ; // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The C a l c u l a t e d V a l u e s a r e : ” ) ; printf ( ” \n\ t f r = %f kHz . ” , fr /10^3) ; printf ( ” \n\ t I l = %f A . ” , Il ) ; printf ( ” \n\ t I c= %f A . ” , Ic ) ; printf ( ” \n\ t Zp= %f Ohms . ” , Zp ) ; printf ( ” \n\ t I= %f mA. ” ,I /10^( -3) ) ; Scilab code Exa 11.3 Calculation of Impedance Q and Bandwidth of Resonant Circuit // Example 1 1 . 3 // Program t o C a l c u l a t e Impedance , Q and Bandwidth o f the 3 // R e s o n a n t C i r c u i t 1 2 67 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 clear ; clc ; close ; // Given C i r c u i t Data C =100*10^( -12) ; //F L =150*10^( -6) ; //H R =15; //Ohms // C a l c u l a t i o n fr =1/(2* %pi * sqrt ( L * C ) ) ; Zp = L /( R * C ) ; Q =2* %pi * fr * L / R ; df = fr / Q ; // Bandwidth // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The C a l c u l a t e d V a l u e s a r e : ” ) ; printf ( ” \n\ t Impedance , Zp= %f kOhms . ” , Zp /10^3) ; printf ( ” \n\ t Q u a l i t y F a c t o r , Q= %f . ” ,Q ) ; printf ( ” \n\ t Bandwidth , d f= %f kHz . ” , df /10^3) ; 68 Chapter 12 FEEDBACK IN AMPLIFIERS Scilab code Exa 12.1 Calculation of Gain of Negative Feedback Amplifier 1 2 3 4 5 6 7 8 9 10 11 12 13 // Example 1 2 . 1 // Program t o C a l c u l a t e t h e Gain o f a N e g a t i v e Feedb ack A m p l i f i e r w i t h // Given S p e c i f i c a t i o n s clear ; clc ; close ; // Given C i r c u i t Data A =100; // I n t e r n a l Gain B =1/10; // Feedback F a c t o r // C a l c u l a t i o n Af = A /(1+ A * B ) ; // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The V a l u e o f t h e Gain o f Feedba ck A m p l i f i e r i s , Af = %f . ” , Af ) ; Scilab code Exa 12.2 Calculation of Internal Gain and Feedback Gain 69 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 // Example 1 2 . 2 // Program t o C a l c u l a t e t h e A( I n t e r n a l Gain ) and B e e t a ( Fee dback Gain ) o f // a N e g a t i v e Fe edback A m p l i f i e r with given S p e c i f i c a t i o n s clear ; clc ; close ; // Given C i r c u i t Data Af =100; // V o l t a g e Gain Vin =50*10^( -3) ; //V , I n p u t S i g n a l w i t h o u t F e e d a b a c k Gain Vi =0.6; //V , I n p u t S i g n a l w i t h F e e d a b a c k Gain // C a l c u l a t i o n Vo = Af * Vi ; A = Vo / Vin ; B =(( A / Af ) -1) / A ; // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The V a l u e o f t h e I n t e r n a l Gain A i s , A = %f . ” ,A ) ; printf ( ” \n\ t The V a l u e o f t h e Feedback Gain B i s , B = %f p e r c e n t . ” ,B *100) ; Scilab code Exa 12.3 Calculation of change in overall Gain of Feedback Amplifier 1 2 3 4 5 6 7 8 // Example 1 2 . 3 // Program t o C a l c u l a t e t h e c h a n g e i n o v e r a l l Gain o f t h e Feedb ack // A m p l i f i e r w i t h g i v e n Gain reduction clear ; clc ; close ; // Given C i r c u i t Data A =1000; // 60dB , V o l t a g e Gain B =0.005; // N e g a t i v e Feedb ack 70 9 10 11 12 13 dAbyA = -0.12; //dA/A = 12 % // C a l c u l a t i o n dAfbyAf =1/(1+ A * B ) * dAbyA ; // dAf / Af =1/(1+A∗B) ∗dA/A // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The c h a n g e i n o v e r a l l Gain o f t h e Feedb ack A m p l i f i e r i s , dAf / Af = %f which i s e q u i v a l e n t t o %f p e r c e n t . ” , dAfbyAf , dAfbyAf * -100) ; Scilab code Exa 12.4 Calculation of Input Impedance of the Feedback Amplifier 1 2 3 4 5 6 7 8 9 10 11 12 13 // Example 1 2 . 4 // Program t o C a l c u l a t e t h e I n p u t Impedance o f t h e Feedb ack A m p l i f i e r // w i t h g i v e n S p e c i f i c a t i o n s clear ; clc ; close ; // Given C i r c u i t Data Zi =1*10^3; //Ohms A =1000; // V o l t a g e Gain B =0.01; // N e g a t i v e Feedb ack // C a l c u l a t i o n Zid =(1+ A * B ) * Zi ; // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The V a l u e o f t h e I n p u t Impedance o f t h e Feedb ack A m p l i f i e r i s , Z i d = %f kOhms . ” , Zid /10^3) ; Scilab code Exa 12.5 Calculation of Feedback Factor and Percent change in overall Gain 1 // Example 1 2 . 5 71 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 // Program t o C a l c u l a t e t h e v a l u e o f Feedbac k F a c t o r and P e r c e n t a g e // c h a n g e i n o v e r a l l Gain o f t h e Internal Amplifier clear ; clc ; close ; // Given C i r c u i t Data A =1000; // 60dB , V o l t a g e Gain Zo =12000; //Ohms Zod =600; //Ohms dAbyA =0.1; //dA/A = 10 % // C a l c u l a t i o n B =(( Zo / Zod ) -1) / A ; // Zod=Zo /(1+A∗B) dAfbyAf =1/(1+ A * B ) * dAbyA ; // dAf / Af =1/(1+A∗B) ∗dA/A // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The Feedback F a c t o r o f t h e Fe edback A m p l i f i e r i s , B = %f p e r c e n t . ” ,B *100) ; printf ( ” \n\ t The c h a n g e i n o v e r a l l Gain o f t h e Feedb ack A m p l i f i e r i s , dAf / Af = %f p e r c e n t . ” , dAfbyAf *100) ; 72 Chapter 13 OSCILLATORS Scilab code Exa 13.1 Calculate Frequency of Oscillation of Tuned Collector Oscillator 1 2 3 4 5 6 7 8 9 10 11 12 13 // Example 1 3 . 1 // Program t o C a l c u l a t e F r e q u e n c y o f O s c i l l a t i o n o f // Tuned C o l l e c t o r O s c i l l a t o r clear ; clc ; close ; // Given C i r c u i t Data L =58.6*10^( -6) ; // H C =300*10^( -12) ; // F // C a l c u l a t i o n fo =1/(2* %pi * sqrt ( L * C ) ) ; // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The F r e q u e n c y o f O s c i l l a t i o n o f Tuned C o l l e c t o r O s c i l l a t o r i s f o = %f kHz . ” , fo /10^3) ; Scilab code Exa 13.2 Calculate Frequency of Oscillation of Phase Shift Oscillator 73 1 2 3 4 5 6 7 8 9 10 11 12 13 // Example 1 3 . 2 // Program t o C a l c u l a t e F r e q u e n c y o f O s c i l l a t i o n o f // Vacuum Tube Phase S h i f t O s c i l l a t o r clear ; clc ; close ; // Given C i r c u i t Data R =100*10^3; // Ohms C =0.01*10^( -6) ; //F // C a l c u l a t i o n fo =1/(2* %pi * R * C * sqrt (6) ) ; // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The F r e q u e n c y o f O s c i l l a t i o n o f Vacuum Tube Phase S h i f t O s c i l l a t o r i s f o = %f Hz . ” , fo ) ; Scilab code Exa 13.3 Calculate Frequency of Oscillation of Wein Bridge Oscillator 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 // Example 1 3 . 3 // Program t o C a l c u l a t e F r e q u e n c y o f O s c i l l a t i o n o f // Wein B r i d g e O s c i l l a t o r clear ; clc ; close ; // Given C i r c u i t Data R1 =220*10^3; // Ohms R2 =220*10^3; // Ohms C1 =250*10^( -12) ; //F C2 =250*10^( -12) ; //F // C a l c u l a t i o n fo =1/(2* %pi * sqrt ( R1 * C1 * R2 * C2 ) ) ; // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The F r e q u e n c y o f O s c i l l a t i o n o f Wein B r i d g e O s c i l l a t o r i s f o = %f kHz . ” , fo /10^3) ; 74 Chapter 14 ELECTRONIC INSTRUMENTS Scilab code Exa 14.1 Caculation of Series Resistance for coversion to Voltmeter 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 // Example 1 4 . 1 // Program t o D e t e r m i n e t h e S e r i e s R e s i s t a n c e t o Convert given // d ’ A r s o n v a l movement i n t o a V o l t m e t e r w i t h t h e s p e c i f i e d Range clear ; clc ; close ; // Given C i r c u i t Data Rm =100; //Ohms Is =100*10^( -6) ; //A Vr =100; //V // C a l c u l a t i o n Rtotal = Vr / Is ; Rs = Rtotal - Rm ; // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The S e r i e s R e s i s t a n c e t o C o n v e r t g i v e n d A r s o n v a l movement i n t o a V o l t m e t e r i s , Rs = %f 75 kOhms . ” , Rs /10^3) ; Scilab code Exa 14.2 Calculation of Shunt Resistance 1 2 3 4 5 6 7 8 9 10 11 12 13 14 // Example 1 4 . 2 // Program t o D e t e r m i n e t h e Shunt R e s i s t a n c e r e q u i r e d clear ; clc ; close ; // Given C i r c u i t Data Rm =100; //Ohms CS =100*10^( -6) ; //A Imax =10*10^( -3) ; //A // C a l c u l a t i o n Ish = Imax - CS ; Rsh = Rm * CS / Ish ; // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The V a l u e o f Shunt R e s i s t a n c e i s , Rsh = %f Ohms . ” , Rsh ) ; Scilab code Exa 14.3 Designing of a Universal Shunt for making a Multi Range Milliammeter 1 2 3 4 5 6 7 8 // Example 1 4 . 3 // Program t o D e s i g n t h e U n i v e r s a l Shunt f o r making M u l t i −Range // M i l l i a m m e t e r w i t h Range 0−1 mA ,0 −100 mA,0 −500 mA,0 −1 A clear ; clc ; close ; // Given C i r c u i t Data CS =100*10^( -6) ; //A R =100; //Ohms 76 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 Rm =900; //Ohms // ( a ) C a l c u l a t i o n Imax1 =1*10^( -3) ; //A Rsh = CS * R /( Imax1 - CS ) ; Rm1 = Rm ; Ish1 = Imax1 - CS ; Rsh1 = Rm1 * CS / Ish1 ; // ( b ) C a l c u l a t i o n Imax2 =10*10^( -3) ; //A Ish2 = Imax2 - CS ; R1 =( R * Ish2 - Rm * CS ) /( Ish2 - CS ) ; // ( c ) C a l c u l a t i o n Imax3 =100*10^( -3) ; //A Ish3 = Imax3 - CS ; R2 =(( R - R1 ) * Ish3 - Rm * CS ) /( Ish3 - CS ) ; // ( d ) C a l c u l a t i o n Imax4 =500*10^( -3) ; //A Ish4 = Imax4 - CS ; R3 =(( R - R1 - R2 ) * Ish4 - Rm * CS ) /( Ish4 - CS ) ; // ( e ) C a l c u l a t i o n Imax5 =1; //A Ish5 = Imax5 - CS ; R4 =(( R - R1 - R2 - R3 ) * Ish5 - Rm * CS ) /( Ish5 - CS ) ; R5 =R - R1 - R2 - R3 - R4 ; // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t Shunt R e s i s t a n c e , Rsh = %f Ohms . ” , Rsh ) ; printf ( ” \n\ t For Range s w i t c h a t 1 mA , Rsh1 = %f Ohms . ” , Rsh1 ) ; printf ( ” \n\ t For Range s w i t c h a t 10 mA , R1 = %f Ohms . ” , R1 ) ; printf ( ” \n\ t For Range s w i t c h a t 100 mA, R2 = %f Ohms . ” , R2 ) ; printf ( ” \n\ t For Range s w i t c h a t 500 mA, R3 = %f Ohms . ” , R3 ) ; printf ( ” \n\ t For Range s w i t c h a t 1 A , R4 = %f Ohms . ” , R4 ) ; printf ( ” \n\ t \ t \ t R5 = %f Ohms . ” , R5 ) ; 77 Scilab code Exa 14.4 Determination of Peak and RMS AC Voltage 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 // Example 1 4 . 4 // Program t o D e t e r m i n e t h e AC V o l t a g e clear ; clc ; close ; // Given C i r c u i t Data DS =5; //V/cm , D e f l e c t i o n S e n s i t i v i t y l =10; //cm , T r a c e Length // C a l c u l a t i o n Vp = DS * l ; Vm = Vp /2; V = Vm / sqrt (2) ; // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The Peak AC V o l t a g e , Vm = %f V . ” , Vm ) ; printf ( ” \n\ t The RMS AC V o l t a g e , V = %f V . ” ,V ) ; Scilab code Exa 14.5 Determination of Magnitude and Frequency of Voltage Fed to Y Input 1 2 3 4 5 6 7 // Example 1 4 . 5 // Program t o D e t e r m i n e t h e Magnitude and t h e Frequency o f the // wave V o l t a g e f e d t o t h e Y−i n p u t clear ; clc ; close ; // Given C i r c u i t Data 78 Figure 14.1: Determination of Magnitude and Frequency of Voltage Fed to Y Input 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 Am =3.5; //V, A m p l i t u d e tb =0.1*10^( -3) ; // s e c o n d s TP =4; // Time P e r i o d // C a l c u l a t i o n Vm =2* Am ; V = Vm / sqrt (2) ; T = TP * tb ; f =1/ T ; // D i s p l a y i n g The R e s u l t s i n Command Window printf ( ” \n\ t The Magnitude o f Wave V o l t a g e , V = %f V . ” ,V ) ; printf ( ” \n\ t The F r e q u e n c y o f Wave V o l t a g e , f = %f kHz . ” ,f /10^3) ; // P l o t o f t h e g i v e n Wave figure x = -6:0.01:6; y = Am * cos (1.6* x ) ; // Given Waveform plot (x , y ) ; a = gca () ; a . x_location = ” o r i g i n ” ; a . y_location = ” o r i g i n ” ; xlabel ( ’X A x i s ’ ) ; 79 28 29 30 ylabel ( ’Y A x i s ’ ) ; title ( ’CRO OUTPUT ’ ) ; xgrid (6) ; 80