Instant Access to Introduction to Simulink with Engineering Applications 2nd Edition Steven T. Karris ebook Full Chapters
Instant Access to Introduction to Simulink with Engineering Applications 2nd Edition Steven T. Karris ebook Full Chapters
com
https://ebookname.com/product/introduction-to-simulink-with-
engineering-applications-2nd-edition-steven-t-karris/
OR CLICK BUTTON
DOWNLOAD EBOOK
https://ebookname.com/product/signals-and-systems-with-matlab-
computing-and-simulink-modeling-4th-edition-steven-t-karris/
ebookname.com
https://ebookname.com/product/numerical-analysis-using-matlab-and-
spreadsheets-2nd-edition-steven-t-karris/
ebookname.com
https://ebookname.com/product/numerical-analysis-using-matlab-and-
spreadsheets-2nd-ed-edition-steven-t-karris/
ebookname.com
https://ebookname.com/product/do-or-die-a-supplementary-manual-on-
individual-combat-a-j-drexel-biddle/
ebookname.com
A History of the Crusades Volume I The First Hundred Years
2nd Edition Kenneth M. Setton
https://ebookname.com/product/a-history-of-the-crusades-volume-i-the-
first-hundred-years-2nd-edition-kenneth-m-setton/
ebookname.com
https://ebookname.com/product/verilog-digital-system-design-2nd-
edition-zainalabedin-navabi/
ebookname.com
https://ebookname.com/product/the-english-civil-war-1642-1651-an-
illustrated-military-history-2nd-edition-philip-j-haythornthwaite/
ebookname.com
https://ebookname.com/product/integrins-1st-edition-david-a-cheresh/
ebookname.com
Islam and Scientific Economics In the Pursuit of a New
Paradigm Gürak
https://ebookname.com/product/islam-and-scientific-economics-in-the-
pursuit-of-a-new-paradigm-gurak/
ebookname.com
Introduction to Simulink
with Engineering Applications
Second Edition
Steven T. Karris
Orchard Publications
www.orchardpublications.com
Introduction to Simulink®
with Engineering Applications
Second Edition
Steven T. Karris
Orchard Publications
www.orchardpublications.com
Introduction to Simulink ® with Engineering Applications, Second Edition
Copyright ©2008 Orchard Publications. All rights reserved. Printed in the United States of America. No part of this
publication may be reproduced or distributed in any form or by any means, or stored in a data base or retrieval system,
without the prior written permission of the publisher.
Product and corporate names are trademarks or registered trademarks of The MathWorks™, Inc. They are used only
for identification and explanation, without intent to infringe.
ISBN-10: 1-934404-10-1
ISBN-13: 978-1-934404-10-2
TXu 1−303-668
Disclaimer
The author has made every effort to make this text as complete and accurate as possible, but no warranty is implied.
The author and publisher shall have neither liability nor responsibility to any person or entity with respect to any loss
or damages arising from the information contained in this text.
Preface
This text is an introduction to Simulink ®, a companion application to MATLAB ®. It is written
for students at the undergraduate and graduate programs, as well as for the working professional.
The author claims no originality of the content, and the description of the Simulink blocks is
extracted from The MathWorks™ documentation without intent to infringe. The intent is to
provide a complete reference text, and whenever necessary, the author refers the reader to The
MathWorks™ documentation. Whenever there is a conflict between this text and The
MathWorks™ documentation, the latter takes precedence.
Although some previous knowledge of MATLAB would be helpful, it is not absolutely necessary;
Appendix A of this text is an introduction to MATLAB to enable the reader to begin learning
both MATLAB and Simulink simultaneously, and to perform graphical computations and
programming.
Chapters 2 through 19 describe the blocks in all Simulink Version 7.1 libraries. Their application
is illustrated with Simulink models that contain the pertinent blocks, and some are supplemented
with MATLAB functions, commands, and statements. Some background information is provided
for lesser known definitions and topics. Chapters 1 and 20 contain several Simulink models to
illustrate various applied math and engineering applications. Appendix B is an introduction to
masked subsystems, and Appendix C introduces the reader to random generation procedures.
Appendix D is an introduction to Weighted Moving Averages.
This text supplements our Numerical Analysis Using MATLAB and Excel, ISBN 978−1−934404−
03−4. It is self-contained; the blocks of each library are described in an orderly fashion that is
consistent with Simulink’s documentation. This arrangement provides insight into how a model is
used and how its parts interact with each another.
Like MATLAB, Simulink can be used with both linear and nonlinear systems, which can be
modeled in continuous time, sample time, or a hybrid of these. Examples are provided in this text.
Most of the examples presented in this book can be implemented with the Student Versions of
MATLAB and Simulink. A few may require the full versions of these outstanding packages, and
these examples may be skipped. Some add−ons, known as Toolboxes and Blocksets can be
obtained from The MathWorks,™ Inc., 3 Apple Hill Drive, Natick, MA, 01760-2098, USA,
www.mathworks.com.
To get the most out of this outstanding application, it is highly recommended that this text is used
in conjunction with the MATLAB and Simulink User’s Guides. Other references are provided in
the reference section of this text.
This is the second edition of this title, and although every effort was made to correct possible
typographical errors and erroneous references to figures and tables, some may have been
overlooked. Accordingly, the author will appreciate it very much if any such errors are brought to
his attention so that corrections can be made for the next edition.
The author wishes to express his gratitude to the staff of The MathWorks™, the developers of
MATLAB® and Simulink® for the encouragement and unlimited support they have provided me
with during the production of this text.
Our heartfelt thanks also to Mr. Howard R. Hansen, and Dr. Niel Ransom, former CTO of
Alcatel, for bringing some errors on the first print to our attention.
Orchard Publications
www.orchardpublications.com
[email protected]
Table of Contents
1 Introduction to Simulink 1−1
1.1 Simulink and its Relation to MATLAB ....................................................................1−1
1.2 Simulink Demos ......................................................................................................1−20
1.3 Summary ..................................................................................................................1−28
1.4 Exercises ..................................................................................................................1−29
1.5 Solutions to End−of−Chapter Exercises ..................................................................1−30
References R−1
Index IN−1
T
his chapter is an introduction to Simulink. This author feels that it is best to introduce Sim-
ulink in this chapter with a few examples. Tools for simulation and model−based designs are
presented in the subsequent chapters. Some familiarity with MATLAB is essential in
understanding Simulink, and for this purpose, Appendix A is included as an introduction to
MATLAB.
Example 1.1
For the electric circuit of Figure 1.1, u 0 ( t ) *is the input and the initial conditions are i L ( 0 − ) = 0 ,
and v c ( 0 − ) = 0.5 V . We will compute v C ( t ) .
R L
+
1Ω 1⁄4 H C
+ vC ( t )
−
i(t) 4⁄3 F
−
vs ( t ) = u0 ( t )
Figure 1.1. Circuit for Example 1.1
For this example,
dv
i = i L = i C = C --------C- (1.1)
dt
* Throughout this text, the designation u 0 ( t ) will be used to denote the unit step function. We will use u ( t ) to
denote any other input to be consistent with the MATLAB and Simulink designations.
2
d vC dv
----------- + 4 --------C- + 3v C = 3u 0 ( t ) (1.4)
dt
2 dt
2
d v dv
----------C- + 4 --------C- + 3v C = 3 t>0 (1.5)
dt
2 dt
To appreciate Simulink’s capabilities, for comparison, three different methods of obtaining the
solution are presented, and the solution using Simulink follows.
First Method − Assumed Solution
Equation (1.5) is a second−order, non−homogeneous differential equation with constant coeffi-
cients, and thus the complete solution will consist of the sum of the forced response and the natu-
ral response. It is obvious that the solution of this equation cannot be a constant since the deriva-
tives of a constant are zero and thus the equation is not satisfied. Also, the solution cannot
contain sinusoidal functions (sine and cosine) since the derivatives of these are also sinusoids.
– at
However, decaying exponentials of the form ke where k and a are constants, are possible can-
didates since their derivatives have the same form but alternate in sign.
–s t –s t
It can be shown* that if k 1 e 1 and k 2 e 2 where k 1 and k 2 are constants and s 1 and s 2 are the
roots of the characteristic equation of the homogeneous part of the given differential equation,
–s1 t –s2 t
the natural response is the sum of the terms k 1 e and k 2 e . Therefore, the total solution will
be
* For a thorough discussion, please refer to Circuit Analysis II with MATLAB Applications, ISBN 0−
9709511−5−9, Appendix B.
–t –3 t
vc ( t ) = k1 e + k2 e + v cf ( t ) (1.8)
Since the right side of (1.9) is a constant, the forced response will also be a constant and we
denote it as v Cf = k 3 . By substitution into (1.9) we obtain
0 + 0 + 3k 3 = 3
or
v Cf = k 3 = 1 (1.10)
The constants k 1 and k 2 will be evaluated from the initial conditions. First, using v C ( 0 ) = 0.5 V
and evaluating (1.11) at t = 0 , we obtain
0 0
v C ( 0 ) = k 1 e + k 2 e + 1 = 0.5
k 1 + k 2 = – 0.5 (1.12)
Also,
dv C dv C i
i L = i C = C ---------, --------- = ---L-
dt dt C
and
dv iL ( 0 ) 0
--------C- = -----------
- = ---- = 0 (1.13)
dt t=0
C C
Simultaneous solution of (1.12) and (1.15), gives k 1 = – 0.75 and k 2 = 0.25 . By substitution into
(1.8), we obtain the total solution as
–t –3 t
v C ( t ) = ( – 0.75 e + 0.25e + 1 )u 0 ( t ) (1.16)
3 ⁄ 4s 2
0.5s + 2s + 3-
V C ( s ) = ---------------------------------------------- ⋅ ⎛ 1 -------⎞ + 0.5
--- – 0.5 1.5 - + 0.5
------- = -------------------------------- ------- = -----------------------------------
( 1 + 0.25s + 3 ⁄ 4s ) ⎝ s s ⎠ s 2
s ( s + 4s + 3 ) s s(s + 1)(s + 3)
2
0.5s + 2s + 3-
r 2 = --------------------------------- = – 0.75
s(s + 3) s = –1
2
0.5s + 2s + 3-
r 3 = --------------------------------- = 0.25
s(s + 1) s = –3
* For derivation of the voltage division and current division expressions, please refer to Circuit Analysis I with
MATLAB Applications, ISBN 0−9709511−2−4.
† A thorough discussion of partial fraction expansion with MATLAB Applications is presented in Numerical
Analysis Using MATLAB and Excel, ISBN 978−1−934404−03−4.
‡ For an introduction to Laplace Transform and Inverse Laplace Transform, please refer to Circuit Analysis II
with MATLAB Applications, ISBN 0−9709511−5−9.
** Usually, in State−Space and State Variables Analysis, u ( t ) denotes any input. For distinction, we will denote
the Unit Step Function as u0 ( t ) . For a detailed discussion on State−Space and State Variables Analysis, please
refer to Signals and Systems with MATLAB Computing and Simulink Modeling , ISBN 0−9744239−9−8.
1--- di
------L- = ( – 1 )i L – v C + 1
4 dt
or
di L
------- = – 4i L – 4v C + 4 (1.19)
dt
di
x· 1 = ------L- * (1.20)
dt
and
dv
x· 2 = --------C- (1.21)
dt
Also,
dv
i L = C --------C-
dt
and thus,
dv 4
x 1 = i L = C --------C- = Cx· 2 = --- x· 2
dt 3
or
3
x· 2 = --- x 1 (1.22)
4
Therefore, from (1.19), (1.20), and (1.22), we obtain the state equations
x· 1 = – 4x 1 – 4x 2 + 4
3
x· 2 = --- x 1
4
and in matrix form,
x· 1
= –4 –4 1 + 4 u0 ( t )
x
(1.23)
x· 2 3 ⁄ 4 0 x2 0
* The notation x· (x dot) is often used to denote the first derivative of the function x , that is, x· = dx ⁄ dt .
† The detailed solution of (1.23) is given in Signals and Systems with MATLAB Applications, ISBN 0−
9744239−9−8, Chapter 5.
Upon execution of the Simulink command, the Commonly Used Blocks are shown in Figure
1.4.
In Figure 1.4, the left side is referred to as the Tree Pane and displays all Simulink libraries
installed. The right side is referred to as the Contents Pane and displays the blocks that reside in
the library currently selected in the Tree Pane.
A block diagram representing (1.26) is shown in Figure 1.5. Now, we will use Simulink to draw a
similar block diagram.
−4
−3
1. On the Simulink Library Browser, we click the leftmost icon shown as a blank page on
the top title bar. A new model window named untitled will appear as shown in Figure 1.6.
J. Carver’s, Newburg, N. Y.
Ben.
J. Dickman Brown’s.
Perry.
H. L. Kreuder’s, Nanuet, N. Y.
Frank Forest.
Champion Victor.
Fritz.