Getting Started with Simulink

Getting Started with Simulink
eBook: $20.99
Formats: PDF, PacktLib, ePub and Mobi formats
save 15%!
Print + free eBook + free PacktLib access to the book: $55.98    Print cover: $34.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Table of Contents
Sample Chapters
  • Dig deep into Simulink
  • No unnecessary theory - start modelling right away
  • Complex concepts made easy through examples
  • Packed with illustrations and detailed step-by-step walkthroughs

Book Details

Language : English
Paperback : 126 pages [ 235mm x 191mm ]
Release Date : October 2013
ISBN : 178217138X
ISBN 13 : 9781782171386
Author(s) : Luca Zamboni
Topics and Technologies : All Books, Enterprise Products and Platforms, Enterprise

Table of Contents

Chapter 1: Simulink Facts
Chapter 2: Creating a Model
Chapter 3: Simulating a Model
Chapter 4: Using the Model
  • Chapter 1: Simulink Facts
    • What is Simulink?
      • Programming
      • Graphical
    • Problems solved by Simulink
      • Software specification
      • Software development
      • Software testing
    • Simulink drawbacks
    • Where Simulink excels
    • Summary
    • Chapter 2: Creating a Model
      • The MATLAB environment
        • Command Window – how MATLAB talks to us
        • The workspace – our treasury chest
        • The working folder – where MATLAB saves our work
        • The path – where MATLAB finds the tools
      • The Simulink interface
      • Our first model – a cruise controller
        • Step 1 – create and save the model
        • Step 2 – do comment the code!
        • Step 3 – open Simulink Library Browser
        • Step 4 – add blocks to the model from Library Browser
        • Step 5 – rename the blocks
        • Step 6 – implement the algorithm
        • Step 7 – nest the logic into subsystems
        • Step 8 – declare workspace variables
        • Step 9 – do a first simulation
      • Our second model – the Alfa Romeo 147 GTA
        • Getting the speed – Newton's laws
        • The aerodynamic drag equation
        • The rolling resistance approximation
        • The engine force – engine, wheels, and transmission
          • Gearbox and differential
          • Wheel to RPM
          • Engine
          • Torque to force
        • The finishing touches
      • Summary
      • Chapter 3: Simulating a Model
        • The mandatory theory
          • The simulation times – when the math is done
          • The solvers – these great unknown
            • Variable-step versus fixed-step solvers
            • Continuous versus discrete
            • Stiff versus nonstiff
        • Build the complete closed-loop system
        • Configuring the simulation
          • Simulation times
          • Solvers
        • Run our first serious simulation
          • Calibrate the PI controller
            • Calibrating Kp
            • Calibrating Ki
        • Test with other sources
          • Sine Wave
          • Ramp
          • Signal Builder
        • Summary
        • Chapter 4: Using the Model
          • The external software – a Qt5 application
          • The Swiss army knife – S-functions
            • The simulation phases
            • Level 2 MATLAB S-function callbacks
              • The mandatory callbacks
              • The most useful optional callbacks
            • The work vector – DWork
          • MATLAB S-functions – file source and sink blocks
            • The filesink_msfun block
              • The MATLAB code
            • The filesource_msfun block
              • The MATLAB code
            • A quick test
          • Simulink and the real world
            • Forcing Simulink to sync
            • Preparing the cruise controller model
            • Running the simulation on the target application
          • Going further – C MEX S-functions
            • Setting up the mex tool
              • UNIX-like systems (GNU/Linux in particular)
              • Microsoft Windows systems
            • How C MEX S-functions work
            • The required callbacks
              • mdlInitializeSizes
              • mdlInitializeSampleTimes
              • mdlOutputs
              • mdlTerminate
            • The most useful optional callbacks
              • mdlStart
              • mdlInitializeConditions
              • mdlUpdate
              • The DWork vector
              • The elementary work vectors
            • The filesource S-function
              • The beginning – headers and includes
              • Block properties and memory usage – mdlInitializeSizes
              • Timings – mdlInitializeSampleTimes
              • Initial tasks – mdlStart
              • Core logic – mdlOutputs
              • Update memories – mdlUpdate
              • Cleanup – mdlTerminate
              • The happy ending
              • Compiling the S-function
            • Exercise – the filesink S-function
            • A quick test
            • Go for another ride
          • Summary

          Luca Zamboni

          Luca Zamboni, born in Ivrea, Italy, obtained his Bachelor's and Master's degrees in Electronics Engineering from the Polytechnic of Turin. He worked as a network systems administrator for some years before becoming a consultant for the automotive industry. Now he works in FIAT's research center.
          Sorry, we don't have any reviews for this title yet.

          Code Downloads

          Download the code and support files for this book.

          Submit Errata

          Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


          - 2 submitted: last submission 19 Dec 2013

          *IMPORTANT* - The Code bundle of this book has been re-uploaded on December 19, 2013.

          Chapter 4     |       Page number: 98


          *Missing Text* at the end of The Beginning - headers and includes section is as follows:


          We have to define two constants that will be needed to read a file:

              #define FILEPATH_LEN 200   /* maximum file path length in bytes */

              #define FILELINE_LEN 1080  /* line large enough for 64 bit doubles + \0 */


          Sample chapters

          You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

          Frequently bought together

          Getting Started with Simulink +    Microsoft Exchange Server 2013 High Availability =
          50% Off
          the second eBook
          Price for both: €29.75

          Buy both these recommended eBooks together and get 50% off the cheapest eBook.

          What you will learn from this book

          • Understand the pros and cons of Simulink
          • Describe your ideas using block diagrams
          • Tune your simulation parameters
          • Draw clean, uncluttered models by reusing the logic and subdividing it into inner blocks
          • Run simulations with the appropriate source blocks
          • Analyse the simulation results with the scope block
          • Implement S-functions to reuse legacy code
          • Interface Simulink with applications outside the MATLAB environment

          In Detail

          Simulink is an engineer's Swiss army knife: instead of spending the day typing out complex formulas, Simulink enables you to both draw and execute them. Block after block, you can develop your ideas without struggling with obscure programming languages and you don't have to wait to debug your algorithm - just launch a simulation!

          Getting Started with Simulink will give you comprehensive knowledge of Simulink's capabilities. From the humble constant block to the S-function block, you will have a clear understanding of what modelling really means, without feeling that something has been left out. By the time you close the book, you'll be able to further extend your modelling skills without any help.

          We''ll start with a brief introduction, and immediately start placing the first blocks. Little by little, you'll build a car cruise controller model, followed by the mathematical model of a sports car in order to calibrate it. Then you'll learn how to interface your Simulink model with the external world. This book will give you an easy understanding of the tools Simulink offers you, guiding you through a complex exercise split into the three main phases of Simulink development: modelling, testing, and interfacing.


          This practical and easy-to-understand learning tutorial is one big exciting exercise for students and engineers that are always short on their schedules and want to regain some lost time with the help of Simulink.

          Who this book is for

          This book is aimed at students and engineers who need a quick start with Simulink. Though it's not required in order to understand how Simulink works, knowledge of physics will help the reader to understand the exercises described.

          Code Download and Errata
          Packt Anytime, Anywhere
          Register Books
          Print Upgrades
          eBook Downloads
          Video Support
          Contact Us
          Awards Voting Nominations Previous Winners
          Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
          Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software