SlideShare a Scribd company logo
1 of 19
MIT OpenCourseWare
http://ocw.mit.edu




6.094 Introduction to MATLAB®
January (IAP) 2009




For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
6.094
Introduction to Programming in MATLAB®



          Lecture 5: Simulink®




             Sourav Dey
           Danilo Šćepanović
              Ankit Patel
              Patrick Ho

                IAP 2009
What is Simulink?

• A model-based equation solver

• Some analysis packages (ANSYS, Multisim) have
  built in equations modeling complex engineering
  problems.
       Save lots of time
       Can only be used for tackling specific problems


• Simulink lets you build a GUI-based model and
  simulates the result.
       Unlimited complexity (constrained by runtime and
       memory)
       Adaptable for any field
       Downside? You have to do the modeling work
Getting Started

• Create a new file

• Examine the Simulink Library Browser
       Click on a library: “Sources”

       Drag a block into Simulink: “Constant”

       Visualize the block by going into “Sinks”

       Drag a “Scope” into Simulink
Connections

• Click on the carat/arrow on the right of the
  constant box

• Drag the line to the scope
       You’ll get a hint saying you can quickly connect
       blocks by hitting Ctrl
       Connections between lines represent signals


• Click the play button

• Double click on the scope.
       This will open up a chart of the variable over the
       simulation time
Simulink Math

• Everything is visual in Simulink!

• Click on the library Continuous
       Drag the integrator block between the constant and
       the scope


• Play and click on scope.

• What happens?
       Simulink has a built in ODE solver
       The equation that represents your model is solved by
       Simulink
       We’ve represented
Behind the curtain
• Go to “Simulation”->”Configuration Parameters”
  at the top menu
          See ode45? Change the solver type here




                Courtesy of The MathWorks, Inc. Used with permission.
So what’s going on?

• The toolboxes Simulink provides you are full of
  modeling tools

• By selecting components that correspond to your
  model, you can design a simulation
Toolboxes

• Math
        Takes the signal and performs a math operation
   » Add, subtract, round, multiply, gain, angle
• Continuous
        Adds differential equations to the system
   » Integrals, Derivatives, Transfer Functions,
     State Space
• Discontinuities
         Adds nonlinearities to your system
• Discrete
         Simulates discrete difference equations
         Useful for digital systems
Building systems

• Sources
  » Step input, white noise, custom input, sine
    wave, ramp input,
      Provides input to your system
• Sinks
  » Scope: Outputs to plot
  » simout: Outputs to a MATLAB vector on workspace
  » MATLAB mat file
Modifying Blocks
• Right click on the block, select the “Parameters” item
  corresponding to the item type
• Transfer Function:
   » Numerator on
   first row
   » Denominator on
   second row

• Summing Junction:
   » List of signs
   determines
   inputs to
   junction
   Not shown:
   Sampling time row
                           Courtesy of The MathWorks, Inc. Used with permission.
Modifying Scopes

• Within the scope:
  » Autoscale fits the axes
  to the curve automatically
  » Axes properties lets you
  customize the axes

• Changing the number of axes:
   » Left click on           icon                          Courtesy of The MathWorks, Inc. Used with permission.
             Courtesy of The MathWorks,
             Inc. Used with permission.


   » Change the number
   of axes field


   Courtesy of The MathWorks, Inc. Used with permission.
First System

• Drag a summing
  junction between the
  constant and
  integrator

• Change the signs to
  |+-

• Click on the open
  carat under the minus
  sign and connect it to
  the integrator output
Creating Subsystems

• Drag a box around the
  parts of the subsystem
        Summing Junction
        Integrator
• Right click and select
  “create subsystem”

• Double click the
  subsystem:
       The parts are now
       inside

• What’s the system do
  when you run it?
Example Systems
ODE                                         Classical Control System
d3y/dt3 + a*d2y/dt2 +
b* dy/dt + c*y = F




                                               Courtesy of The MathWorks, Inc. Used with permission.
                    Courtesy of The
                    MathWorks, Inc.
                    Used with permission.
Example: Nervous System

• Neural circuits in animals often exhibit oscillatory behavior

• Use Simulink to model one behavior of this type:
        Locomotion
             – Limbs go “Left-right, left-right, left-right”


• Locomotive behaviors are generated by “central pattern
  generators,” which oscillate on their own naturally

• When connected to an appendage, the central pattern
  generator will adapt its frequency and move the
  appendage. Open “RIOCPGDemo.mdl”

•   Model based on Iwasaki, T., Zheng, M. (2006a). Sensory feedback
    mechanism underlying entrainment of central pattern generator to
    mechanical resonance. Biological Cybernetics, 94(4), 245-261
Central Pattern Generator Model



                             Scope for
                              Output




 Limb
Playing with the model

• Look at scopes
       What are the output signals?
• Delete signals
       Especially the signal after the feedback gain
• Change gains
       Muscular actuator gains
       Switch feedback gain from negative to positive
• Look inside subsystems
       What’s inside the CPG?
       What’s inside the neuron firing dynamics?
Toolboxes

• Simulink has many advanced toolboxes
        Control Systems
        Neural Networks
        Signal Processing
        SimMechanics
        Virtual Reality
        Real Time

• Hopefully you’ll get to use some of these powerful tools!

More Related Content

Similar to learn matlab for ease Lec5

Simulink Presentation.ppt
Simulink Presentation.pptSimulink Presentation.ppt
Simulink Presentation.ppt
hodeeeeee1
 
Software Architectures, Week 2 - Decomposition techniques
Software Architectures, Week 2 - Decomposition techniquesSoftware Architectures, Week 2 - Decomposition techniques
Software Architectures, Week 2 - Decomposition techniques
Angelos Kapsimanis
 
Simulink7-GEtting Started Guide Simulink7-GEtting Started Guide.ppt
Simulink7-GEtting Started Guide Simulink7-GEtting Started Guide.pptSimulink7-GEtting Started Guide Simulink7-GEtting Started Guide.ppt
Simulink7-GEtting Started Guide Simulink7-GEtting Started Guide.ppt
HassenMOuakkad
 

Similar to learn matlab for ease Lec5 (20)

Intro to LV in 3 Hours for Control and Sim 8_5.pptx
Intro to LV in 3 Hours for Control and Sim 8_5.pptxIntro to LV in 3 Hours for Control and Sim 8_5.pptx
Intro to LV in 3 Hours for Control and Sim 8_5.pptx
 
Simulink Presentation.ppt
Simulink Presentation.pptSimulink Presentation.ppt
Simulink Presentation.ppt
 
Software Architectures, Week 2 - Decomposition techniques
Software Architectures, Week 2 - Decomposition techniquesSoftware Architectures, Week 2 - Decomposition techniques
Software Architectures, Week 2 - Decomposition techniques
 
When Should I Use Simulation?
When Should I Use Simulation?When Should I Use Simulation?
When Should I Use Simulation?
 
Simulink7-GEtting Started Guide Simulink7-GEtting Started Guide.ppt
Simulink7-GEtting Started Guide Simulink7-GEtting Started Guide.pptSimulink7-GEtting Started Guide Simulink7-GEtting Started Guide.ppt
Simulink7-GEtting Started Guide Simulink7-GEtting Started Guide.ppt
 
Applications of simulation in Business with Example
Applications of simulation in Business with ExampleApplications of simulation in Business with Example
Applications of simulation in Business with Example
 
simulink
simulinksimulink
simulink
 
Getting Started with Innoslate
Getting Started with InnoslateGetting Started with Innoslate
Getting Started with Innoslate
 
CONDITION BASED MONITORING AND CONTROL OF INDUCTION MOTOR USSING IOT
CONDITION BASED MONITORING AND CONTROL OF INDUCTION MOTOR USSING IOTCONDITION BASED MONITORING AND CONTROL OF INDUCTION MOTOR USSING IOT
CONDITION BASED MONITORING AND CONTROL OF INDUCTION MOTOR USSING IOT
 
Scilab
ScilabScilab
Scilab
 
Industry Training: 03 Awareness Simulation
Industry Training: 03 Awareness SimulationIndustry Training: 03 Awareness Simulation
Industry Training: 03 Awareness Simulation
 
000000 lw04 simulink
000000 lw04 simulink000000 lw04 simulink
000000 lw04 simulink
 
Discrete event simulation
Discrete event simulationDiscrete event simulation
Discrete event simulation
 
08 neural networks
08 neural networks08 neural networks
08 neural networks
 
scilab
scilabscilab
scilab
 
Mat lab workshop
Mat lab workshopMat lab workshop
Mat lab workshop
 
Tools for analysis and evaluation of CPU Performance
Tools for analysis and evaluation of CPU PerformanceTools for analysis and evaluation of CPU Performance
Tools for analysis and evaluation of CPU Performance
 
Machine Learning Essentials Demystified part2 | Big Data Demystified
Machine Learning Essentials Demystified part2 | Big Data DemystifiedMachine Learning Essentials Demystified part2 | Big Data Demystified
Machine Learning Essentials Demystified part2 | Big Data Demystified
 
Pcb design training in mumbai
Pcb design training in mumbaiPcb design training in mumbai
Pcb design training in mumbai
 
Developing Digital Twins
Developing Digital TwinsDeveloping Digital Twins
Developing Digital Twins
 

More from Amba Research (20)

Case Econ08 Ppt 16
Case Econ08 Ppt 16Case Econ08 Ppt 16
Case Econ08 Ppt 16
 
Case Econ08 Ppt 08
Case Econ08 Ppt 08Case Econ08 Ppt 08
Case Econ08 Ppt 08
 
Case Econ08 Ppt 11
Case Econ08 Ppt 11Case Econ08 Ppt 11
Case Econ08 Ppt 11
 
Case Econ08 Ppt 14
Case Econ08 Ppt 14Case Econ08 Ppt 14
Case Econ08 Ppt 14
 
Case Econ08 Ppt 12
Case Econ08 Ppt 12Case Econ08 Ppt 12
Case Econ08 Ppt 12
 
Case Econ08 Ppt 10
Case Econ08 Ppt 10Case Econ08 Ppt 10
Case Econ08 Ppt 10
 
Case Econ08 Ppt 15
Case Econ08 Ppt 15Case Econ08 Ppt 15
Case Econ08 Ppt 15
 
Case Econ08 Ppt 13
Case Econ08 Ppt 13Case Econ08 Ppt 13
Case Econ08 Ppt 13
 
Case Econ08 Ppt 07
Case Econ08 Ppt 07Case Econ08 Ppt 07
Case Econ08 Ppt 07
 
Case Econ08 Ppt 06
Case Econ08 Ppt 06Case Econ08 Ppt 06
Case Econ08 Ppt 06
 
Case Econ08 Ppt 05
Case Econ08 Ppt 05Case Econ08 Ppt 05
Case Econ08 Ppt 05
 
Case Econ08 Ppt 04
Case Econ08 Ppt 04Case Econ08 Ppt 04
Case Econ08 Ppt 04
 
Case Econ08 Ppt 03
Case Econ08 Ppt 03Case Econ08 Ppt 03
Case Econ08 Ppt 03
 
Case Econ08 Ppt 02
Case Econ08 Ppt 02Case Econ08 Ppt 02
Case Econ08 Ppt 02
 
Case Econ08 Ppt 01
Case Econ08 Ppt 01Case Econ08 Ppt 01
Case Econ08 Ppt 01
 
pyton Notes9
pyton Notes9pyton Notes9
pyton Notes9
 
Notes8
Notes8Notes8
Notes8
 
Notes7
Notes7Notes7
Notes7
 
pyton Notes6
 pyton Notes6 pyton Notes6
pyton Notes6
 
pyton Notes1
pyton Notes1pyton Notes1
pyton Notes1
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Recently uploaded (20)

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 

learn matlab for ease Lec5

  • 1. MIT OpenCourseWare http://ocw.mit.edu 6.094 Introduction to MATLAB® January (IAP) 2009 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
  • 2. 6.094 Introduction to Programming in MATLAB® Lecture 5: Simulink® Sourav Dey Danilo Šćepanović Ankit Patel Patrick Ho IAP 2009
  • 3. What is Simulink? • A model-based equation solver • Some analysis packages (ANSYS, Multisim) have built in equations modeling complex engineering problems. Save lots of time Can only be used for tackling specific problems • Simulink lets you build a GUI-based model and simulates the result. Unlimited complexity (constrained by runtime and memory) Adaptable for any field Downside? You have to do the modeling work
  • 4. Getting Started • Create a new file • Examine the Simulink Library Browser Click on a library: “Sources” Drag a block into Simulink: “Constant” Visualize the block by going into “Sinks” Drag a “Scope” into Simulink
  • 5. Connections • Click on the carat/arrow on the right of the constant box • Drag the line to the scope You’ll get a hint saying you can quickly connect blocks by hitting Ctrl Connections between lines represent signals • Click the play button • Double click on the scope. This will open up a chart of the variable over the simulation time
  • 6. Simulink Math • Everything is visual in Simulink! • Click on the library Continuous Drag the integrator block between the constant and the scope • Play and click on scope. • What happens? Simulink has a built in ODE solver The equation that represents your model is solved by Simulink We’ve represented
  • 7. Behind the curtain • Go to “Simulation”->”Configuration Parameters” at the top menu See ode45? Change the solver type here Courtesy of The MathWorks, Inc. Used with permission.
  • 8. So what’s going on? • The toolboxes Simulink provides you are full of modeling tools • By selecting components that correspond to your model, you can design a simulation
  • 9. Toolboxes • Math Takes the signal and performs a math operation » Add, subtract, round, multiply, gain, angle • Continuous Adds differential equations to the system » Integrals, Derivatives, Transfer Functions, State Space • Discontinuities Adds nonlinearities to your system • Discrete Simulates discrete difference equations Useful for digital systems
  • 10. Building systems • Sources » Step input, white noise, custom input, sine wave, ramp input, Provides input to your system • Sinks » Scope: Outputs to plot » simout: Outputs to a MATLAB vector on workspace » MATLAB mat file
  • 11. Modifying Blocks • Right click on the block, select the “Parameters” item corresponding to the item type • Transfer Function: » Numerator on first row » Denominator on second row • Summing Junction: » List of signs determines inputs to junction Not shown: Sampling time row Courtesy of The MathWorks, Inc. Used with permission.
  • 12. Modifying Scopes • Within the scope: » Autoscale fits the axes to the curve automatically » Axes properties lets you customize the axes • Changing the number of axes: » Left click on icon Courtesy of The MathWorks, Inc. Used with permission. Courtesy of The MathWorks, Inc. Used with permission. » Change the number of axes field Courtesy of The MathWorks, Inc. Used with permission.
  • 13. First System • Drag a summing junction between the constant and integrator • Change the signs to |+- • Click on the open carat under the minus sign and connect it to the integrator output
  • 14. Creating Subsystems • Drag a box around the parts of the subsystem Summing Junction Integrator • Right click and select “create subsystem” • Double click the subsystem: The parts are now inside • What’s the system do when you run it?
  • 15. Example Systems ODE Classical Control System d3y/dt3 + a*d2y/dt2 + b* dy/dt + c*y = F Courtesy of The MathWorks, Inc. Used with permission. Courtesy of The MathWorks, Inc. Used with permission.
  • 16. Example: Nervous System • Neural circuits in animals often exhibit oscillatory behavior • Use Simulink to model one behavior of this type: Locomotion – Limbs go “Left-right, left-right, left-right” • Locomotive behaviors are generated by “central pattern generators,” which oscillate on their own naturally • When connected to an appendage, the central pattern generator will adapt its frequency and move the appendage. Open “RIOCPGDemo.mdl” • Model based on Iwasaki, T., Zheng, M. (2006a). Sensory feedback mechanism underlying entrainment of central pattern generator to mechanical resonance. Biological Cybernetics, 94(4), 245-261
  • 17. Central Pattern Generator Model Scope for Output Limb
  • 18. Playing with the model • Look at scopes What are the output signals? • Delete signals Especially the signal after the feedback gain • Change gains Muscular actuator gains Switch feedback gain from negative to positive • Look inside subsystems What’s inside the CPG? What’s inside the neuron firing dynamics?
  • 19. Toolboxes • Simulink has many advanced toolboxes Control Systems Neural Networks Signal Processing SimMechanics Virtual Reality Real Time • Hopefully you’ll get to use some of these powerful tools!