MATLAB and Simulink In Depth Model based Design with Simulink and Stateflow User Interface Scripting Simulation Visualization and Debugging 1st Edition Priyanka Patankar download
MATLAB and Simulink In Depth Model based Design with Simulink and Stateflow User Interface Scripting Simulation Visualization and Debugging 1st Edition Priyanka Patankar download
https://ebookmeta.com/product/practical-design-and-application-
of-model-predictive-control-mpc-for-matlab-and-simulink-
users-1st-edition-khaled/
https://ebookmeta.com/product/audio-toolbox-user-s-guide-matlab-
simulink-1st-edition-mathworks/
https://ebookmeta.com/product/electrical-machine-fundamentals-
with-numerical-simulation-using-matlab-simulink-1st-edition-atif-
iqbal/
https://ebookmeta.com/product/urban-planning-for-transitions-1st-
edition-nicolas-douay/
Reproductive Technology and Surrogacy A Global
Perspective 1st Edition Hrafn Ásgeirsson Salvör Nordal
https://ebookmeta.com/product/reproductive-technology-and-
surrogacy-a-global-perspective-1st-edition-hrafn-asgeirsson-
salvor-nordal/
https://ebookmeta.com/product/advanced-machine-intelligence-and-
signal-processing-deepak-gupta/
https://ebookmeta.com/product/art-and-culture-patterns-of-the-
past-partitioning-shapes-lisa-a-willman/
https://ebookmeta.com/product/collaborative-construction-
procurement-and-improved-value-1st-edition-mosey-david/
https://ebookmeta.com/product/damned-if-you-do-1st-edition-alex-
brown/
Understanding Risk Management and Hedging in Oil
Trading: A Practitioner's Guide to Managing Risk 1st
Edition Chris Heilpern
https://ebookmeta.com/product/understanding-risk-management-and-
hedging-in-oil-trading-a-practitioners-guide-to-managing-
risk-1st-edition-chris-heilpern/
MATLAB
and
Simulink In-Depth
Priyanka Patankar
Swapnil Kulkarni
www.bpbonline.com
Copyright © 2022 BPB Online
All rights reserved. No part of this book may be reproduced, stored in a retrieval
system, or transmitted in any form or by any means, without the prior written
permission of the publisher, except in the case of brief quotations embedded in
critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy
of the information presented. However, the information contained in this book is
sold without warranty, either express or implied. Neither the author, nor BPB
Online or its dealers and distributors, will be held liable for any damages caused or
alleged to have been caused directly or indirectly by this book.
BPB Online has endeavored to provide trademark information about all of the
companies and products mentioned in this book by the appropriate use of capitals.
However, BPB Online cannot guarantee the accuracy of this information.
ISBN 978-93-55511-997
www.bpbonline.com
Dedicated to
My loving mothers:
Sandhya Patankar & Veena Bagul
My husband:
Pratik Jayraj Bagul
&
My newborn daughter
In memory of:
Chandrakant Omkar Patankar
—Priyanka Chandrakant Patankar
My beloved Parents:
Mrunalini and Mukund Devidas Kulkarni
&
Prajakta Pradeep Pujari
&
My wife Swarupa
In memory of:
Pradeep Shrikrishna Pujari
—Swapnil Mukund Kulkarni
About the Authors
Priyanka Patankar is a Technical Project Manager in the
automotive industry with over 11+ years of extensive experience in
Software development with MATLAB using model-based engineering
approach. She has completed her M.Tech in Software Systems from
Birla Institute of Technology and Science, Pilani. Since the beginning
of her career, she has had opportunities to work with leading
carmakers on body and comfort ECU software development. After
landing her dream job with a world-leading German carmaker, she
has been consistently delivering work products for upcoming luxury
cars and sharing the knowledge with her team. Through this book,
she wants to bring her experience to the application by inspiring the
readers to learn MATLAB and reduce the knowledge gap between
industry needs and education. She spends her free time learning
German language as well as exploring novel aspects of motherhood.
She also loves to travel to new destinations, where she clicks
photographs and shares them on her travel blog.
Swapnil Kulkarni is working as a Technical Project Manager in the
automotive industry. He has more than 12 years of strong
experience working in MATLAB. He has worked in several domains,
such as Body controllers, climate control modules and Infotainment
systems for various car manufacturers. He is also leading a team for
patterns and architecture, where he is responsible for validating
different types of model architectures and creating new patterns
with reusable libraries. He has accomplished several assignments on
Tool development and model architecture design with a leading
carmaker in Germany. Besides working, he regularly plays lawn
tennis, table tennis, and cricket. He also holds a special interest in
Hindustani Indian classical music.
About the Reviewer
Suraj Prakash Tallur is a Senior Technical Lead Engineer in Body
Comfort Domain with 8 years of automotive experience in model
based software development. He is extensively involved in MATLAB
Simulink modeling, DSPACE Target Link Auto code generation, TPT
MIL/ SIL testing and Canoe Virtual Integration testing for embedded
ECUs in automotive applications.
His area of work involves Cluster leadership, Stakeholder
coordination and providing technical solutions to requirements of
different stakeholders for various automotive applications via Model
based design and development.
He has worked with Japanese clients like Nissan, JATCO in Tata
Consultancy Services for 3 years and currently working in renowned
German OEM since past 5 years. He is Six-Sigma Green Belt and
ISTQB Foundation Level testing certified. He has a B.E. in E&E from
KLESCET VTU University Belgaum.
Acknowledgement
It is our great pleasure to avail this opportunity to thank everyone
who has helped us write this book directly or indirectly.
First and foremost, we want to express our gratitude towards the
Almighty for enabling us to acquire and share this knowledge. We
would like to thank our family members for staying patient,
encouraging and supportive throughout the development journey of
this book.
We are inclined towards expressing our gratefulness to this book’s
technical reviewer Mr. Suraj Tallur. His review comments bearing in
mind a reader’s perspective have been helpful in refining the
content. In addition, we would like to rightfully acknowledge the
prompt support and tool licenses received from MathWorks Book
program team. We are thankful towards The MathWorks, Inc. and
Mr.Joachim Loew for permitting usage of their images in the book.
Our heartfelt gratitude goes to the BPB Publications team for being
considerate, supportive, and comprehensible with us during each
development stage of this book.
Preface
We are delighted to share our book ‘MATLAB for Model-based design
and Simulation’ with our readers. Aptly suggested by the title, this
book aims to highlight basics of Model-based design and Simulation
by establishing MATLAB, Simulink and Stateflow core concepts.
MATLAB, which stands for Matrix Library, is a powerful solution
provided by MathWorks Inc. that has the capability to express matrix
and array arithmetic efficiently. MATLAB is a numerical computing
tool, whereas Simulink and Stateflow are Graphical Programming
tools. This book is an extensive guide to learning the fundamentals
of MATLAB, Simulink and Stateflow. It creates a solid foundation of
techniques widely used for model-based development. MATLAB is
expansively used in many industries such as Automotive, Aviation
and Aerospace, Health Care, Medical devices industry, Financial,
Information and Technology. MATLAB, when combined with Simulink
as well as Stateflow, offers multi-domain simulation, automatic code
generation, with testing and verification of embedded systems. With
the help of MATLAB and its toolboxes, the development and
evaluation of algorithms become considerably fast.
MATLAB is an enormous tool with several toolsets embedded within
it. When one wants to start MATLAB modelling by relying on
information available on the Internet or different community
websites, it results in information overload, which raises questions
such as where to start from, how to proceed, what are the key
concepts of MATLAB, Simulink and Stateflow, etc. In this book, we
have addressed most of these questions with some real-world
examples.
As a novice reader, you will begin MATLAB learning journey by
setting up the Tool environment in the system. Then you will get
familiar with the History and Significant features of MATLAB. You will
be acquainted with MATLAB’s desktop user interface and basic
commands, and you will learn data visualization as well. Further, you
will explore Simulink with its key features, configuration settings,
and libraries. You will go through the stepwise approach to create
and simulate a simple Simulink model. You will explore advanced
modelling techniques such as custom libraries, model referencing
and subsystems. You will also learn about test environment creation
and model simulation. Later, you will explore Stateflow concepts
such as flow graph, hierarchical model, conditions, actions,
transitions, etc.
A person who is new to MATLAB and Simulink or wants to quickly
refresh her/his knowledge shall find this book useful. Students,
teachers, researchers as well as professionals shall benefit from it.
This book has been designed specifically for beginners to help them
understand the core features of MATLAB, Simulink and Stateflow.
After reading this book, the reader shall have a strong foundation of
fundamental concepts of the topics, from where she/he can continue
towards attaining an advanced level of expertise. Though it is not
mandatory, having basic programming skills will make the learning
process more efficient and enjoyable.
This book has been derived from our extensive knowledge and
strong experience working with industry leaders. The reader shall be
able to kick off the journey of MATLAB model-based design and
Simulation with this book due to its simple and engaging language.
This journey becomes more exciting with the problem-based
practical examples and useful tips covered in the book. Additionally,
this book will certainly be a great help to crack interviews and exams
based on MATLAB model-based development with Simulink, and
Stateflow.
The book is distributed among three key sections- MATLAB, Simulink
and Stateflow. It comprises of total 15 chapters covering various
topics under these sections, explained as follows:
Section 1: MATLAB
Chapter 1 Introduction to MATLAB takes readers through the
history and origin of MATLAB. This chapter sets the context of
MATLAB applications. It also describes its various industry products
and toolboxes used for them. It provides detailed information on the
scope of the book, the installation procedure of MATLAB and its
toolboxes. It also explains how to do an Environmental setup.
Readers shall also understand the benefits of choosing MATLAB over
traditional programming methods.
Chapter 2 MATLAB Desktop Interface deals with the MATLAB
desktop interface and its functions. It makes the readers familiar
with different layouts, Windows, Workspaces, toolbars, and
introduces to some key shortcuts and settings.
Chapter 3 MATLAB basics covers the fundamental concepts and
core elements of MATLAB. It covers variables, arrays, constants,
datatypes, functions, etc. to establish a strong foundation of building
blocks.
Chapter 4 Programming Basics, Control flow and
Visualization introduces readers to various visualization possibilities
available in MATLAB. It covers multidimensional Plots, Graphs, and
Scopes, Images etc. as well.
Section 2: Simulink
Chapter 5 Introduction to Simulink introduces the basic
features of Simulink, which are essential to begin Model
development. This chapter narrates a stepwise approach to creating
a simple Simulink model using basic blocks. It shall explain the
difference between traditional and Model based design. Here the
reader shall learn how to create a blank model, how to design and
implement a simple logic, how to update the model, and how to
simulate the model using commonly used sources and sinks.
Chapter 6 Simulink Editor with Environment informs the
reader about Simulink graphical editor, its toolstrip and menus as
well as overall basic set-up. It shall explain model creation with a
simple example. This chapter also deals with different approaches to
creating an environment/wrapper for the developed model. In this
chapter, the reader shall learn techniques that are helpful to simulate
and test the model.
Chapter 7 Library browser overview provides detailed
information about the classification of Simulink block sets. Important
library blocks shall be explained in brief with few examples, such as
Sources, Sinks, Math Operations, Logic & bit Operations, Continuous,
Discrete, Signal routing and Lookup tables.
Chapter 8 Configuration Parameter settings talks about model
configuration parameters and the options available under different
sub-panes- such as Solver settings, Data Import/Export, Math and
Datatypes Pane, and Diagnostics Pane. Before beginning with the
model development, it is helpful for the reader to be familiar with
the model configuration settings to be fully aware of the capabilities
of Simulink.
Chapter 9 Advanced modelling techniques-I explains advanced
modelling techniques that ease the model design process. In this
chapter, the reader shall understand custom libraries, usage of
masking for library development and some other custom approaches
towards efficient model development.
Chapter 10 Advanced modelling techniques-II explains
additional advanced modelling techniques that ease the model
design process even further. In this chapter, the reader shall
understand in detail the topics such as Subsystems, model
referencing Pane, Hardware Implementation Pane and Signal bus.
Section 3: Stateflow
Chapter 11 Getting started with Stateflow introduces vital
features for model development using Stateflow. It informs about
advantages and use cases where Stateflow is preferred over
Simulink. In this chapter, the reader shall get familiar with Stateflow
graphical editor, its properties and advantages over Simulink.
Chapter 12 Flow graph explains a stepwise approach to creating
a simple flow graph model using transitions and junctions. It shall
explain the nodes and connections used to implement a flow graph
with the help of logic-driven design examples.
Chapter 13 Statecharts and Hierarchical state model explores
Statecharts and its features. In this chapter, the reader shall get to
know about state machines, control flow and data flow between
state machines, characteristics and hierarchy of the State model.
Chapter 14 event based execution describes event-based
execution in Stateflow. In this chapter, the user shall understand
different types of events and functions. We will clarify the usage of
these events, function calls, functions, and truth table with the help
of examples.
Chapter 15 Stateflow parsing and debugging narrates the
parsing and debugging techniques applicable to Stateflow. In this
chapter, we will be talking about different types of debugging
options and the possibilities of deploying Breakpoints. The reader
shall learn how to use animation and observe data during simulation
to simplify debugging.
In this book, we have tried our best to provide information as
accurate as possible. However, we understand that “To err is
human”, hence we wish to ask for readers’ forgiveness in case of any
shortcomings. We request the readers to provide their valuable
feedback and suggestions on the book and we will incorporate them
in subsequent editions.
—Priyanka Chandrakant Patankar
—Swapnil Mukund Kulkarni
Coloured Images
Please follow the link to download the
Coloured Images of the book:
https://rebrand.ly/omh0c8c
We have code bundles from our rich catalogue of books and videos
available at https://github.com/bpbpublications. Check them
out!
Errata
We take immense pride in our work at BPB Publications and follow
best practices to ensure the accuracy of our content to provide with
an indulging reading experience to our subscribers. Our readers are
our mirrors, and we use their inputs to reflect and improve upon
human errors, if any, that may have occurred during the publishing
processes involved. To let us maintain the quality and help us reach
out to any readers who might be having difficulties due to any
unforeseen errors, please write to us at :
[email protected]
Your support, suggestions and feedbacks are highly appreciated by
the BPB Publications’ Family.
Did you know that BPB offers eBook versions of every book
published, with PDF and ePub files available? You can upgrade
to the eBook version at www.bpbonline.com and as a print
book customer, you are entitled to a discount on the eBook
Another Random Scribd Document
with Unrelated Content
prejudice against whatever was practised by illiterate persons,
without reflecting that, illiterate as they are, their employers are not
all so; and that, unless success attended their practices, they would
cease to be employed.
For the French mode, twitching, &c., vide Goodwin, Blaine, &c.
Besides this large and ferocious species, the warrens upon the coast
suffer much injury from the common cat becoming wild and
burrowing in the rabbit-holes. They are sometimes surprised and
shot in the sand-banks, or taken in traps; but they are generally too
wary to be approached—and hunting only by night, during the day
they sleep in their dens, and are rarely met abroad.
Some estimate of their numbers may be formed, from the
circumstance of five males having been killed in a herdsman’s
outhouse which joined the warren. They had been attracted there by
one of their own species, and the noise having alarmed the peasant,
he guessed the cause, and cautiously managed to stop the hole by
which they gained entrance, with a turf-cleave. Knowing the value of
the capture, he kept guard upon the prisoners till morning, and then
despatched information to the Lodge. My cousin, with his followers,
promptly repaired to the place, and surrounding the barn with guns
and greyhounds, bolted the wild cats successively, until the whole
number were despatched. This chassé was not only novel, but
profitable. After the death of their persecutors, the rabbits increased
prodigiously; but fears are entertained that these destructive animals
are become once more abundant in the sand-banks.
Cats are said, when they wash their faces, or when they seem
sleepy and dull, to foretel rain. The same is said of them when they
appear irritable and restless, and play with their tails.—Buffon—Wild
Sports—Foster.
Cataplasm, s. A poultice.
Barbadoes
aloes 5 dr.
powdered, to 1
from oz.
Hard soap 3 to 4
dr.
Ginger 1 dr.
Water 1 dr.
Oil of cloves 10
drops.
Beat the soap, oil of cloves, and water together in a mortar, so as to
form a paste; if necessary use more water. Add the powdered aloes
and ginger, and beat the whole into a ball.—White.
Cattle, s. Beasts of pasture, not wild or domestic.
MILD CAUSTICS,
SOLID.
No. Acetate of
1. copper, or
distilled
verdigris.
2. Sulphate of
copper, or
blue vitriol.
3. Red nitrated
quicksilver,
red
precipitate,
or nitric
oxide of
mercury.
4. Burnt alum.
5. Common
verdigris.
The mild require to be finely powdered and sprinkled on the ulcer;
and are sometimes mixed with digestive ointments to increase their
power.
STRONG CAUSTICS,
LIQUID.
No. Solution of
1. blue vitriol.
2. Any of the
stronger
caustics,
except
butter of
antimony,
diluted with
an equal
quantity, or
more, of
water.
3. Muriatic acid.
4. Muriate of
iron.—
White.
Cauterize, v. To burn with the cautery.
2. Yellow rosin 1
lb.
Bees-wax 8
oz.
Common 2
turpentine oz.
Armenian 4
bole, oz.
powdered —
Mix.
The first three are to be melted together, and then the latter is to be
added. The mixture is to be constantly stirred until sufficiently cold
to be applied; and if it prove too thick when cold, it may be softened
with a little oil or lard.
1. Move your pawns before your pieces, and afterwards bring out
the pieces to support them; therefore the king’s, queen’s and
bishops’ pawns should be the first played, in order to open the game
well.
2. Do not, therefore, play out any of your pieces early in the game,
because you thereby lose moves, in case your adversary can, by
playing a pawn, make them retire, and he also opens his game at
the same time: especially avoid playing your queen out, till your
game is tolerably well opened.
3. Avoid giving useless checks, and never give any unless to gain
some advantage, because you may lose the move, if the adversary
can either take or drive your piece away.
4. Never crowd your game by having too many pieces together, so
as to prevent your men advancing or retreating as occasion may
require.
5. If your game should be crowded, endeavour to free it by
exchanges of pieces or pawns, and castle your king as soon as
convenient; afterwards bring out your pieces, and attack the
adversary where weakest.
6. When the adversary plays out his pieces before his pawns, attack
them as soon as you can with your pawns, by which you may crowd
his game and make him lose moves.
7. Never attack the adversary’s king without a sufficient force; and if
he attack yours, and you cannot retaliate, offer exchanges; and
should he retire, when you present a piece to exchange, he may lose
a move. It also may sometimes be expedient to act in this manner in
case of other attacks.
8. Play your men in guard of one another, so that if any be taken,
the enemy may also be captured by that which guarded yours, and
endeavour to have as many guards to your piece, as your adversary
advances others upon it; and, if possible, let them be of less value
than those he assails with. When you cannot well support your
piece, see if by attacking one of his that is better, or as good, you
may not thereby save yours.
9. Never attack but when well prepared, for thereby you open your
adversary’s game, and prepare him to pour in a strong attack upon
you, as soon as your weaker one is over.
10. Never play till you have examined whether you are free from
danger by your adversary’s last move; nor offer to attack till you
have considered what harm he would be able to do you by his next
moves, in consequence of yours.
11. When your attack is in a prosperous way, never be diverted from
it by taking any piece, or other seeming advantage, your adversary
may purposely throw in your way, with the intent that, by your
taking the bait, he might gain a move which would make your
design miscarry.
12. When, in pursuing a well-laid attack, you find it necessary to
force your adversary’s defence, with the loss of some pieces; if, upon
counting as many moves forward as you can, you find a prospect of
success, sacrifice a piece or two to gain your end: these bold
attempts make the finest games.
13. Never let your queen stand so before the king, as that your
adversary, by bringing forwards a rook or a bishop, might check your
king if she were not there, for you could hardly save her, or perhaps
at best must sacrifice her for an inferior piece; as for example: place
the white king on 61, the queen on 53; the black king on 4, and the
rook, on 16: which last, if moved to 13, must be taken by the white
queen, who in return would be taken by the black king, because the
white queen could not otherwise be moved without putting the king
on check to the black rook.