System Simulation Techniques with MATLAB and Simulink - Dingyü Xue - E-Book

System Simulation Techniques with MATLAB and Simulink E-Book

Dingyü Xue

85,99 €


System Simulation Techniques with MATLAB and Simulinkcomprehensively explains how to use MATLAB and Simulink to performdynamic systems simulation tasks for engineering andnon-engineering applications. This book begins with covering the fundamentals of MATLABprogramming and applications, and the solutions to differentmathematical problems in simulation. The fundamentals of Simulinkmodelling and simulation are then presented, followed by coverageof intermediate level modelling skills and more advanced techniquesin Simulink modelling and applications. Finally the modelling and simulation of engineering andnon-engineering systems are presented. The areas covered includeelectrical, electronic systems, mechanical systems, pharmacokineticsystems, video and image processing systems and discrete eventsystems. Hardware-in-the-loop simulation and real-timeapplication are also discussed. Key features: * Progressive building of simulation skills using Simulink, frombasics through to advanced levels, with illustrations andexamples * Wide coverage of simulation topics of applications fromengineering to non-engineering systems * Dedicated chapter on hardware-in-the-loop simulation and realtime control * End of chapter exercises * A companion website hosting a solution manual and powerpointslides System Simulation Techniques with MATLAB and Simulink isa suitable textbook for senior undergraduate/postgraduate coursescovering modelling and simulation, and is also an ideal referencefor researchers and practitioners in industry.

Sie lesen das E-Book in den Legimi-Apps auf:

von Legimi
zertifizierten E-Readern

Seitenzahl: 621



Title Page




1 Introduction to System Simulation Techniques and Applications

1.1 Overview of System Simulation Techniques

1.2 Development of Simulation Software

1.3 Introduction to MATLAB

1.4 Structure of the Book



2 Fundamentals of MATLAB Programming

2.1 MATLAB Environment

2.2 Data Types in MATLAB

2.3 Matrix Computations in MATLAB

2.4 Flow Structures

2.5 Programming and Tactics of MATLAB Functions

2.6 Two-dimensional Graphics in MATLAB

2.7 Three-dimensional Graphics

2.8 Graphical User Interface Design in MATLAB

2.9 Accelerating MATLAB Functions



3 MATLAB Applications in Scientific Computations

3.1 Analytical and Numerical Solutions

3.2 Solutions to Linear Algebra Problems

3.3 Solutions of Calculus Problems

3.4 Solutions of Ordinary Differential Equations

3.5 Nonlinear Equation Solutions and Optimization

3.6 Dynamic Programming and its Applications in Path Planning

3.7 Data Interpolation and Statistical Analysis



4 Mathematical Modeling and Simulation with Simulink

4.1 Brief Description of the Simulink Block Library

4.2 Simulink Modeling

4.3 Model Manipulation and Simulation Analysis

4.4 Illustrative Examples of Simulink Modeling

4.5 Modeling, Simulation and Analysis of Linear Systems

4.6 Simulation of Continuous Nonlinear Stochastic Systems



5 Commonly Used Blocks and Intermediate-level Modeling Skills

5.1 Commonly Used Blocks and Modeling Skills

5.2 Modeling and Simulation of Multivariable Linear Systems

5.3 Nonlinear Components with Lookup Table Blocks

5.4 Block Diagram Based Solutions of Differential Equations

5.5 Output Block Library

5.6 Three-dimensional Animation of Simulation Results

5.7 Subsystems and Block Masking Techniques



6 Advanced Techniques in Simulink Modeling and Applications

6.1 Command-line Modeling in Simulink

6.2 System Simulation and Linearization

6.3 S-function Programming and Applications

6.4 Examples of Optimization in Simulation: Optimal Controller Design Applications



7 Modeling and Simulation of Engineering Systems

7.1 Physical System Modeling with Simscape

7.2 Description of SimPowerSystems

7.3 Modeling and Simulation of Electronic Systems

7.4 Simulation of Motors and Electric Drive Systems

7.5 Modeling and Simulation of Mechanical Systems



8 Modeling and Simulation of Non-Engineering Systems

8.1 Modeling and Simulation of Pharmacokinetics Systems

8.2 Video and Image Processing Systems

8.3 Finite State Machine Simulation and Stateflow Applications

8.4 Simulation of Discrete Event Systems with SimEvents



9 Hardware-in-the-loop Simulation and Real-time Control

9.1 Simulink and Real-Time Workshop

9.2 Introduction to dSPACE and its Blocks

9.3 Introduction to Quanser and its Blocks

9.4 Hardware-in-the-loop Simulation and Real-time Control Examples

9.5 Low Cost Solutions with NIAT

9.6 HIL Solutions with Even Lower Costs



Appendix: Functions and Models


This edition first published 2014 © 2014 John Wiley & Sons, Ltd

Registered office John Wiley & Sons Ltd, The Atrium, Southern Gate, Chichester, West Sussex, PO19 8SQ, United Kingdom

For details of our global editorial offices, for customer services and for information about how to apply for permission to reuse the copyright material in this book please see our website at

The right of the author to be identified as the author of this work has been asserted in accordance with the Copyright, Designs and Patents Act 1988.

All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording or otherwise, except as permitted by the UK Copyright, Designs and Patents Act 1988, without the prior permission of the publisher.

Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available in electronic books.

Designations used by companies to distinguish their products are often claimed as trademarks. All brand names and product names used in this book are trade names, service marks, trademarks or registered trademarks of their respective owners. The publisher is not associated with any product or vendor mentioned in this book.

Limit of Liability/Disclaimer of Warranty: While the publisher and author have used their best efforts in preparing this book, they make no representations or warranties with respect to the accuracy or completeness of the contents of this book and specifically disclaim any implied warranties of merchantability or fitness for a particular purpose. It is sold on the understanding that the publisher is not engaged in rendering professional services and neither the publisher nor the author shall be liable for damages arising herefrom. If professional advice or other expert assistance is required, the services of a competent professional should be sought.

MATLAB® is a trademark of MathWorks, Inc. and is used with permission. MathWorks, Inc. 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 MathWorks, Inc. of a particular pedagogical approach or particular use of the MATLAB® software.

Library of Congress Cataloging-in-Publication Data

Xue, Dingyü. System simulation techniques with MATLAB and Simulink / Dingyü Xue, YangQuan Chen.  1 online resource. Includes bibliographical references and index. Description based on print version record and CIP data provided by publisher; resource not viewed. ISBN 978-1-118-69435-0 (Adobe PDF) – ISBN 978-1-118-69437-4 (ePub) – ISBN 978-1-118-64792-9 (cloth)1. System analysis–Data processing. 2. Computer simulation. 3. MATLAB. 4. SIMULINK. I. Chen, YangQuan, 1966– II. Title. T57.62 620.00285′53–dc23


A catalogue record for this book is available from the British Library.

ISBN: 978-1-118-64792-9


It is a pleasure for me to write a foreword for this book by Dingyü Xue and YangQuan Chen. Dingyü came to the University of Sussex in 1988 to study for his DPhil with me. At the time, computing, relating to control engineering, was starting to move from Fortran to MATLAB, first on terminals connected to a central mainframe computer and then to standalone desktop machines. Digital simulation languages, which had replaced analog computers, were also heading in the same direction. The original version of MATLAB used on the mainframe was written in Fortran, followed by the much faster C version a few years later. One great advantage of MATLAB was that its fundamental data type was the matrix, the concept of which I first came across in the now little known language APL. APL was a very efficient coding language, so much so that a fair comment would be that it required as many lines of commenting as coding for a person to understand a program, and it also required a special keyboard. Other major features of MATLAB were the very good graph plotting facilities and the tools available for providing an excellent graphical user interface for a program. The graphical features provided for programming and for the display of results in Simulink were also a major improvement over the features of existing digital simulation languages.

In the early days of MATLAB, I had several general programs on the mainframe computer which used a question and answer interface and gave the output as a printed plot of points. Dingyü, in doing his research, developed a deep understanding of MATLAB and the capabilities of the GUI, one eventual result of which was the program CtrlLAB which is freely available from the MathWorks library. The genesis of this was a program described in my 1962 doctoral dissertation written in Manchester Autocode, which used paper tape to provide the data input and the values of points as output. Intermediate stages had seen its coding in APL and MATLAB using a question and answer format. Dingyü has therefore used MATLAB and Simulink avidly for the past 25 years, including, I suspect, most of the versions issued over that period. He has spent thousands of hours writing new code and modifying existing routines to be compatible, or to take advantage of new features in the changing versions of MATLAB and Simulink. I have known YangQuan Chen – whom Dingyü first met in Singapore about twenty years ago – for the past ten years. Since they first met, they have cooperated a lot with their complementary research interests being united by their use of MATLAB and Simulink.

This book is therefore written by two people who have had a wealth of first-hand experience of using MATLAB/Simulink in control engineering research and teaching its use to students in China and the USA in both mathematical and control-related courses for over two decades. Also, much of the material has been available in earlier versions of the book in Chinese, where it has been extremely well received, and it is used at many universities. Feedback from these publications has provided suggestions for improvements which have been incorporated here.

The coverage of the book is such that it provides a basic introduction to the use of MATLAB/Simulink before going on to address their usage in many facets of mathematics and engineering. After covering the general aspects of programming and computation in MATLAB, details of applications in many areas of scientific computation are given, covering areas such as differential equations and optimization. Chapters 3–6 are primarily devoted to Simulink, starting from consideration of the functions of the various blocks and continuing to describe a variety of applications covering topics such as linear and nonlinear system simulations, multivariable systems, vectorized blocks, output blocks, the animation of results, linearization of nonlinear systems, S-functions and optimization in simulations. Chapter 7 discusses the more specific engineering application blocks for electronic systems, electrical drive systems and so on, that are available in Simscape, and in chapter 8 some simulation applications for non-engineering systems, image processing and finite state machines are described which show the wide applicability of modeling and simulation techniques.

I’m sure that this book with its many examples and problems will prove a major asset to you, the reader, in learning the simulation capabilities of MATLAB/Simulink, but as Dingyü and YangQuan would no doubt confirm, the only way to really learn is by the hard work of “doing”. So attempt the exercises and also design your own to possibly clarify certain points and gain greater understanding.

Derek P Atherton Professor Emeritus University of Sussex, UKMarch 2013


As Confucius has said, “The mechanic, who wishes to do his work well, must first sharpen his tools”, so MATLAB/Simulink is the right tool to solve problems in the field of systems simulation. It can free the scientist and engineer from tedious, laborious and error-prone work in low-level computer programming, and it is obvious that by the use of MATLAB and Simulink, the efficiencies of researchers can be significantly improved. In communities such as systems simulation and control engineering, MATLAB/Simulink is the de facto international computer language, and the importance of such a tool is being taught in universities worldwide.

Although MATLAB itself was developed and advocated by mathematicians, it was in fact first acknowledged by researchers in the engineering community, and in particular, by the researchers in the field of control engineering. The development of MATLAB and Simulink received a significant amount of innovative contribution from scholars and researchers in the field of control engineering. Already, a significant number of toolboxes and blocksets are oriented to control problems. MATLAB itself has extremely strong capabilities for solving problems in scientific computation and system simulation, with its handy graphical facilities and integrated simulation facilities. It is being used by researchers in more and more engineering and other scientific fields, and it has huge potential and great applications possibilities in related fields.

The authors have been consistently using MATLAB in education and scientific research since 1988, and have had some of their MATLAB packages added to MATLAB Central. A significant amount of first-hand knowledge and experience have been accumulated.

The first author started introducing MATLAB into education more than twenty years ago, and has tried to instruct students in the use such tools. For instance, the book “Computer-aided control systems design — MATLAB languages and applications” published by Tsinghua University Press was regarded as the first of its kind and one of the best in China and has been cited by tens of thousands of journal papers and books. The second author has had more than ten years of experience of scientific research and education in universities in the United States, after his work in industry. He has built up a lot of experience in MATLAB/Simulink based simulation as well as hardware-in-the-loop simulation and real-time design of control systems. Two other books have also been written by the authors and introduced into English world, concentrating on, respectively, the fields of automatic control and scientific computation.

The first edition of this present book was published by Tsinghua University Press in Chinese in 2002, and the second edition was published there in 2011. It has been used as a textbook and reference book by many universities in China. With evolution of MATLAB, Simulink and related products, a lot of new material and innovative work has emerged. It is not possible to cover all the material in one book, so the material here was carefully chosen, and tailored to meet the demands of engineering students and researchers in the relevant disciplines. The current shape of this book was finalized in the course at the Northeastern University, China, and also by offering seminars and series lectures at Utah State University in the USA, at Baosteel Co. Ltd and at Harbin Institute of Technology in China. Based on the programming and educational experiences of over twenty years, the authors have finally debuted the book to the English-speaking world, and we feel sure that this book will be welcomed by readers worldwide.

The educational work in this book, together with other related educational work, was directed and encouraged by the former supervisors, Professors Xingquan Ren and Xinhe Xu of Northeastern University, China, and Professor Derek P Atherton at Sussex University, UK. It was them who guided the first author into the field of system simulation and, in particular, into the paradise of MATLAB/Simulink programming and education.

A lot of suggestions were received during the preparation of related books, and among them, the authors are in particular grateful for the help given by Professor Hengjun Zhu of Beijing Jiaotong University, the late Professor Jingqing Han of the Institute of System Sciences of Academia Sinica, Professor Xiaohua Zhang of Harbin Institute of Technology, China, and Professor Igor Podlubny of the University of Kosice, Slovakia.

Fruitful discussions with colleagues Drs Feng Pan, Dali Chen, Ying Wei, Jianjiang Cui, Liangyong Wang, Zheng Fang resulted in some new ideas and materials in this book, and Zhuo Li in proofreading an early draft of the book. The Chapter 9.6 was based on contribution of MESA LAB Ph.D. students Brandon Stark, Zhuo Li and Brendan Smith of UC Merced.

We wish to thank editorial staffs of Wiley: Tom Carter, Project Editor; Paul Petralia and Anne Hunt. Copyediting by Paul Beverley is particularly appreciated!

This book was supported by the MathWorks Book Program, and MATLAB, Simulink and related products can be acquired from

MathWorks, Inc., 3 Apple Hill Drive, Natick, MA, 01760-2098 USA

Tel:+01-508-647-7000, and FAX: +01-508-647-7101

Email: [email protected], Webpage:

Last but not least, the authors are grateful to their family members for the understanding and support during the years of working. Dingyü Xue would like to thank his wife, Jun Yang, and daughter Yang Xue, and YangQuan Chen would like to thank his wife, Huifang Dou, and his sons Duyun, David and Daniel.

Dingyü Xue, Northeastern University, ChinaYangQuan Chen, University California, Merced, USA


Fundamentals of MATLAB Programming

Different kinds of computer languages for system simulations have been summarized in Chapter 1. In this chapter, the top computation and simulation language MATLAB will be systematically introduced. The programming and skills of the MATLAB language will be presented. In Section 2.1, MATLAB windows and on-line help facilities will be presented. In Section 2.2, the fundamentals of MATLAB programming will be illustrated, including data types, statements and matrix representation. Matrix manipulations, such as algebraic computation, logical and relationship expressions and data conversion will be presented in Section 2.3. In Section 2.4, the use of flow charts in programming will be illustrated, including loop structures, conditional structures, switches and trial structures. In Section 2.5, the MATLAB function programming and pseudo code processing will be presented. Two-dimensional and three-dimensional graphics and visualization techniques will be presented in Sections 2.6 and 2.7. In Section 2.8, graphical user interface (GUI) techniques will be explained. Equipped with the new GUI programming skills, user-friendly interfaces can be designed. Section 2.9 will explore the skills of high speed, high efficiency programming, finally, we look at vectorized programming methodology and MEX programming fundamentals.

2.1 MATLAB Environment

2.1.1 MATLAB Interface

At the time of writing, the current version of MATLAB is R2012b (or MATLAB version 8.0), released by MathWorks Inc. in September 2012. Two versions are released each year, in March and September respectively and labeled versions a and b. If MATLAB is installed and invoked, the graphical interface shown in Fig. 2.1 will appear. Apart from the main Command Window, there are other windows, such as the Current Folder window, Command History window and Workspace window. The window layout can be rearranged with the → menu item. In MATLAB 8.0, brand new toolbar systems are made available.

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!