




























































































Estude fácil! Tem muito documento disponível na Docsity
Ganhe pontos ajudando outros esrudantes ou compre um plano Premium
Esta página não é visível na pré-visualização
Não perca as partes importantes!





























































































PRACTICAL MATLAB
FOR ENGINEERS
PRACTICAL MATLAB
®
APPLICATIONS FOR
ENGINEERS
Misza Kalechman
MATLAB® is a trademark of The MathWorks, Inc. and is used with permission. The MathWorks does not warrant the accuracy of the text or exercises in this book. This book’s use or discussion of MATLAB® software or related products does not constitute endorsement or sponsorship by The MathWorks of a particular pedagogical approach or particular use of the MATLAB® software.
This book was previously published by Pearson Education, Inc.
CRC Press Taylor & Francis Group 6000 Broken Sound Parkway NW, Suite 300 Boca Raton, FL 33487- © 2009 by Taylor & Francis Group, LLC CRC Press is an imprint of Taylor & Francis Group, an Informa business No claim to original U.S. Government works Printed in the United States of America on acid-free paper 10 9 8 7 6 5 4 3 2 1 International Standard Book Number-13: 978-1-4200-4776-9 (Softcover) This book contains information obtained from authentic and highly regarded sources. Reasonable efforts have been made to publish reliable data and information, but the author and publisher cannot assume responsibility for the valid- ity of all materials or the consequences of their use. The authors and publishers have attempted to trace the copyright holders of all material reproduced in this publication and apologize to copyright holders if permission to publish in this form has not been obtained. If any copyright material has not been acknowledged please write and let us know so we may rectify in any future reprint. Except as permitted under U.S. Copyright Law, no part of this book may be reprinted, reproduced, transmitted, or uti- lized in any form by any electronic, mechanical, or other means, now known or hereafter invented, including photocopy- ing, microfilming, and recording, or in any information storage or retrieval system, without written permission from the publishers. For permission to photocopy or use material electronically from this work, please access www.copyright.com (http:// www.copyright.com/) or contact the Copyright Clearance Center, Inc. (CCC), 222 Rosewood Drive, Danvers, MA 01923, 978-750-8400. CCC is a not-for-profit organization that provides licenses and registration for a variety of users. For orga- nizations that have been granted a photocopy license by the CCC, a separate system of payment has been arranged. Trademark Notice: Product or corporate names may be trademarks or registered trademarks, and are used only for identification and explanation without intent to infringe.
Library of Congress Cataloging-in-Publication Data Kalechman, Misza. Practical MATLAB applications for engineers / Misza Kalechman. p. cm. Includes bibliographical references and index. ISBN 978-1-4200-4776-9 (alk. paper)
Visit the Taylor & Francis Web site at http://www.taylorandfrancis.com and the CRC Press Web site at http://www.crcpress.com
vii
Preface
Practical MATLAB ®^ Applications for Engineers introduces the reader to the concepts of MATLAB ®^ tools used in the solution of advanced engineering course work followed by engineering and technology students. Every chapter of this book discusses the course material used to illustrate the direct connection between the theory and real-world appli- cations encountered in the typical engineering and technology programs at most colleges. Every chapter has a section, titled Background, in which the basic concepts are introduced and a section in which those concepts are tested, with the objective of exploring a number of worked-out examples that demonstrate and illustrate various classes of real-world prob- lems and its solutions. The topics include
Continuous and discrete signals Sampling Communication signals DC (direct current) analysis Transient analysis AC (alternating current) analysis Fourier series Fourier transform Spectra analysis Frequency response Discrete Fourier transform Z-transform Standard filters IRR (infinite impulse response) and FIR (finite impulse response) filters
For product information, please contact The MathWorks, Inc. 3 Apple Hill Drive Natick, MA 01760-2098 USA Tel: 508 647 7000 Fax: 508-647- E-mail: [email protected] Web: www.mathworks.com
ix
Author
Misza Kalechman is a professor of electrical and telecommunication engineering technol- ogy at New York City College of Technology, part of the City University of New York. Mr. Kalechman graduated from the Academy of Aeronautics (New York), Polytechnic University (BSEE), Columbia University (MSEE), and Universidad Central de Venezuela (UCV; electrical engineering). Mr. Kalechman was associated with a number of South American universities where he taught undergraduate and graduate courses in electrical, industrial, telecommunication, and computer engineering; and was involved with applied research projects, design of labo- ratories for diverse systems, and installations of equipment. He is one of the founders of the Polytechnic of Caracas (Ministry of Higher Education, Venezuela), where he taught and served as its first chair of the Department of System Engineering. He also taught at New York Institute of Technology (NYIT); Escofa (officers telecommunication school of the Venezuelan armed forces); and at the following South American universities: Universidad Central de Venezuela, Universidad Metropolitana, Universidad Catolica Andres Bello, Universidad the Los Andes, and Colegio Universitario de Cabimas. He has also worked as a full-time senior project engineer (telecom/computers) at the research oil laboratories at Petroleos de Venezuela (PDVSA) Intevep and various refineries for many years, where he was involved in major projects. He also served as a consultant and project engineer for a number of private industries and government agencies. Mr. Kalechman is a licensed professional engineer of the State of New York and has written Practical MATLAB for Beginners (Pearson), Laboratorio de Ingenieria Electrica (Alpi- Rad-Tronics), and a number of other publications.
2 Practical MATLAB®^ Applications for Engineers
To a physician, it may be
From a block box diagram point of view, signals constitute inputs to a system, and their responses referred to as outputs. Since many of the measuring, recording, tracking, and processing instruments of signal activities are electrical or electronic devices, scientists and engineers usually convert any type of physical variations into an electrical signal. Electrical signals can be classified using a variety of criteria. Some of the signal’s clas- sification criteria are
a. Signals may be functions of one or more than one independent variable generated by a single source or multiple sources. b. Signals may be single or multidimensional. c. Signals may be orthogonal or nonorthogonal, periodic or nonperiodic, even, odd, or present a particular symmetry. d. Signals may be deterministic or nondeterministic (probabilistic). e. Signals may be analog or discrete. f. Signals may be narrow or wide band. g. Signals may be power or energy signals.
In any case, signals are produced as a result of a process defined by a mathematical relation usually in the form of an equation, an algorithm, a model, a table, a plot, or a given rule. A one-dimensional (1-D) signal is given by a mathematical expression consisting of one independent variable, for example, audio. A 2-D signal is a function of two independent variables, for example, a black and white picture. A full motion black and white video can be viewed as a 3-D signal, consisting of pictures (2-D) that are transmitted or processed at a particular rate. The dimension of a video signal can be increased by adding color (red, green, and blue), luminance, etc. Deterministic and probabilistic signals is another broad way to classify signals. Deter- ministic signals are those signals where each value is unique, while nondeterministic signals are those whose values are not specified. They may be random or defined by statis- tical values such as noise. In this book, the majority of the signals are restricted to 1-D and 2-D, limited to one independent variable usually either time ( t ) or frequency ( f or w ), and
Time Domain Representation of Continuous and Discrete Signals 3
deterministic such as current, voltage, power, or energy represented as vectors or matrices by MATLAB ®. In this book, following the widely accepted industrial standards, signals are classified in two broad categories
Analog Discrete
Analog signals are signals capable of changing at any time. This type of signals is also referred as continuous time signals, meaning that continuous amplitude imply that the amplitude of the signal can take any value. Discrete time signals, however, are signals defined at some instances of time, over a time interval t ∈ [t 0 , t 1 ]. Therefore discrete signals are given as a sequence of points, also called samples over time such as t = nT , for n = 0, ± 1, ± 2, … , ± N , whereas all other points are undefined. An analog or continuous signal is denoted by f(t) , whereas a discrete signal is represented by f(nT) or in short without any loss of generality by f(n) , as indicated in Figure 1.1 by dots. An analog signal f(t) can be converted into a discrete signal f(nT) by sampling f(t) with a constant sampling rate T (a time also referred as Ts ), where n is an integer over the range −∞ < n < +∞ large but finite. Therefore a large, but finite number of samples also referred to as a sequence can be generated. Since the sampling rate is constant ( T ), a discrete signal can simply be represented by f(nT) or f(n) , without any loss of information (just a scaling factor of T). Continuous time systems or signals usually model physical systems and are best described by a set of differential equations. The analogous model for discrete models is described by a set of difference equations. Signals that occur in nature are usually analog, but if a signal is processed by a computer or any digital device the continuous signal must be converted to a discrete sequence (using an analog to digital converter, denoted by A/D), or mathematically by a finite sequence of numbers that represent its amplitude at the sampling instances. Discrete signals take the value of the continuous signals at equally spaced time intervals ( nT ). Those values can be considered an ordered sequence, meaning that the discrete sig- nal represents mathematically the sequence: f (0), f (1), f (2), f (3), …, f ( n ). The spacing T between consecutive samples of f(t) is called the sampling interval or the sampling period (also referred to as Ts ).
0
5
10
Analog signal
t
f(t)
0 1 2 3 4 5 6 7 8 9 10
0
5
10
Discrete signal
n
f(n)
FIGURE 1. Analog and discrete signal representation.
Time Domain Representation of Continuous and Discrete Signals 5
R.1.3 Analytically, the sampling process is accomplished by multiplying f(t ) by a se- quence of impulses. The concept of the unit impulse δ (t) , also known as the Dirac function, is introduced and discussed next. R.1.4 The unit impulse, denoted by δ (t) , also known as the Dirac or the Delta function, is defined by the following relation:
( ) t dt
1 ∞
∞ ∫
meaning that the area under [δ (t) ] = 1 , where
(t) = 0 , for t ≠ 0 (t) = 1 , for t = 0
δ (t) is an even function, that is, δ (t) = δ ( − t). The impulse function δ (t) is not a true function in the traditional mathematical sense. However, it can be defined by the following limiting process: by taking the limit of a rectangular function with an amplitude 1/τ and width τ, when τ approaches zero, as illustrated in Figure 1.2. The impulse function δ (t), as defined, has been accepted and widely used by engi- neers and scientists, and rigorously justified by an extensive literature referred as the generalized functions, which was first proposed by Kirchhoff as far back as
1
lim (^) { { t 0 0 + (^) 0
t
FIGURE 1. The impulse function δ (t).
6 Practical MATLAB®^ Applications for Engineers
R.1.6 Since δ (t) is not a conventional signal, it is not possible to generate a function that has exactly the same properties as δ (t). However, the Dirak function as well as its derivatives ( d δ (t)/dt ) can be approximated by different mathematical models. Some of the approximations are listed as follows (Lathi, 1998):
( ) lim sin( / ) /
( sin )
t a
t a t a
c
t
a
it (^) →
0
using ’s
llim ( )
( ) lim
/ it
it
a
jt a
a
t
e jt
t e
→
→
−
0
using exponentials
(^22) / 42 ( )
a a
using Gaussian
R.1.7 Multiplying a unit impulse δ (t) by a constant A changes the area of the impulse to A , or the amplitude of the impulse becomes A.
R.1.8 The impulse function δ (t) when multiplied by an arbitrary function f ( t ) results in an impulse with the magnitude of the function evaluated at t = 0 , indicated by
(t) f(t) = f(0) (t)
Observe that f (0) δ (t) can be defined as
f t
t f t
for for
R.1.9 A shifted impulse δ (t − t 1 ) is illustrated in Figure 1.3. When the shifted impulse δ (t − t 1 ) is multiplied by an arbitrary function f(t) , the result is given by
(t − t 1 ) ⋅ f(t) = f(t 1 ) ⋅ (t − t 1 )
R.1.10 The derivative of the unit Dirak δ (t) is called the unit doublet, denoted by ______ d [δ( t )] dt
= δ′( t ), is illustrated in Figure 1.4.
0 t 1 t
Amplitude
FIGURE 1. Plot of δ (t − t 1 ).
FIGURE 1. Plot of δ (t) ′ as a approaches zero_._
a
1
t
(t) ′
8 Practical MATLAB®^ Applications for Engineers
The expansion of the function Imp[(t)T] results in
Imp [( ) ] ( )
t t nT
t nT t T t t T
T n
∑
… … (^) (( t nT )
R.1.15 The sampling process is modeled mathematically by multiplying an arbitrary ana- log signal f ( t ) by the train of impulses defined by Imp[(t)T]. This process is illustrated graphically in Figure 1.6. Analytically,
f t t nT f t t nT n n
( ) ⋅ (^) ∑ ( ) ∑ ( ) ( )
and the expanded discrete version of f ( t ) is given by
f n f k t k f t f t f t
f
k
∑ ^2 2 1 1
(( ) ( 1 t 1 ) f ( ) ( 2 t 2 ) f n ( ) ( t n )
assuming that T = 1 , without any loss of generality.
0
5
10
f(t)
− 4 T − 3 T − 2 T − T 0 T 2 T 3 T 4 T 5 T 6 T
0
1
ImpT(t)
− 4 T − 3 T − 2 T − T 0 T 2 T 3 T 4 T 5 T 6 T
0
5
10
t
f(t)* ImpT(t)
FIGURE 1. Plots illustrating the sampling process.
Time Domain Representation of Continuous and Discrete Signals 9
In general, the set of samples given by f( − n), f( − n + 1), …, f(0), f(1), …, f(n − 1), f(n) , can be real or complex. f(n) is called a real sequence if all its samples are real and a complex sequence if at least one sample is complex. Observe that any (discrete) sequence f(n) can be expressed by the equation
f n f k n k k
∑
Examples of analog signals are often encountered in nature such as sound, tem- peratures, pressure, growth, and precipitations waves. Discrete time signals or events are usually man-made functions such as weekly pay, monthly payment of a loan or mortgage, or the (U.S.) presidential election every 4 years. Discrete signals are often confused with digital signals and binary signals. A digital signal f(nT) or in short f(n) is a discrete time signal whose values are one of a predefined finite set of values. A binary signal is a discrete signal whose values consist of either zeros or ones. An analog or continuous time function or signal can be transformed into a digital signal using an A/D. Conversely, a digital signal can be converted into an analog signal by means of a digital to analog converter (D/A). Digital signals are frequently encoded using binary codes such as ASCII* into strings of ones and zeros because in this format they can be stored and processed by digital devices such as computers, and are in general more immune to noise and interference. R.1.16 The discrete impulse sequence δ (n) also called the Kronecker delta sequence (named after the German mathematician Leopold Kronecker [1823–1891]) is defined ana- lytically as follows and illustrated in Figure 1.7.
( ) n
n n
for for
Note that the discrete impulse is similar to the analog version δ (t). R.1.17 A discrete shifted impulse δ (n − m) is illustrated in Figure 1.8.
1
− 2 − 1 0 1 2 3
n
FIGURE 1. Plot of the discrete impulse δ (n).
FIGURE 1. Plot of δ (n − m).
1
n m − 1 m m + 1
(n − m)