Docsity

MATLAB introduction in circuit analysis , Exercises of Circuit Theory

Toggle sidebar
bg1
ELECTRONICS
and CIRCUIT
ANALYSIS
using MATLAB
JOHN O. ATTIA
Department of Electrical Engineering
Prairie View A&M University
Boca Raton London New York Washington, D.C.
CRC Press
© 1999 CRC Press LLC
© 1999 CRC Press LLC
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a
pf5b
pf5c
pf5d
pf5e
pf5f
pf60
pf61
pf62
pf63
pf64

Partial preview of the text

Download MATLAB introduction in circuit analysis and more Exercises Circuit Theory in PDF only on Docsity!

ELECTRONICS

and CIRCUIT

ANALYSIS

using MATLAB

JOHN O. ATTIA

Department of Electrical Engineering

Prairie View A&M University

Boca Raton London New York Washington, D.C.

CRC Press

This book contains information obtained from authentic and highly regarded sources. Reprinted material is quoted with permission, and sources are indicated. A wide variety of references are listed. Reasonable efforts have been made to publish reliable data and information, but the author and the publisher cannot assume responsibility for the validity of all materials or for the consequences of their use.

Neither this book nor any part may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, microfilming, and recording, or by any information storage or retrieval system, without prior permission in writing from the publisher.

The consent of CRC Press LLC does not extend to copying for general distribution, for promotion, for creating new works, or for resale. Specific permission must be obtained in writing from CRC Press LLC for such copying.

Direct all inquiries to CRC Press LLC, 2000 Corporate Blvd. N.W. , Boca Raton, Florida

Trademark Notice: Product or corporate names may be trademarks or registered trade- marks, and are used only for identification and explanation, without intent to infringe.

© 1999 by CRC Press LLC No claim to original U.S. Government works International Standard Book Number 0-8493-1176- Library of Congress Card Number 98- Printed in the United States of America 1 2 3 4 5 6 7 8 9 0 Printed on acid-free paper

Library of Congress Cataloging-in-Publication Data

Attia, John Okyere. Electronics and circuit analysis using MATLAB / John Okyere Attia p. cm. Includes bibliographical references and index. ISBN 0-8493-1176-4 (alk. paper)

  1. Electronics--Data processing. 2. Electric circuit analysis- -Data processing. 3. MATLAB (Computer file) I Title. TK7835.A88 1999 621.381’0285--dc CIP

98-

Part III includes Chapters 9, 10, 11 and 12. The topics discussed in this part are diodes, semiconductor physics, operational amplifiers and transistor circuits. Application of MATLAB for problem solving in electronics is discussed. Extensive examples showing the use of MATLAB for solving problems in electronics are presented.

Each chapter has its own bibliography and exercises.

Text Diskette

Since the text contains a large number of examples that illustrate electronics and circuit analysis principles and applications with MATLAB, a diskette is included that contains all the examples in the book. The reader can run the examples without having to enter the commands. The examples can also be modified to suit the needs of the reader.

Acknowledgments

I appreciate the suggestions and comments from a number of reviewers including Dr. Murari Kejariwal, Dr. Reginald Perry, Dr. Richard Wilkins, Mr. Warsame Ali, Mr. Anowarul Huq and Mr. John Abbey. Their frank and positive criticisms led to considerable improvement of this work.

I am grateful to Mr. Zhong You for typing and running some of the MATLAB programs in this book and I am also grateful to Mr. Carl Easton and Mr. Url Woods for drawing the circuit diagrams found in the text. I thank Ms. Debbie Hawkins and Cheryl Wright who typed several parts of this book. I am appreciative of Ms. Judith Hansen for her editing services. Special thanks go Ms. Nora Konopka, at CRC Press, who took an early interest in this book and offered me any assistance I needed to get it completed. I thank Ms. Mimi Williams, at CRC Press, for thoroughly proofreading the manuscript.

The questions and comments from electrical engineering students at Prairie View A&M University led to rewriting some sections of this work. Special thanks go to the students who used various drafts of this book and provided useful comments.

A final note of gratitude goes to my wife, Christine N. Okyere, who encouraged me to finish the book in record time. With equanimity and understanding, she stood by me during the endless hours I spent writing.

DEDICATION

Dedicated to my family members Christine, John II and Angela for their unfailing love, support and encouragement

CHAPTER FOUR DC ANALYSIS

4.1 NODAL ANALYSIS

4.2 LOOP ANALYSIS

4.3 MAXIMUM POWER TRANSFER

4.3.1 MATLAB diff and find Functions

SELECTED BIBLIOGRAPHY EXERCISES

CHAPTER FIVE TRANSIENT ANALYSIS

5.1 RC NETWORK

5.2 RL NETWORK

5.3 RLC CIRCUIT

5.4 STATE VARIABLE APPROACH

5.4.1 MATLAB ode functions

SELECTED BIBLIOGRAPHY EXERCISES

CHAPTER SIX AC ANALYSIS AND NETWORK FUNCTIONS

6.1 STEADY STATE AC POWER 6.1.1 MATLAB functions quad and quad 6.2 SINGLE- AND THREE-PHASE AC CIRCUITS 6.3 NETWORK CHARACTERISTICS 6.3.1 MATLAB functions roots, residue and polyval 6.4 FREQUENCY RESPONSE 6.4.1 MATLAB Function freqs

SELECTED BIBLIOGRAPHY EXERCISES

CHAPTER SEVEN TWO-PORT NETWORKS

7.1 TWO-PORT NETWORK REPRESENTATIONS

7.1.1 z-parameters 7.1.2 y-parameters 7.1.3 h-parameters 7.1.4 Transmission parameters 7.2 INTERCONNECTION OF TWO-PORT NETWORKS 7.3 TERMINATED TWO-PORT NETWORKS

SELECTED BIBLIOGRAPHY EXERCISES

CHAPTER EIGHT FOURIER ANALYSIS

8.1 FOURIER SERIES

8.2 FOURIER TRANSFORMS

8.2.1 Properties of Fourier transform 8.3 DISCRETE AND FAST FOURIER TRANSFORMS 8.3.1 MATLAB function fft

SELECTED BIBLIOGRAPHY EXERCISES

CHAPTER NINE DIODES

9.1 DIODE CHARACTERISTICS

9.1.1 Forward-biased region 9.1.2 MATLAB function polyfit 9.1.3 Temperature effects 9.2 ANALYSIS OF DIODE CIRCUITS 9.3 HALF-WAVE RECTIFIER 9.3.1 MATLAB function fzero 9.4 FULL-WAVE RECTIFICATION 9.5 ZENER DIODE VOLTAGE REGULATOR CIRCUIT

SELECTED BIBLIOGRAPHY EXERCISES

12.3.2 Wilson current source 12.4 FREQUENCY RESPONSE OF COMMON EMITTER AMPLIFIER 12.5 MOSFET CHARACTERISTICS 12.6 BIASING OF MOSFET CIRCUITS 12.7 FREQUENCY RESPONSE OF COMMON-SOURCE AMPLIFIER

SELECTED BIBLIOGRAPHY EXERCISES

LIST OF EXAMPLES IN TEXT

CHAPTER ONE MATLAB FUNDAMENTALS

EXAMPLE DESCRIPTION

1.1 Power Dissipation in a Resistor

1.2 Complex Number Representation

1.3 Equivalent Resistance

1.4 Quadratic Equation

CHAPTER TWO PLOTTING COMMANDS

EXAMPLE DESCRIPTION

2.1 Voltage and Current of an RL Circuit 2.2 Gain versus Frequency of an RC Amplifier

2.3 Polar Plot of a Complex Number

CHAPTER THREE CONTROL STATEMENTS

EXAMPLE DESCRIPTION

3.1 Horizontal and Vertical Displacement

3.2 A 3-bit A/D Converter

3.3 Consecutive Integer Numbers

EXAMPLE DESCRIPTION

6.1 Power Calculations of One-port Network

6.2 AC Voltage of an RLC Circuit 6.3 AC Current and Voltage of a Circuit with Two Sources 6.4 Unbalanced Wye-wye Connection

6.5 Network Function, Poles and Zeros of a Circuit

6.6 Inverse Laplace Transform

6.7 Magnitude and Phase Response of an RLC Circuit

CHAPTER SEVEN TWO-PORT NETWORKS

EXAMPLE DESCRIPTION

7.1 z-parameters of T-Network

7.2 y-parameters of Pi-Network

7.3 y-parameters of Field Effect Transistor

7.4 h-parameters of Bipolar Junction Transistor

7.5 Transmission Parameters of a Simple Impedance Network 7.6 Transmission Parameters of a Simple Admittance Network 7.7 y-parameters of Bridge T-Network

7.8 Transmission Parameters of a Simple Cascaded Network 7.9 Transmission Parameters of a Cascaded System

7.10 z - parameters and Magnitude Responses of an Active Lowpass Filter

CHAPTER SIX AC ANALYSIS AND NETWORK FUNCTIONS

EXAMPLE DESCRIPTION

8.1 Fourier Series Expansion of a Square Wave

8.2 Amplitude and Phase Spectrum of Full-wave Rectifier Waveform 8.3 Synthesis of a Periodic Exponential Signal

8.4 DFT and FFT of a Sequence

8.5 Fourier Transform and DFT of a Damped Exponential Sinusoid 8.6 Power Spectral Density of a Noisy Signal

CHAPTER NINE DIODES

EXAMPLE DESCRIPTION

9.1 Determination of Diode Parameters from Data

9.2 I-V characteristic of a Diode at Different Temperatures 9.3 Operating Point of a Diode Using Graphical Techniques 9.4 Operating Point of a Diode using Iterative Technique 9.5 Battery Charging Circuit – Current, Conduction Angle and Peak Current 9.6 Capacitor Smoothing Circuit – Calculation of Critical Times 9.7 Full-wave Rectifier – Ripple Voltage, Dc Output Voltage, Discharge Time and Period of Ripple 9.8 A Zener Diode Voltage Regulator

CHAPTER EIGHT FOURIER ANALYSIS

12.2 Output Characteristics of an NPN Transistor

12.3 Self-Bias Circuit – Stability Factors and Collector Current as a Function of Temperature 12.4 Comparison of Simple Current Mirror and Wilson Current Source 12.5 Frequency Response of a Common Emitter Amplifier 12.6 I-V Characteristics of NMOS

12.7 Operating Point Calculation of NMOS Biasing Circuit 12.8 Voltage and Current Calculations for a MOSFET Current mirror 12.9 Common-source Amplifier Gain, Cut-off Frequencies and Bandwidth

CHAPTER TWELVE TRANSISTOR CIRCUITS

EXAMPLE DESCRIPTION

12.1 Input Characteristics of a BJT

CHAPTER ONE

MATLAB FUNDAMENTALS

MATLAB is a numeric computation software for engineering and scientific calculations. The name MATLAB stands for MATRIX LABORATORY. MATLAB is primarily a tool for matrix computations. It was developed by John Little and Cleve Moler of MathWorks, Inc. MATLAB was originally written to provide easy access to the matrix computation software packages LINPACK and EISPACK.

MATLAB is a high-level language whose basic data type is a matrix that does not require dimensioning. There is no compilation and linking as is done in high-level languages, such as C or FORTRAN. Computer solutions in MATLAB seem to be much quicker than those of a high-level language such as C or FORTRAN. All computations are performed in complex-valued dou- ble precision arithmetic to guarantee high accuracy.

MATLAB has a rich set of plotting capabilities. The graphics are integrated in MATLAB. Since MATLAB is also a programming environment, a user can extend the functional capabilities of MATLAB by writing new modules.

MATLAB has a large collection of toolboxes in a variety of domains. Some examples of MATLAB toolboxes are control system, signal processing, neural network, image processing, and system identification. The toolboxes consist of functions that can be used to perform computations in a specific domain.

1.1 MATLAB BASIC OPERATIONS

When MATLAB is invoked, the command window will display the prompt >>. MATLAB is then ready for entering data or executing commands. To quit MATLAB, type the command

exit or quit

MATLAB has on-line help. To see the list of MATLAB’s help facility, type

help

The help command followed by a function name is used to obtain informa- tion on a specific MATLAB function. For example, to obtain information on the use of fast Fourier transform function, fft , one can type the command

B = [6 9 12 15 18];

or B = [6 , 9,12,15,18]

For readability, it is better to use spaces rather than commas between the ele- ments. The row vector B can be turned into a column vector by transposition , which is obtained by typing

C = B’

The above results in

C = 6 9 12 15 18

Other ways of entering the column vector C are

C = [ 9 12 15 18]

or C = [6; 9; 12; 15; 18]

MATLAB is case sensitive in naming variables, commands and functions. Thus b and B are not the same variable. If you do not want MATLAB to be case sensitive, you can use the command

casesen off

To obtain the size of a specific variable, type size ( ). For example, to find the size of matrix A, you can execute the following command:

size(A)

The result will be a row vector with two entries. The first is the number of rows in A, the second the number of columns in A.

To find the list of variables that have been used in a MATLAB session, type the command

whos

There will be a display of variable names and dimensions. Table 1.1 shows the display of the variables that have been used so far in this book:

Table 1. Display of an output of whos command

Name Size Elements Byte Density Complex

A 3 by 3 9 72 Full No B 1 by 5 5 40 Full No C 5 by 1 5 40 Full No ans 1 by 2 2 16 Full No

The grand total is 21 elements using 168 bytes.

Table 1.2 shows additional MATLAB commands to get one started on MATLAB. Detailed descriptions and usages of the commands can be obtained from the MATLAB help facility or from MATLAB manuals.

Table 1. Some Basic MATLAB Commands

Command Description % Comments. Everything appearing after % com- mand is not executed. demo Access on-line demo programs length Length of a matrix clear Clears the variables or functions from workspace clc Clears the command window during a work session clg Clears graphic window diary Saves a session in a disk, possibly for printing at a later date