0% found this document useful (0 votes)
55 views42 pages

Simulink Modeling & Simulation Guide

Fundamental of Matlab in Science
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views42 pages

Simulink Modeling & Simulation Guide

Fundamental of Matlab in Science
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 42

Dingyu Xue, YangQuan Chen

System Simulation Techniques with


MATLAB and Simulink
A JOHN WILEY & SONS, INC., PUBLICATION 2013

CHAPTER 4
MATHEMATICAL MODELING AND SIMULATIO
N WITH SIMULINK
Dingyu Xue
Northeastern University, Shenyang, China

CHAPTER 4 MATHEMATICAL MODELING AND SIMULATION WITH SIMULINK


Dingyu Xue, YangQuan Chen System Simulation Techniques with MATLAB and
12/12/24 18:49 Simulink 2013
Chapter 4 Mathematical Modeling and
Simulation with Simulink
The main content
 Brief Description of the Simulink Block Library
 Simulink Modeling
 Model Manipulation and Simulation Analysis
 Illustrative Examples of Simulink Modeling
 Modeling, Simulation and Analysis of Linear Syste
ms
 Simulation of Continuous Nonlinear Stochastic Sys
tems CHAPTER 4 MATHEMATICAL MODELING AND SIMULATION WITH SIMULINK
Dingyu Xue, YangQuan Chen System Simulation Techniques with MATLAB and
12/12/24 18:49 Simulink 2013
4.1 Brief Description of the Simulink
Block Library
The previous name for Simulink was “Simulab”, relea
sed in 1990
Renamed as Simulink in 1991
Modeling and simulation based on block diagram
Commonly Used Blocks:
 Sources, Sinks, Continuous, Discrete, Math Operations, Log
ic and Bit Operations, Discontinuities , Lookup Tables, Sign
als Routing,Signal Attributes, User-defined Functions and P
orts & Subsystems, Other blocks
CHAPTER 4 MATHEMATICAL MODELING AND SIMULATION WITH SIMULINK
Dingyu Xue, YangQuan Chen System Simulation Techniques with MATLAB and
12/12/24 18:49 Simulink 2013
Signal Sources

Signal Generator:
 Square waves, sinusoidal and sawtooth signals
Band-Limited White Noise, continuous:
 Other random blocks: such as Random Number and
Uniform Random Number
From File block and From Workspace block
Clock block: generate current time

CHAPTER 4 MATHEMATICAL MODELING AND SIMULATION WITH SIMULINK


Dingyu Xue, YangQuan Chen System Simulation Techniques with MATLAB and
12/12/24 18:49 Simulink 2013
Constant block
Ground block
Various of other input blocks
 Step, Pulse Generator, Ramp and Sine Wave block
s, Repeating Sequence generate arbitrary periodic i
nputs

CHAPTER 4 MATHEMATICAL MODELING AND SIMULATION WITH SIMULINK


Dingyu Xue, YangQuan Chen System Simulation Techniques with MATLAB and
12/12/24 18:49 Simulink 2013
Continuous Blocks
Transfer Fcn block

State-Space block

Pole-Zero block

PID controllers
CHAPTER 4 MATHEMATICAL MODELING AND SIMULATION WITH SIMULINK
Dingyu Xue, YangQuan Chen System Simulation Techniques with MATLAB and
12/12/24 18:49 Simulink 2013
Discrete-time Blocks
Zero-Order Hold and First-Order Hold blocks
Discrete Transfer Fcn

Discrete State-Space

Discrete Zero-Pole

Filter, Unit Delay, Integer Delay, Differences, Discret


e Derivative, Discrete-Time Integrator, Transfer Fcn
Lead or Lag blocks
CHAPTER 4 MATHEMATICAL MODELING AND SIMULATION WITH SIMULINK
Dingyu Xue, YangQuan Chen System Simulation Techniques with MATLAB and
12/12/24 18:49 Simulink 2013
Math Blocks
Gain block: The block can be used for matrix as well a
s dot multiplication of the input signals
Sum, Subtract, Abs, and Product
Algebraic Constraint block
Complex to Real-Imag
Complex to Magnitude-Angle
Commonly used math blocks
 Abs
 Trigonometric Function
 Sign
 Rounding Function
CHAPTER 4 MATHEMATICAL MODELING AND SIMULATION WITH SIMULINK
Dingyu Xue, YangQuan Chen System Simulation Techniques with MATLAB and
12/12/24 18:49 Simulink 2013
Lookup Table Blocks
One-, two- and multi-dimensional lookup table
s
Other Lookup Table
 Lookup Table (n-D)
 Lookup Table Dynamic
 Direct Lookup Table (n-D)
 Lookup Table Dynamic and Interpolation Using Pre
lookup
We can construct arbitrary piecewise linear stat
ic nonlinearity functions
Illustrative examples later
CHAPTER 4 MATHEMATICAL MODELING AND SIMULATION WITH SIMULINK
Dingyu Xue, YangQuan Chen System Simulation Techniques with MATLAB and
12/12/24 18:49 Simulink 2013
User-defined Functions
Fcn block
User-defined MATLAB function blocks:
 MATLAB Fcn
 Embedded MATLAB Function
S-function block
 Using languages such as MATLAB, C, Fortran and
Ada
 System files, describing nonlinear state space equa
tions
 Describing the complexity of a system in principle
CHAPTER 4 MATHEMATICAL MODELING AND SIMULATION WITH SIMULINK
Dingyu Xue, YangQuan Chen System Simulation Techniques with MATLAB and
12/12/24 18:49 Simulink 2013
Nonlinearity Blocks
Coulomb & Viscous Friction
Backlash
Hit Crossing
Piecewise linear static nonlinearity blocks
 Saturation
 Dead Zone
 Quantizer
 Relay
 Rate Limiter
Dynamic parameters Saturation, Dead Zone, Rate Limite
r blocks
Implemented by one-dimensional lookup table blocks
CHAPTER 4 MATHEMATICAL MODELING AND SIMULATION WITH SIMULINK
Dingyu Xue, YangQuan Chen System Simulation Techniques with MATLAB and
12/12/24 18:49 Simulink 2013
Output Blocks
Out1 block
Scope blocks
 Ordinary scopes
 Floating Scope
 x-y Graph
To Workspace
To File
Display
Stop Simulation
Terminator
CHAPTER 4 MATHEMATICAL MODELING AND SIMULATION WITH SIMULINK
Dingyu Xue, YangQuan Chen System Simulation Techniques with MATLAB and
12/12/24 18:49 Simulink 2013
Signal Related Blocks
Mux and Demux blocks
Model Info
Selector
Various switch blocks
 Switch
 Manual Switch
 Multiport Switch
Signal transfer blocks, From and Goto
CHAPTER 4 MATHEMATICAL MODELING AND SIMULATION WITH SIMULINK
Dingyu Xue, YangQuan Chen System Simulation Techniques with MATLAB and
12/12/24 18:49 Simulink 2013
Ports and Subsystem Blocks
Input, output: In1, Out1
Trigger
Enable
Atomic Subsystem
Triggered Subsystem
Enabled Subsystem
Flow control subsystems
 For loop, while loop, if clause and the switch structure
Model block can be used to embed another existing S
imulink model
CHAPTER 4 MATHEMATICAL MODELING AND SIMULATION WITH SIMULINK
Dingyu Xue, YangQuan Chen System Simulation Techniques with MATLAB and
12/12/24 18:49 Simulink 2013
Commonly Used Blocks

In order to provide easy access to the block lib


rary, the commonly used blocks can be put int
o a group.
One can add or remove blocks to and from the
group, so that the next time the group is opene
d, most of the blocks to be used in modeling ar
e already in the window.

CHAPTER 4 MATHEMATICAL MODELING AND SIMULATION WITH SIMULINK


Dingyu Xue, YangQuan Chen System Simulation Techniques with MATLAB and
12/12/24 18:49 Simulink 2013
Other Toolboxes and Blocksets
Aerospace Blockset
Comm Blockset
DSP Blockset
Gauges Blockset
Blocksets and toolboxes used for interfacing the
existing MATLAB toolboxes
 Control System Toolbox
 Fuzzy Logic Toolbox
 Neural Network Blockset
 Model Predictive Blockset
 System Identification Toolbox
Simscape
CHAPTER 4 MATHEMATICAL MODELING AND SIMULATION WITH SIMULINK
Dingyu Xue, YangQuan Chen System Simulation Techniques with MATLAB and
12/12/24 18:49 Simulink 2013
Professional engineering simulation blocksets
 SimPowerSystems, SimHydraulics, SimMechanics,
SimDriveline, SimElectronics
SimEvents
Simulink 3D Animation blockset
Real-time control blocksets
 Real-Time Workshop, xPC blockset, Fixed-Point B
lockset
Video & Image Processing Blockset
Image Acquisition Toolbox

CHAPTER 4 MATHEMATICAL MODELING AND SIMULATION WITH SIMULINK


Dingyu Xue, YangQuan Chen System Simulation Techniques with MATLAB and
12/12/24 18:49 Simulink 2013
4.2 Simulink Modeling
Establishing a Model Window: Several methods
Connecting and Simple Manipulation of Blocks
 Connecting and skills
 Rotating
 Flipping
Parameter Modification in Blocks
 Fill in function block parameters
 Block modification

CHAPTER 4 MATHEMATICAL MODELING AND SIMULATION WITH SIMULINK


Dingyu Xue, YangQuan Chen System Simulation Techniques with MATLAB and
12/12/24 18:49 Simulink 2013
4.3 Model Manipulation and Simulatio
n Analysis
The main content
 Model Creation and Fundamental Modeling Skills
 Model Explorer
 Online Help System in Simulink
 Output and Printing of Simulink Models
 Simulink Environment Setting
 Debugging Tools of Simulink Models

CHAPTER 4 MATHEMATICAL MODELING AND SIMULATION WITH SIMULINK


Dingyu Xue, YangQuan Chen System Simulation Techniques with MATLAB and
12/12/24 18:49 Simulink 2013
Model Creation and Fundamental Mo
deling Skills
E.g.4.1 Traditional linear system analysis methods m
ay fail completely

Creating block diagrams in Simulink


Blocks needed: Step input, Sum, nonlinear Saturation,
three Transfer Fcn, Scope
Connecting, Parameter modification, saving
CHAPTER 4 MATHEMATICAL MODELING AND SIMULATION WITH SIMULINK
Dingyu Xue, YangQuan Chen System Simulation Techniques with MATLAB and
12/12/24 18:49 Simulink 2013
Model Creation and Model Explorer
Model Creation
 Opening a blank window
 Copying the blocks to the model window
 Connecting, The simplest way: Ctrl + Click
 The connection of the feedback block
 Parameter modification
Model explorer of the model simulation
Launching the model explorer
View | Model Explorer
CHAPTER 4 MATHEMATICAL MODELING AND SIMULATION WITH SIMULINK
Dingyu Xue, YangQuan Chen System Simulation Techniques with MATLAB and
12/12/24 18:49 Simulink 2013
Others about Simulation Analysis
Online help: Help | Help on the selected block, F1
Printing of Simulink Models
 Print -deps –s file_name
 Menu Edit | Copy Model to Clipboard
Simulink Environment Setting
 Solver pane: Simulation interval setting, Simulation accurac
y setting,Accurate processing of output signals, Zero-crossi
ng detection, etc.
 Data Import/Export pane : tout/yout
 Diagnostics pane: Algebraic loop, etc.
Debugging Tools of Simulink Models: Model Adviso
r
CHAPTER 4 MATHEMATICAL MODELING AND SIMULATION WITH SIMULINK
Dingyu Xue, YangQuan Chen System Simulation Techniques with MATLAB and
12/12/24 18:49 Simulink 2013
4.4 Illustrative Examples of Simulink
Modeling
Van der Pol equations

The key signals: expressed as integrators


Several modeling methods
 Setting the integrator initial value
 Direct bottom block construction
 Fcn blocks (introducing this later)
CHAPTER 4 MATHEMATICAL MODELING AND SIMULATION WITH SIMULINK
Dingyu Xue, YangQuan Chen System Simulation Techniques with MATLAB and
12/12/24 18:49 Simulink 2013
Model name: c4mvdp.mdl
Initial values

Simulation

Simulink model with an xy scope: Model nam


e: c4mvdp1.mdl
A new phase plane trajectory can be obtained
x-y scope parameter setting
Another model: c4mvdp2.mdl
CHAPTER 4 MATHEMATICAL MODELING AND SIMULATION WITH SIMULINK
Dingyu Xue, YangQuan Chen System Simulation Techniques with MATLAB and
12/12/24 18:49 Simulink 2013
Solving the problem by means of mode
ls and statements
It's easy to solve the former example by means of
ode45
DC motor drive system

ode45 is not appropriate


By means of Simulink model: c4mex2.mdl
CHAPTER 4 MATHEMATICAL MODELING AND SIMULATION WITH SIMULINK
Dingyu Xue, YangQuan Chen System Simulation Techniques with MATLAB and
12/12/24 18:49 Simulink 2013
Nonlinear Model Simulation
Nonlinear model

Nonlinear component existing, ode45 is unfit


Backlash nonlinear component
Simulink model: c4mex3.mdl
Simulation:
 Modifying C1 and simulation, modifying amplitude and sim
ulation
CHAPTER 4 MATHEMATICAL MODELING AND SIMULATION WITH SIMULINK
Dingyu Xue, YangQuan Chen System Simulation Techniques with MATLAB and
12/12/24 18:49 Simulink 2013
Sample-data System Simulation
System model

Ode45 is not appropriate


Sampling interval: 0.1s
Simulink model: c4mex4.mdl
The transfer function is represented by two blocks
Signals in system
 Zero-Order Hold signal
CHAPTER 4 MATHEMATICAL MODELING AND SIMULATION WITH SIMULINK
Dingyu Xue, YangQuan Chen System Simulation Techniques with MATLAB and
12/12/24 18:49 Simulink 2013
4.5 Modeling Simulation and Analysis
of Linear Systems
Linear systems are main models in system modeling
Various of linear system:
 Continuous blocks: transfer function block, state space bloc
k
 Discrete blocks:
 Multivariable system, delay systems, hybrid system
The main content
 Modeling of Linear Systems
 Analysis Interface for Linear Systems
CHAPTER 4 MATHEMATICAL MODELING AND SIMULATION WITH SIMULINK
Dingyu Xue, YangQuan Chen System Simulation Techniques with MATLAB and
12/12/24 18:49 Simulink 2013
4.5.1 Modeling of Linear Systems
Mathematical model MATLAB expression

In Control System Toolbox, various linear time-invari


ant objects are provided
CHAPTER 4 MATHEMATICAL MODELING AND SIMULATION WITH SIMULINK
Dingyu Xue, YangQuan Chen System Simulation Techniques with MATLAB and
12/12/24 18:49 Simulink 2013
EXAMPLES
Complicated transfer functions

MATLAB expression

System modeling
 Providing linear system blocks in the Control Syste
m Toolbox
 Filling G in the dialog box
CHAPTER 4 MATHEMATICAL MODELING AND SIMULATION WITH SIMULINK
Dingyu Xue, YangQuan Chen System Simulation Techniques with MATLAB and
12/12/24 18:49 Simulink 2013
Multivariable system
Mathematical model

Input commands

CHAPTER 4 MATHEMATICAL MODELING AND SIMULATION WITH SIMULINK


Dingyu Xue, YangQuan Chen System Simulation Techniques with MATLAB and
12/12/24 18:49 Simulink 2013
System Simulation
The discrete state space model

MATLAB commands

CHAPTER 4 MATHEMATICAL MODELING AND SIMULATION WITH SIMULINK


Dingyu Xue, YangQuan Chen System Simulation Techniques with MATLAB and
12/12/24 18:49 Simulink 2013
4.5.2 Analysis Interface for Linear Sys
tems
MATLAB Control System Toolbox commands
 frequency domain
 Time domain
Simulink Analysis Interface
 Model: c4mex2.mdl
 Menu: Tools | Control Design | Linear Analysis
 Interface arrangement
 LTI Viewer menu: Edit | Plot Configurations
CHAPTER 4 MATHEMATICAL MODELING AND SIMULATION WITH SIMULINK
Dingyu Xue, YangQuan Chen System Simulation Techniques with MATLAB and
12/12/24 18:49 Simulink 2013
4.6 Simulation of Continuous Nonline
ar Stochastic Systems
Why we need to discuss the methods?
 White Noise not appropriate, insufficient intensity
Two blocks in use
 Band Limited White Noise
 Common White Noise, adding a gain of
The main content
 Simulation of Random Signals in Simulink
 Statistical Analysis of Simulation Results
CHAPTER 4 MATHEMATICAL MODELING AND SIMULATION WITH SIMULINK
Dingyu Xue, YangQuan Chen System Simulation Techniques with MATLAB and
12/12/24 18:49 Simulink 2013
Simulation of Random Signals in Simu
link
System simulation driven by white noise
 Linear model

 Simulation method: setting a step size, 30000


simulation points
 Simulation model: c4mrnd1.mdl

CHAPTER 4 MATHEMATICAL MODELING AND SIMULATION WITH SIMULINK


Dingyu Xue, YangQuan Chen System Simulation Techniques with MATLAB and
12/12/24 18:49 Simulink 2013
Analysis (Compared with theoretical probabili
ty density)

CHAPTER 4 MATHEMATICAL MODELING AND SIMULATION WITH SIMULINK


Dingyu Xue, YangQuan Chen System Simulation Techniques with MATLAB and
12/12/24 18:49 Simulink 2013
Statistical Analysis of Simulation
Results
The autocorrelation function

The spectral factorization theorem

stability

CHAPTER 4 MATHEMATICAL MODELING AND SIMULATION WITH SIMULINK


Dingyu Xue, YangQuan Chen System Simulation Techniques with MATLAB and
12/12/24 18:49 Simulink 2013
Then

It follows that

Denote
CHAPTER 4 MATHEMATICAL MODELING AND SIMULATION WITH SIMULINK
Dingyu Xue, YangQuan Chen System Simulation Techniques with MATLAB and
12/12/24 18:49 Simulink 2013
We obtain the following linear algebraic equati
ons:

The autocorrelation function

CHAPTER 4 MATHEMATICAL MODELING AND SIMULATION WITH SIMULINK


Dingyu Xue, YangQuan Chen System Simulation Techniques with MATLAB and
12/12/24 18:49 Simulink 2013
Power spectral factorizations

CHAPTER 4 MATHEMATICAL MODELING AND SIMULATION WITH SIMULINK


Dingyu Xue, YangQuan Chen System Simulation Techniques with MATLAB and
12/12/24 18:49 Simulink 2013
EXAMPLES
The transfer function

MATLAB analysis

CHAPTER 4 MATHEMATICAL MODELING AND SIMULATION WITH SIMULINK


Dingyu Xue, YangQuan Chen System Simulation Techniques with MATLAB and
12/12/24 18:49 Simulink 2013
Power Spectral Density Analysis
The power spectral density

MATLAB analysis expressions

psd_estm() this function is given in Chapter 3


CHAPTER 4 MATHEMATICAL MODELING AND SIMULATION WITH SIMULINK
Dingyu Xue, YangQuan Chen System Simulation Techniques with MATLAB and
12/12/24 18:49 Simulink 2013

You might also like