SlideShare a Scribd company logo
1 of 39
Download to read offline
Introduction to Simulink
Linguaggio Programmazione Matlab-Simulink (2018/2019)
Introduction to Simulink
โ€ขSimulink is a commercial tool for modeling, simulating and
analyzing dynamic systems.
โ€ขIts primary interface is a graphical block diagramming tool
and a customizable set of block libraries.
โ€ขIt offers tight integration with the rest of the MATLAB
environment and can either drive MATLAB or be scripted
from it.
โ€ขSimulink is widely used in control theory and digital signal
processing for simulation and design.
โ€ขA dynamic system may be given as a differential equation
Example: electric circuit
Example: electric circuit
Example: electric circuit
โ€ขCharacteristic equation:
๐‘ 2
+ 4๐‘  + 3 = 0 (B.6)
โ€ขThe transfer function:
H s =
3
s2+4s+3
(B.7)
โ€ขWe can plug this directly in Simulink
Implementation in Simulink
Running Simulink
Implementation in Simulink
Implementation in Simulink
Simulink Library Browser
Implementation in Simulink
Drag&Drop
Implementation in Simulink
โ€ขFrom the โ€˜Continousโ€™ module choose โ€˜Transfer Fcnโ€™ (drag
& drop)
โ€ขFrom the โ€˜Commonly Used Blocksโ€™ choose โ€˜Scopeโ€™
โ€ขMerge the blocks with arrows
โ€ขChange the โ€˜Transfer Fcnโ€™ (through double click)
โ€ขOptional: change the name of the blocks (double click on
names)
Implementation in Simulink
Run simulation
Double click on
โ€˜Scopeโ€™
Implementation in Simulink
Accuracy of the solution depends on
- Solver (numerical integration algorithm)
- Step size
โ€ขChange the โ€˜Transfer Fcnโ€™ to ๐‘ 2 + 0.1๐‘  + 10 = 0 and run
simulation
Implementation in Simulink
Implementation in Simulink
Implementation in Simulink
Improved accuracy!
Implementation in Simulink
Implementation: second method
โ€ขSimulate the same system using integrator blocks and
sum by rewriting (B.4):
๐‘‘2๐‘ฃ๐‘
๐‘‘๐‘ก2 = โˆ’4
๐‘‘๐‘ฃ๐‘
๐‘‘๐‘ก
โˆ’ 3๐‘ฃ๐‘ โˆ’ 3 ๐‘ข0(๐‘ก) (B.7)
โ€ขThe right side of (B.7) is the sum that yields
๐‘‘2๐‘ฃ๐‘
๐‘‘๐‘ก2 !
โ€ขInsert a โ€˜Sumโ€™ block from the โ€˜Math Operationsโ€™ library (put
3 inputs)
Implementation: second method
โ€ขSimulate the same system using integrator blocks and
sum by rewriting (B.4):
๐‘‘2๐‘ฃ๐‘
๐‘‘๐‘ก2 = โˆ’4
๐‘‘๐‘ฃ๐‘
๐‘‘๐‘ก
โˆ’ 3๐‘ฃ๐‘ โˆ’ 3 ๐‘ข0(๐‘ก) (B.7)
โ€ขThe right side of (B.7) is the sum that yields
๐‘‘2๐‘ฃ๐‘
๐‘‘๐‘ก2 !
โ€ขInsert a โ€˜Sumโ€™ block from the โ€˜Math Operationsโ€™ library (put
3 inputs)
Implementation: second method
โ€ขRember: the sum outputs
๐‘‘2๐‘ฃ๐‘
๐‘‘๐‘ก2
Implementation: second method
โ€ขIntegrating
๐‘‘2๐‘ฃ๐‘
๐‘‘๐‘ก2 we obtain
๐‘‘๐‘ฃ๐‘
๐‘‘๐‘ก
๐‘‘2๐‘ฃ๐‘
๐‘‘๐‘ก2
Implementation: second method
โ€ขAdd a multiply block โ€˜Gainโ€™ and set it to -4
๐‘‘2๐‘ฃ๐‘
๐‘‘๐‘ก2
Implementation: second method
โ€ขInvert the โ€˜Gainโ€™ (right click on โ€˜Gainโ€™, then โ€˜Flip Blockโ€™ or
CTRL-I)
๐‘‘2๐‘ฃ๐‘
๐‘‘๐‘ก2
Implementation: second method
โ€ขConnect with the output of the integrator
๐‘‘๐‘ฃ๐‘
๐‘‘๐‘ก
๐‘‘2๐‘ฃ๐‘
๐‘‘๐‘ก2
Implementation: second method
โ€ขConnect to the sum
๐‘‘2๐‘ฃ๐‘
๐‘‘๐‘ก2
๐‘‘๐‘ฃ๐‘
๐‘‘๐‘ก
Implementation: second method
โ€ขIntegrate
๐‘‘๐‘ฃ๐‘
๐‘‘๐‘ก
to compute
๐‘‘2๐‘ฃ๐‘
๐‘‘๐‘ก2
๐‘‘๐‘ฃ๐‘
๐‘‘๐‘ก
๐‘ฃ๐‘
๐‘ฃ๐‘
Implementation: second method
โ€ขMultiply ๐‘ฃ๐‘ by -3 and insert into the sum
๐‘‘2๐‘ฃ๐‘
๐‘‘๐‘ก2
๐‘‘๐‘ฃ๐‘
๐‘‘๐‘ก ๐‘ฃ๐‘
Implementation: second method
โ€ขInsert the input (step function)
๐‘‘2๐‘ฃ๐‘
๐‘‘๐‘ก2
๐‘‘๐‘ฃ๐‘
๐‘‘๐‘ก ๐‘ฃ๐‘
Implementation: second method
โ€ขMultiply the input by 3
๐‘‘2๐‘ฃ๐‘
๐‘‘๐‘ก2
๐‘‘๐‘ฃ๐‘
๐‘‘๐‘ก ๐‘ฃ๐‘
Implementation: second method
โ€ขInsert the โ€˜Scopeโ€™ block
๐‘‘2๐‘ฃ๐‘
๐‘‘๐‘ก2
๐‘‘๐‘ฃ๐‘
๐‘‘๐‘ก ๐‘ฃ๐‘
Implementation: second method
โ€ขNow all the signals are inserted in the block diagram:
๐‘‘๐‘ฃ๐‘
๐‘‘๐‘ก ๐‘ฃ๐‘
๐‘ข0
๐‘‘2๐‘ฃ๐‘
๐‘‘๐‘ก2
3๐‘ข0
Implementation: second method
โ€ขThe initial conditions are inserted by double clicking the
Integrator blocks and entering the values 0 for the first
integrator, and 0.5 for the second integrator.
๐‘‘2๐‘ฃ๐‘
๐‘‘๐‘ก2
๐‘‘๐‘ฃ๐‘
๐‘‘๐‘ก ๐‘ฃ๐‘
๐‘ข0
Implementation: second method
โ€ขRun the simulation: the result
looks similar with the previous
Implementation!
๐‘‘2๐‘ฃ๐‘
๐‘‘๐‘ก2
๐‘‘๐‘ฃ๐‘
๐‘‘๐‘ก ๐‘ฃ๐‘
๐‘ข0
Implementation: putting all together
โ€ขCopy and paste the first diagram in the same window:
This block do no accept
initial conditions!
Implementation: putting all together
โ€ขAdd a โ€˜Muxโ€™ with two inputs and a โ€˜Scopeโ€™.
Implementation: putting all together
โ€ขChange the initial conditions and see what happens. How
do you explain it?
Implementation: putting all together
โ€ขChange the equations, the solver and the step size:
analyze the results.
Implementation: putting all together
โ€ขChange the simulation timeโ€ฆ
Exercise 1
โ€ข Following the same steps, simulate the following dynamic
system:
๐‘‘๐‘ฅ
๐‘‘๐‘ก
+ 2๐‘ฅ ๐‘ก = ๐‘ข(๐‘ก)
where ๐‘ข(๐‘ก) is a square wave with an amplitude of 1 and a
frequency of 1 rad/sec and ๐‘ฅ ๐‘ก is the output of the system.
To generate a Square Wave use a โ€˜Signal Generatorโ€™ block and
select the Square Wave form but change the default units to
radiants/sec.
โ€ข Method 1: use a single block for the transfer function
โ€ข Method 2: use an โ€˜Integratorโ€™ block, a โ€˜Gainโ€™ block and a โ€˜Sumโ€™
block.
โ€ข What do you note in the absence of initial conditions?
โ€ข Hint: type โ€˜Model a Continuous Systemโ€™ in the Help search of
Matlab.
Exercise 2
โ€ขFor the following mass-spring-damper system, the inputs
are:
โ€ข M = 1Kg (mass)
โ€ข u = the gravity force Mg (g = 9.8)
โ€ข K = 5.0 N/m (spring constant)
โ€ข D = 0.05 Ns/m (damping coefficient)
โ€ข x(0) = 10 (initial position)
โ€ข xโ€™(0) = 0 (initial velocity)
โ€ข Find the equation of motion x(t) and perform the simulation with Simulink.
โ€ข Optional: use a Matlab file parameters.m to set (all) the input parameters.
โ€ข Hints:
1. for the input u(t) use the step function and multiply it by 9.8.
2. The equation is:
๐‘‘2๐‘ฅ
๐‘‘๐‘ก2
= โˆ’
๐ท
๐‘€
๐‘‘๐‘ฅ
๐‘‘๐‘ก
โˆ’
๐พ
๐‘€
๐‘ฅ + ๐‘”

More Related Content

Similar to Simulink 1.pdf

Lecture 7
Lecture 7Lecture 7
Lecture 7SALEH846
ย 
Simplex Algorithm
Simplex AlgorithmSimplex Algorithm
Simplex AlgorithmMuhammad Kashif
ย 
Simulink
SimulinkSimulink
Simulinkjackabraham
ย 
Lecture_control_system.pptx
Lecture_control_system.pptxLecture_control_system.pptx
Lecture_control_system.pptxrobomango
ย 
08 neural networks
08 neural networks08 neural networks
08 neural networksankit_ppt
ย 
BCA DATA STRUCTURES ALGORITHMS AND PRELIMINARIES MRS SOWMYA JYOTHI
BCA DATA STRUCTURES ALGORITHMS AND PRELIMINARIES MRS SOWMYA JYOTHIBCA DATA STRUCTURES ALGORITHMS AND PRELIMINARIES MRS SOWMYA JYOTHI
BCA DATA STRUCTURES ALGORITHMS AND PRELIMINARIES MRS SOWMYA JYOTHISowmya Jyothi
ย 
Fuzzy control design_tutorial
Fuzzy control design_tutorialFuzzy control design_tutorial
Fuzzy control design_tutorialResul ร‡รถteli
ย 
000000 lw04 simulink
000000 lw04 simulink000000 lw04 simulink
000000 lw04 simulinkdpm gumti
ย 
Final Project Report
Final Project ReportFinal Project Report
Final Project ReportRiddhi Shah
ย 
Pengenalan Simulink
Pengenalan SimulinkPengenalan Simulink
Pengenalan SimulinkLusiana Diyan
ย 
Control system Lab record
Control system Lab record Control system Lab record
Control system Lab record Yuvraj Singh
ย 
Introduction to Chainer
Introduction to ChainerIntroduction to Chainer
Introduction to ChainerSeiya Tokui
ย 
Java data types
Java data typesJava data types
Java data typesKuppusamy P
ย 
Book
BookBook
Bookmuli ani
ย 
Control engineering module 3 part-A
Control engineering  module 3 part-AControl engineering  module 3 part-A
Control engineering module 3 part-AMohammed Imran
ย 
Monte Carlo Simulation for project estimates v1.0
Monte Carlo Simulation for project estimates v1.0Monte Carlo Simulation for project estimates v1.0
Monte Carlo Simulation for project estimates v1.0PMILebanonChapter
ย 
Raymond.Brunkow-Project-EEL-3657-Sp15
Raymond.Brunkow-Project-EEL-3657-Sp15Raymond.Brunkow-Project-EEL-3657-Sp15
Raymond.Brunkow-Project-EEL-3657-Sp15Raymond Brunkow
ย 

Similar to Simulink 1.pdf (20)

Lecture 7
Lecture 7Lecture 7
Lecture 7
ย 
Using matlab simulink
Using matlab simulinkUsing matlab simulink
Using matlab simulink
ย 
Using matlab simulink
Using matlab simulinkUsing matlab simulink
Using matlab simulink
ย 
Simplex Algorithm
Simplex AlgorithmSimplex Algorithm
Simplex Algorithm
ย 
Simulink
SimulinkSimulink
Simulink
ย 
Lecture_control_system.pptx
Lecture_control_system.pptxLecture_control_system.pptx
Lecture_control_system.pptx
ย 
08 neural networks
08 neural networks08 neural networks
08 neural networks
ย 
BCA DATA STRUCTURES ALGORITHMS AND PRELIMINARIES MRS SOWMYA JYOTHI
BCA DATA STRUCTURES ALGORITHMS AND PRELIMINARIES MRS SOWMYA JYOTHIBCA DATA STRUCTURES ALGORITHMS AND PRELIMINARIES MRS SOWMYA JYOTHI
BCA DATA STRUCTURES ALGORITHMS AND PRELIMINARIES MRS SOWMYA JYOTHI
ย 
Fuzzy control design_tutorial
Fuzzy control design_tutorialFuzzy control design_tutorial
Fuzzy control design_tutorial
ย 
000000 lw04 simulink
000000 lw04 simulink000000 lw04 simulink
000000 lw04 simulink
ย 
Final Project Report
Final Project ReportFinal Project Report
Final Project Report
ย 
Pengenalan Simulink
Pengenalan SimulinkPengenalan Simulink
Pengenalan Simulink
ย 
Control system Lab record
Control system Lab record Control system Lab record
Control system Lab record
ย 
Introduction to Chainer
Introduction to ChainerIntroduction to Chainer
Introduction to Chainer
ย 
Java data types
Java data typesJava data types
Java data types
ย 
Book
BookBook
Book
ย 
Control engineering module 3 part-A
Control engineering  module 3 part-AControl engineering  module 3 part-A
Control engineering module 3 part-A
ย 
simulink
simulinksimulink
simulink
ย 
Monte Carlo Simulation for project estimates v1.0
Monte Carlo Simulation for project estimates v1.0Monte Carlo Simulation for project estimates v1.0
Monte Carlo Simulation for project estimates v1.0
ย 
Raymond.Brunkow-Project-EEL-3657-Sp15
Raymond.Brunkow-Project-EEL-3657-Sp15Raymond.Brunkow-Project-EEL-3657-Sp15
Raymond.Brunkow-Project-EEL-3657-Sp15
ย 

Recently uploaded

Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
ย 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
ย 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
ย 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEslot gacor bisa pakai pulsa
ย 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingrknatarajan
ย 
Top Rated Pune Call Girls Budhwar Peth โŸŸ 6297143586 โŸŸ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth โŸŸ 6297143586 โŸŸ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth โŸŸ 6297143586 โŸŸ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth โŸŸ 6297143586 โŸŸ Call Me For Genuine Se...Call Girls in Nagpur High Profile
ย 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
ย 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
ย 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college projectTonystark477637
ย 
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7Call Girls in Nagpur High Profile Call Girls
ย 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
ย 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
ย 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
ย 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
ย 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
ย 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
ย 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
ย 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
ย 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
ย 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
ย 

Recently uploaded (20)

Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
ย 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
ย 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
ย 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
ย 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
ย 
Top Rated Pune Call Girls Budhwar Peth โŸŸ 6297143586 โŸŸ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth โŸŸ 6297143586 โŸŸ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth โŸŸ 6297143586 โŸŸ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth โŸŸ 6297143586 โŸŸ Call Me For Genuine Se...
ย 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
ย 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
ย 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
ย 
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
ย 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
ย 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
ย 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
ย 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
ย 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
ย 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
ย 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
ย 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
ย 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
ย 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
ย 

Simulink 1.pdf

  • 1. Introduction to Simulink Linguaggio Programmazione Matlab-Simulink (2018/2019)
  • 2. Introduction to Simulink โ€ขSimulink is a commercial tool for modeling, simulating and analyzing dynamic systems. โ€ขIts primary interface is a graphical block diagramming tool and a customizable set of block libraries. โ€ขIt offers tight integration with the rest of the MATLAB environment and can either drive MATLAB or be scripted from it. โ€ขSimulink is widely used in control theory and digital signal processing for simulation and design. โ€ขA dynamic system may be given as a differential equation
  • 5. Example: electric circuit โ€ขCharacteristic equation: ๐‘ 2 + 4๐‘  + 3 = 0 (B.6) โ€ขThe transfer function: H s = 3 s2+4s+3 (B.7) โ€ขWe can plug this directly in Simulink
  • 11. โ€ขFrom the โ€˜Continousโ€™ module choose โ€˜Transfer Fcnโ€™ (drag & drop) โ€ขFrom the โ€˜Commonly Used Blocksโ€™ choose โ€˜Scopeโ€™ โ€ขMerge the blocks with arrows โ€ขChange the โ€˜Transfer Fcnโ€™ (through double click) โ€ขOptional: change the name of the blocks (double click on names) Implementation in Simulink
  • 12. Run simulation Double click on โ€˜Scopeโ€™ Implementation in Simulink
  • 13. Accuracy of the solution depends on - Solver (numerical integration algorithm) - Step size โ€ขChange the โ€˜Transfer Fcnโ€™ to ๐‘ 2 + 0.1๐‘  + 10 = 0 and run simulation Implementation in Simulink
  • 17. Implementation: second method โ€ขSimulate the same system using integrator blocks and sum by rewriting (B.4): ๐‘‘2๐‘ฃ๐‘ ๐‘‘๐‘ก2 = โˆ’4 ๐‘‘๐‘ฃ๐‘ ๐‘‘๐‘ก โˆ’ 3๐‘ฃ๐‘ โˆ’ 3 ๐‘ข0(๐‘ก) (B.7) โ€ขThe right side of (B.7) is the sum that yields ๐‘‘2๐‘ฃ๐‘ ๐‘‘๐‘ก2 ! โ€ขInsert a โ€˜Sumโ€™ block from the โ€˜Math Operationsโ€™ library (put 3 inputs)
  • 18. Implementation: second method โ€ขSimulate the same system using integrator blocks and sum by rewriting (B.4): ๐‘‘2๐‘ฃ๐‘ ๐‘‘๐‘ก2 = โˆ’4 ๐‘‘๐‘ฃ๐‘ ๐‘‘๐‘ก โˆ’ 3๐‘ฃ๐‘ โˆ’ 3 ๐‘ข0(๐‘ก) (B.7) โ€ขThe right side of (B.7) is the sum that yields ๐‘‘2๐‘ฃ๐‘ ๐‘‘๐‘ก2 ! โ€ขInsert a โ€˜Sumโ€™ block from the โ€˜Math Operationsโ€™ library (put 3 inputs)
  • 19. Implementation: second method โ€ขRember: the sum outputs ๐‘‘2๐‘ฃ๐‘ ๐‘‘๐‘ก2
  • 20. Implementation: second method โ€ขIntegrating ๐‘‘2๐‘ฃ๐‘ ๐‘‘๐‘ก2 we obtain ๐‘‘๐‘ฃ๐‘ ๐‘‘๐‘ก ๐‘‘2๐‘ฃ๐‘ ๐‘‘๐‘ก2
  • 21. Implementation: second method โ€ขAdd a multiply block โ€˜Gainโ€™ and set it to -4 ๐‘‘2๐‘ฃ๐‘ ๐‘‘๐‘ก2
  • 22. Implementation: second method โ€ขInvert the โ€˜Gainโ€™ (right click on โ€˜Gainโ€™, then โ€˜Flip Blockโ€™ or CTRL-I) ๐‘‘2๐‘ฃ๐‘ ๐‘‘๐‘ก2
  • 23. Implementation: second method โ€ขConnect with the output of the integrator ๐‘‘๐‘ฃ๐‘ ๐‘‘๐‘ก ๐‘‘2๐‘ฃ๐‘ ๐‘‘๐‘ก2
  • 24. Implementation: second method โ€ขConnect to the sum ๐‘‘2๐‘ฃ๐‘ ๐‘‘๐‘ก2 ๐‘‘๐‘ฃ๐‘ ๐‘‘๐‘ก
  • 25. Implementation: second method โ€ขIntegrate ๐‘‘๐‘ฃ๐‘ ๐‘‘๐‘ก to compute ๐‘‘2๐‘ฃ๐‘ ๐‘‘๐‘ก2 ๐‘‘๐‘ฃ๐‘ ๐‘‘๐‘ก ๐‘ฃ๐‘ ๐‘ฃ๐‘
  • 26. Implementation: second method โ€ขMultiply ๐‘ฃ๐‘ by -3 and insert into the sum ๐‘‘2๐‘ฃ๐‘ ๐‘‘๐‘ก2 ๐‘‘๐‘ฃ๐‘ ๐‘‘๐‘ก ๐‘ฃ๐‘
  • 27. Implementation: second method โ€ขInsert the input (step function) ๐‘‘2๐‘ฃ๐‘ ๐‘‘๐‘ก2 ๐‘‘๐‘ฃ๐‘ ๐‘‘๐‘ก ๐‘ฃ๐‘
  • 28. Implementation: second method โ€ขMultiply the input by 3 ๐‘‘2๐‘ฃ๐‘ ๐‘‘๐‘ก2 ๐‘‘๐‘ฃ๐‘ ๐‘‘๐‘ก ๐‘ฃ๐‘
  • 29. Implementation: second method โ€ขInsert the โ€˜Scopeโ€™ block ๐‘‘2๐‘ฃ๐‘ ๐‘‘๐‘ก2 ๐‘‘๐‘ฃ๐‘ ๐‘‘๐‘ก ๐‘ฃ๐‘
  • 30. Implementation: second method โ€ขNow all the signals are inserted in the block diagram: ๐‘‘๐‘ฃ๐‘ ๐‘‘๐‘ก ๐‘ฃ๐‘ ๐‘ข0 ๐‘‘2๐‘ฃ๐‘ ๐‘‘๐‘ก2 3๐‘ข0
  • 31. Implementation: second method โ€ขThe initial conditions are inserted by double clicking the Integrator blocks and entering the values 0 for the first integrator, and 0.5 for the second integrator. ๐‘‘2๐‘ฃ๐‘ ๐‘‘๐‘ก2 ๐‘‘๐‘ฃ๐‘ ๐‘‘๐‘ก ๐‘ฃ๐‘ ๐‘ข0
  • 32. Implementation: second method โ€ขRun the simulation: the result looks similar with the previous Implementation! ๐‘‘2๐‘ฃ๐‘ ๐‘‘๐‘ก2 ๐‘‘๐‘ฃ๐‘ ๐‘‘๐‘ก ๐‘ฃ๐‘ ๐‘ข0
  • 33. Implementation: putting all together โ€ขCopy and paste the first diagram in the same window: This block do no accept initial conditions!
  • 34. Implementation: putting all together โ€ขAdd a โ€˜Muxโ€™ with two inputs and a โ€˜Scopeโ€™.
  • 35. Implementation: putting all together โ€ขChange the initial conditions and see what happens. How do you explain it?
  • 36. Implementation: putting all together โ€ขChange the equations, the solver and the step size: analyze the results.
  • 37. Implementation: putting all together โ€ขChange the simulation timeโ€ฆ
  • 38. Exercise 1 โ€ข Following the same steps, simulate the following dynamic system: ๐‘‘๐‘ฅ ๐‘‘๐‘ก + 2๐‘ฅ ๐‘ก = ๐‘ข(๐‘ก) where ๐‘ข(๐‘ก) is a square wave with an amplitude of 1 and a frequency of 1 rad/sec and ๐‘ฅ ๐‘ก is the output of the system. To generate a Square Wave use a โ€˜Signal Generatorโ€™ block and select the Square Wave form but change the default units to radiants/sec. โ€ข Method 1: use a single block for the transfer function โ€ข Method 2: use an โ€˜Integratorโ€™ block, a โ€˜Gainโ€™ block and a โ€˜Sumโ€™ block. โ€ข What do you note in the absence of initial conditions? โ€ข Hint: type โ€˜Model a Continuous Systemโ€™ in the Help search of Matlab.
  • 39. Exercise 2 โ€ขFor the following mass-spring-damper system, the inputs are: โ€ข M = 1Kg (mass) โ€ข u = the gravity force Mg (g = 9.8) โ€ข K = 5.0 N/m (spring constant) โ€ข D = 0.05 Ns/m (damping coefficient) โ€ข x(0) = 10 (initial position) โ€ข xโ€™(0) = 0 (initial velocity) โ€ข Find the equation of motion x(t) and perform the simulation with Simulink. โ€ข Optional: use a Matlab file parameters.m to set (all) the input parameters. โ€ข Hints: 1. for the input u(t) use the step function and multiply it by 9.8. 2. The equation is: ๐‘‘2๐‘ฅ ๐‘‘๐‘ก2 = โˆ’ ๐ท ๐‘€ ๐‘‘๐‘ฅ ๐‘‘๐‘ก โˆ’ ๐พ ๐‘€ ๐‘ฅ + ๐‘”