Professional Documents
Culture Documents
Modeling
Simulation
Implementation
Using Simulink
Version 4
03-5978-5411
03-5978-5440
2 15 6
http://www.cybernet.co.jp/products/matlab
infomatlab@cybernet.co.jp
techmatlab@cybernet.co.jp
Web
Using Simulink
COPYRIGHT 1990 - 2000 by The MathWorks, Inc.
The software described in this document is furnished under a license agreement. The software may be used or copied only
under the terms of the license agreement. No part of this manual may be photocopied or reproduced in any form without prior
written consent from The MathWorks, Inc.
FEDERAL ACQUISITION: This provision applies to all acquisitions of the Program and Documentation by or for the federal
government of the United States. By accepting delivery of the Program, the government hereby agrees that this software qualifies as "commercial" computer software within the meaning of FAR Part 12.212, DFARS Part 227.7202-1, DFARS Part
227.7202-3, DFARS Part 252.227-7013, and DFARS Part 252.227-7014. The terms and conditions of The MathWorks, Inc.
Software License Agreement shall pertain to the governments use and disclosure of the Program and Documentation, and
shall supersede any conflicting contractual terms or conditions. If this license fails to meet the governments minimum needs
or is inconsistent in any respect with federal procurement law, the government agrees to return the Program and Documentation, unused, to MathWorks.
MATLAB, Simulink, Stateflow, Handle Graphics, and Real-Time Workshop are registered trademarks, and Target Language
Compiler is a trademark of The MathWorks, Inc.
Other product or brand names are trademarks or registered trademarks of their respective holders.
Printing History:
November 1990
December 1996
January 1999
November 2000
January 2001
First printing
Revised for Simulink 2
Revised for Simulink 3 (Release 11)
Revised for Simulink 4 (Release 12)
Getting Started
1
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2
Simulink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-6
2
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2-2
2-3
2-4
2-4
2-5
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-6
Simulink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-15
Simulink Preferences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-15
Simulink
3
Simulink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2
. . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3-4
3-4
3-5
3-6
3-6
3-6
3-7
3-7
3-8
. . . . . . . . . . . . . . . . . . . . . . 3-9
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-9
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-10
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-10
. . . . . . . . . . . . . . . . . . . . . . . . . . . 3-11
Atomic . . . . . . . . . . . . . . . . . . . . 3-13
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-13
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-14
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-18
. . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3-23
3-23
3-23
3-23
3-24
3-24
3-26
3-27
3-28
4
Simulink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Simulink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ii
4-2
4-3
4-3
4-4
Simulink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-5
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-8
1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-8
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-8
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4-10
4-10
4-10
4-11
4-13
4-13
4-14
4-14
4-15
4-17
4-17
4-18
4-18
4-19
4-20
4-20
4-21
4-21
4-22
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4-24
4-24
4-25
4-25
4-26
4-27
4-28
4-28
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4-30
4-30
4-32
4-33
4-34
iii
. . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . .
4-35
4-36
4-37
4-38
4-38
4-39
4-39
4-40
4-40
4-41
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-44
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Simulink . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Boolean . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4-45
4-45
4-46
4-46
4-47
4-47
4-47
4-48
4-49
4-49
4-49
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . .
Simulink . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . .
Simulink . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4-51
4-51
4-52
4-53
4-53
4-54
4-54
4-56
4-61
. . . . . . . . . . . . . . . . . . . . . . . . . . . 4-63
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-66
Subsystem . . . . . . . . . 4-66
iv
. . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4-67
4-68
4-68
4-69
4-70
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . .
4-71
4-71
4-71
4-72
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-76
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . .
4-77
4-77
4-77
4-78
4-78
4-79
4-79
4-80
4-80
4-80
4-81
4-81
4-82
4-82
4-83
4-85
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-87
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-87
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-88
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-90
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-91
Print . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-91
Print . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-92
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-93
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-94
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-95
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-95
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-100
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4-106
4-106
4-109
4-113
4-114
Simulink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-116
5
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2
. . . . . . . . . . . . . . . . 5-3
. . . . . . . . . . . . . .
. . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Simulation Diagnostics . . . . . . . . . . . . . . . . . . . .
5-4
5-4
5-4
5-4
5-6
vi
. . . . . . . . . . . . . . . . .
sim . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
set_param . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
sim . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
simplot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
simset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
simget . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5-36
5-36
5-36
5-38
5-41
5-43
5-47
6
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
To Workspace . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6-2
6-2
6-2
6-3
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-4
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-7
linfun . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-9
trim . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-12
7
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-2
. . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7-3
7-4
7-6
7-6
vii
Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-9
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-9
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-11
. . . . . . . 7-13
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-13
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-14
Icon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7-17
7-17
7-19
7-20
7-21
7-22
Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Mask Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Block Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Mask Help Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7-26
7-26
7-26
7-27
Self-Modifying . . . . . . . . . . . . . . . . . . . . . . . . . . 7-28
. . . . . . . . . . . . . . . . . 7-29
. . . . . . . . . . . . . . . 7-29
. . . . . . . . . . . . . . . . . . . . . . . 7-30
8
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-2
Enabled . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-3
Enabled . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-3
Enabled . . . . . . . . . . . . . . . 8-5
Triggered . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-8
Triggered . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-9
Function-Call . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-10
viii
Triggered . . . . . . . . . . . . 8-10
Triggered and Enabled . . . . . . . . . . . . . . . . . . . . . . . . . . .
Triggered and Enabled . . . . . . . . . . . . . . . . . . . .
Triggered and Enabled . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . .
8-12
8-12
8-13
8-13
9
. . . . . . . . . . . . . . . . . . . . . . . . 9-2
Simulink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-3
Abs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-11
Algebraic Constraint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-13
Backlash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-15
Band-Limited White Noise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-19
Bitwise Logical Operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-21
Bus Selector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-25
Chirp Signal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-27
Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-29
Combinatorial Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-31
Complex to Magnitude-Angle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-34
Complex to Real-Imag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-35
Configurable Subsystem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-36
Constant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-40
Coulomb and Viscous Friction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-42
Data Store Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-44
Data Store Read . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-46
Data Store Write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-47
Data Type Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-49
Dead Zone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-51
Demux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-53
Derivative . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-58
Digital Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-60
Direct Look-Up Table (n-D) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-61
Discrete Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-67
ix
Pulse Generator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Quantizer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Ramp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Random Number . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Rate Limiter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Real-Imag to Complex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Relational Operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Relay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Repeating Sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Reshape . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Rounding Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Saturation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Selector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S-Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Sign . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Signal Generator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Sine Wave . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Slider Gain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
State-Space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Step . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Stop Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Subsystem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Sum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Switch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terminator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
To File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
To Workspace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Transfer Fcn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Transport Delay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Trigger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Trigonometric Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Uniform Random Number . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Unit Delay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Variable Transport Delay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Width . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XY Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Zero-Order Hold . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Zero-Pole . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9-175
9-177
9-179
9-181
9-183
9-185
9-187
9-189
9-191
9-193
9-195
9-196
9-198
9-208
9-212
9-214
9-215
9-218
9-221
9-223
9-225
9-227
9-228
9-232
9-235
9-237
9-238
9-240
9-243
9-246
9-248
9-250
9-252
9-254
9-256
9-259
9-260
9-262
9-263
xi
10
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-2
. . . . . . . . . . . . . . . . . . . . . . . 10-3
Simulink . . . . . . . . . . . . . . . . . 10-3
add_block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-4
add_line . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-5
bdclose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-6
bdroot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-7
close_system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-8
delete_block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-10
delete_line . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-11
find_system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-12
gcb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-17
gcbh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-18
gcs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-19
get_param . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-20
new_system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-22
open_system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-23
replace_block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-24
save_system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-26
set_param . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-27
simulink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-29
Simulink
11
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-3
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-4
. . . . . . . . . . . . . 11-6
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-6
MATLAB . . . . . . . . . . . . . . . . . . . . . . 11-6
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-7
xii
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-8
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-8
. . . . . . . . . . . . . . . . . . . . . 11-9
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-9
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-10
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . .
11-11
11-12
11-14
11-14
11-14
11-14
. . . . . . . . . . . . . . . . . . . . . . . .
I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11-16
11-16
11-18
11-18
11-19
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-20
. . . . . . . . . . . . . . . . . . . . . . . . . . 11-20
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-20
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ashow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
atrace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
bafter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
break . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
bshow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
clear . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
continue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
disp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ishow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
minor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
nanbreak . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
next . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
probe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
quit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
run . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11-24
11-27
11-28
11-29
11-30
11-31
11-32
11-33
11-34
11-35
11-36
11-37
11-38
11-39
11-40
11-41
11-42
xiii
slist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
states . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
step . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
stop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
tbreak . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
trace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
undisp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
untrace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
xbreak . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
zcbreak . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
zclist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11-43
11-44
11-45
11-46
11-47
11-48
11-49
11-50
11-51
11-52
11-53
11-54
11-55
Performance Tools
12
Simulink Performance Tools . . . . . . . . . . . . . . . . . . . . . . . . 12-2
Simulink Accelerator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-3
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-3
Simulink Accelerator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-4
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-5
Accelerator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-6
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-7
Simulink Accelerator Simulink Debugger . . . . . . . . . . . . . . 12-8
Simulink Accelerator . . . . . . . . . . . 12-9
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-10
Simulink Accelerator Build . . . . . . . . . . . 12-10
Simulink Accelerator S- . . . . . 12-11
Model Differencing Tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-13
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-15
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-15
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-17
. . . . . . . . . . . . . . . . . . . . . . 12-17
xiv
. . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-19
. . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-20
Model Coverage Tool( ) . . . . . . . . . . . . . . . . .
Model Coverage Tool . . . . . . . . . . . . . . .
Model Coverage Tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . .
Model Coverage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12-23
12-23
12-23
12-24
12-26
12-29
12-31
A
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-2
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-3
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-7
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-10
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-26
B
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
BlockDefaults . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
AnnotationDefaults . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
B-2
B-3
B-3
B-3
B-3
xv
xvi
1
Getting Started
. . . . . . . . . . . . . . . . . . . . . . . . . . 1-2
Simulink . . . . . . . . . . . . . . . . . . . . . . . 1-2
. . . . . . . . . . . . . . . . . . . . 1-3
. . . . . . . . . . . . . . . . . . . . . . 1-6
1 Getting Started
Simulink ! Simulink
Simulink
MATLAB
Simulink
Simulink
-
Simulink
Simulink
Simulink
Simulink
Simulink
Simulink
(GUI)
( )
1-2
Simulink
Writing S-Functions
Simulink
MATLAB
"what if (
)"
MATLAB
MATLAB
MATLAB
MATLAB
Simulink
Simulink
Simulink 2
Simulink
1-3
1 Getting Started
Simulink 3 Simulink
Simulink
5
Simulink
6
Simulink MATLAB
7
9 Simulink
10 MATLAB M
11 Simulink Simulink
Simulink
12 Performance Tools Simulink
Simulink
A
10
get_param set_param
B
1-4
1-5
1 Getting Started
CD
MATLAB
Simulink
1-6
IS-95A
Simulink
Communications Blockset
Simulink
Communications Toolbox
MATLAB
Simulink
DSP Blockset
Simulink
Fixed-Point Blockset
Simulink
Simulink
Simulink
PC Simulink
Real-Time Workshop
.Simulink Stateflow
Ada 95
Simulink
1-7
1 Getting Started
1-8
Real-Time Workshop
Production Coder
Simulink
Requirements Management
Interface
( )
Stateflow
Stateflow Coder
Stateflow
C
System Identification
Toolbox
xPC Target
Simulink I/O
Real-Time Workshop
xPC Target
PC
xPC Target DSP
hardware-in-the-loop
1-9
1 Getting Started
1-10
. .
. . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
2-2
2-3
2-4
2-4
2-5
. . . . . . . . . . . . . . . . . . . . . 2-6
Simulink . . . . . . . . . . . . . . . . . . . . . .2-15
Simulink Preferences . . . . . . . . . . . . . . . . . . . . 2-15
Simulink
1 MATLAB MATLAB
2 MATLAB thermo
Simulink
4 Simulation Start
( Windows Simulink
Start )
2-2
( Pause )
2-4
6 File Close
( ) 70
15 50
Subsystem
5
ThermostatHouse Temp Convert 3 (2 1
)
House
House
House subsystem
2-3
Thermostat
Thermostat subsystem
Scope
Scope 9-198
Scope
( )Set Point Constant
80
(Avg Outdoor Temp )
2-4
Start
5-4
4-66
7
thermo Subsystem
Scope
Scope 9-198 Scope
Simulink
Demos
Simulink
2-5
MATLAB simulink
Microsoft Windows Simulink
2-6
UNIX Simulink
UNIX Simulink
File New Model Windows
New Model
New Model
2-7
Simulink
Simulink
Sine Wave
Sources
Simulink Sources
Sources Sources
Sine Wave Sine Wave
2-8
Simulink
Sources
Sine Wave
Sine Wave
Simulink Sine Wave
2-9
Sine Wave
2-10
Input port
Output port
Mux
Mux
2-11
( 2-6
)1
Sine Wave Integrator
Sine Wave Mux
1
Sine Wave Mux
2 Ctrl
Integrator Integrator
2-12
3 Simulink Integrator
Scope Scope
10
Simulation Simulation Parameters
Stop time
10.0( )
OK Simulation Parameters
Simulink
2-13
Simulation Parameters
Simulation Stop
File Save
2-14
Simulink
Simulink
MATLAB Preferences Simulink
Preferences
Simulink File Preferences
Simulink Preferences
Preferences
Simulink
Window reuse
(4-68
)
Model Browser
2-15
(4-100
)
Display
(4-38
)
Callback tracing
Simulink
(4-71
)
Simulink Fonts
Solver
(5-8 Solver
)
Workspace
(5-18
Workspace I/O )
Diagnostics
(5-25
Diagnostics )
2-16
3
Simulink
Simulink
. . . . . . . . . . . . . . . . . . . . . . . 3-2
. . . . . . . . . . . . . . 3-3
. . . . . . .
. . . . . . . . .
. . . . . . . . . . .
. . . . . . .
. . . .
. . . . . . .
. . . . .
. . . . . . . . . . .
. . . . . . .
. . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
3-3
3-3
3-4
3-4
3-5
3-6
3-6
3-6
3-7
3-7
3-8
. . . . . . .
. . . . . . . . .
. . . . . . . .
. . .
Atomic
. . . . . . . . . . . . . . .
. . . . . . .
. . . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. . 3-9
. . 3-9
. 3-10
. 3-10
. 3-11
. 3-13
. 3-13
. 3-14
. 3-18
. . . . . . . . . .3-23
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . .
. . . . . . .
. . . . . . . .
. . . . . . . . . . . . .
. . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
3-23
3-23
3-23
3-24
3-24
3-26
3-27
3-28
3 Simulink
Simulink
Simulink
Simulink
Simulink 2
Simulink
(3-3
)Simulink
Simulink (
3-9 )
3-2
Simulink
Simulink point-and-click
( 4 )Simulink
( 9
)
(continuous )
(discrete )
u
(input)
x
(states)
y
(output)
3-3
3 Simulink
Integrator
Integrator
Simulink Memory
Memory
Memory
Simulink Gain Gain
Gain
Sum Product
(Sum Product )
Simulink
fo
fu,
3-4
xd
y = f o ( t, x, u )
Output function
= f u ( t, x, u )
Update function
k+1
x' c = f d ( t, x, u )
where
x =
Derivative function
xc
xdk
t x u y
xd xc
Simulink
Simulink Gain
MATLAB
Simulink
Gain
Simulink
Simulink
Gain
529
3-5
3 Simulink
Simulink
Simulink
( ) ( )
( ) ( )3-28
Simulink
Simulink Subsystem
Simulink
( 8
. )
Simulink
Simulink
Subsystem wrap Simulink
3-6
M- MEX-
(Writing S-Functions )S-
S- Simulink
S-function S-function Subsystem
Subsystem
S-function
Simulink signal
Simulink ( 8 16 32
) ( ) (1 2 )
Simulink MATLAB
int8, double boolean(4-45 )
Simulink 2
Simulink
Simulink.Parameter
Simulink.Signal
Simulink int32
Simulink Simulink
Simulink
Simulink
Simulink
Simulink MATALB
Simulink
3-7
3 Simulink
Simulink
Simulink (ODE)
3-8
Simulink Simulation
Start
Simulink
1
2
( 3-13 Atomic
)
3
( 3-11 )
4 (
Simulink
source
3-9
3 Simulink
Simulink
( 3-13
) ( 3-23
)
(3-14 )
Simulink
Simulink
Simulink
1 ( 3-11
)
Simulink
Simulink
Simulink
Simulink
Simulink
3-10
Simulink
3-14
Simulink 1 4
Simulink
1
Simulink
Direct Feedthrough
Simulink
direct feedthrough
nondirect-feedthrough
direct-feedthrough Gain, Product, Sum
nondirect-feedthrough Integrator (
)Constant ( )Memory (
)
3-11
3 Simulink
Simulink
direct-feedthrough
direct-feedthrough
Nondirect-feedthrough direct-feedthrough
nondirect-feedthrough
Simulink
nondirect-feedthrough
nondirect-feedthrough
direct-feedthrough
Simulink direct-feedthrough
Simulink
direct-feedthrough deadlock condition
Simulink
direct-feedthrough
3-18
Simulink ( 4-20
)
3-12
Atomic
virtual atomic Simulink
Simulink
atomic
atomic
atomic
Simulink
Simulink
Simulink
Simulink
2
(
)
3-13
3 Simulink
Simulink
Simulink
3-14
Simulink
Simulink
Simulink
Simulink
Simulink
( )
Simulink
Simulink
Simulink
Simulink
Simulink Saturation
Saturation
Simulink
Hit Crossing
3-17
Saturation
zcSignal = UpperLimit - u u
3-15
3 Simulink
rising
falling
Saturation either
Simulink
1
" " 2
not
detected
detected
513 Error
Tolerances
Refine (5-16 )
3-16
( )
Simulation Parameters
Diagnostics Disable zero crossing detection
5-31
Abs
1 :
Backlash
2 : 1 1
Dead Zone
2 : 1 (
) 1 (
)
Hit Crossing
1 :
Simulation Parameters
Disable zero crossing detection
Integrator
3
1 1
1
3-17
3 Simulink
(Continued)
MinMax
1 :
Relay
1 :
Relational
Operator
1 :
Saturation
2 : 1
1
Sign
1 :
Step
1 :
Subsystem
1
1
Switch
1 :
Simulink
Elementary Math
Gain
Integrator
Product
D State-Space
Sum
Transfer Fcn
Zero-Pole
3-18
9
.
(
3-20 )
Sum z
u z ( z = u - z)
z = u/2
z1, z2
3-19
3 Simulink
F(z) = 0
z 1 F
1 F(z) = z - (u - z)
z2 + z1 1 = 0
z2 z1 1 = 0
F(z) = 0
(DAE)
Simulink
( )
F(z) = 0 Simulink
1
z
1 (
) IC
1
Algebraic Constraint
IC Algebraic Constraint
2
( 8-8
Triggered ).
3-20
Simulink
z=1+u
3-21
3 Simulink
u z
u2
z=z+1
3-22
Simulink ( )
Sample time
t = n * Ts + offset
n offset
discrete 1
3-23
3 Simulink
y(2)
y(1)
3-24
Simulink
Simulink
0.25 0.5
0.25 0.5
0.75 0.25
(
)
0.00
0.25
0.50
0.75
1.00
1.25
1.50
1.00
1.25
1.50
Fixed-Step Solver
0.00
0.25
0.50
0.75
Variable-Step Solver
3-25
3 Simulink
Gain
Gain
Simulink
Simulink
Constant ( Constant)
Discrete ( Zero-Order Hold, Unit Delay, Discrete Transfer Fcn )
Integrator Gain
Zero-Order Hold Gain
Zero-Order Hold
( )
Simulink source
3-26
Discrete-Time Integrator
Simulink Constant
Constant
Constant Gain
3-27
3 Simulink
Simulink
Simulink (5-29
) " "
2 1
2
Runge-Kutta
ode23 ode45
ode15s
ode113
3-28
Simulink
. . . . . . . . . . . . . . . . . . . . . . 4-2
. . . . . . . . . . . . . . . . . . . . . 4-8
. . . . . . . . . . . . . . . . . . . . . . . . .4-10
. . . . . . . . . . . . . . . . . . . . . .4-24
. . . . . . . . . . . . . . . . . . . . . . . .4-30
. . . . . . . . . . . . . . . . . . . . . . . . . . .4-44
. . . . . . . . . . . . . . . . . . . . .4-45
. . . . . . . . . . . . . . . . . .4-51
. . . . . . . . . . . . . .4-63
. . . . . . . . . . . . . . . . . . . . .4-66
. . . . . . . . . . . . . . . .4-71
. . . . . . . . . . . . . . . . . . . . .4-76
. . . . . . . . . . . . . . . . . . . . . . . .4-77
. . . . . . . . . . . . . . . . . . . . .4-87
. . . . . . . . . . . . . . . . . . . . . . .4-90
. . . . . . . . . . . . . . . . . . . . .4-91
. . . . . . . . . . . . . . . . . . .4-95
. . . . . . . . . . . . . . . . . . 4-106
Simulink . . . . . . . . . . . . . . . . . 4-116
Simulink
Simulink MATLAB
MATLAB Simulink
2
MATLAB Simulink
MATLAB simulink
Microsoft Windows Simulink Simulink
Simulink
4-2
Simulink
Simulink Simulink
Windows Simulink
Simulink
(Windows )
New File
New Model
2
477
(Windows) Open
Simulink File Open
MATLAB .mdl )
4-3
Simulink
Simulink
Simulink
Simulink (Microsoft Windows )
Simulink (Windows )
MATLAB
Simulink
Simulink
Windows Simulink
Simulink
Windows Simulink Simulink
Toolbar
Simulink
4-4
Simulink
Simulink
MATLAB
MATLAB
MATLAB
5 , 6
Edit Redo Undo
Simulink
Simulink
( )
MATLAB Figure
Handle Graphics
Simulink
/
4-5
Windows Simulink
Simulink View
Status Bar / /
Simulink Simulink
View Zoom In ( r
Simulink
4-6
Simulink
Simulink
4-7
1
( )
1
1 1
4
" "
Sine Wave
Shift
Shift
4-8
Edit
Select All
466
4-9
Simulink
Simulink 2
Simulink
4-1:
4-10
Bus Selector
Demux
Enable Port
From
4-1: (Continued)
Goto
Ground
Inport
Outport
Mux
Outport
(
) Simulink
( )
Selector
Subsystem
Terminator
Test Point
Trigger Port
Simulink
1
2
4-11
(
)
Edit Copy/Paste
1
2 Edit Copy
3
4 Edit Paste
Simulink
Linear Gain
Gain
Gain
Simulink ( Gain1Gain2)
418 .
Simulink 5
4-12
MATLAB
set_param(<model name>,showgrid,on)
20
set_param(<model name>,gridspacing,20)
2 <model name>
gcs
CopyCutPaste ( )
Shift
Edit Undo
1
Simulink
48
2
Ctrl
4-13
Simulink
( A-7 )
4-15
1
( A-10
)
Edit
( ) BLOCK Parameters
BLOCK Constat
Parameters
Library
Edit
9
Simulink set_param
10-27 set_param
set_param
MATLAB
4-14
Simulink
(4-54
)
Block Properties
Description( )
4-15
Priority( )
4-20
Tag( )
Open function( )
MATLAB
%< >
%<priority> Simulink
(\n)
pri=%<priority>\ngain=%<Gain>
Gain
Simulink
N/S( ) Simulink
"???"
4-16
1 Delete
Backspace Edit Clear Cut
Cut
Delete Backspace
Clear
Edit Undo
Format
2
3
3
Rotate
Down
Rotate
Left
to
Right
Right
to
Left
Flip
Up
Rotate
1
1
2
3
Rotate
3
4-17
Signal Generator
Microsoft WindowsUNIX
4-18
Simulink
Format
Font Set Font
Edit Undo
Format Flip Name
417
Format
Hide Name
Hide Name Show Name
Show Name
Simulink
4-19
Shift
set_param(b,Priority,n)
b n ( 0
)2
3
Block Properties Priority
( 4-15
)
Simulink Simulink
(3-11
)
Simulink
Simulink
(5-25 Diagnostics
)
4-20
Simulink Format
Execution order( )
1
2 2
4-21
Simulink
4-2:
MuxDemux )
4-22
Mux Demux
Demux
Mux
Demux ( )
4-23
430
2
3 2
4 Simulink
Simulink
Shift
4-24
1
Product Scope To Workspace
1
2 Ctrl
3
Ctrl
Ctrl
Simulink
Simulink
Shift
4-25
4-26
2
Simulink
3 Shift
5 Shift
4-27
Simulink
4-28
3 Simulink
4-29
Simulink
Simulink
Simulink
Simulink
Simulink
Simulink 1 2 1
(1-D) 1 (
) 1 (1-D) 2
(2-D) 1 2-D ( )
2 Simulink
1-D 2-D
1 1
1 2 (2-D) 1 1 2 (2-D)
Simulink
9
, .
4-34
Simulink double
Simulink MATLAB
4-45
4-30
Simulink
4-37
Mux
(4-10
)
Mux (
) 1
1
1
Simulink
s4 Gain G1 s4
Gain G1 s1 Simulink
4-31
Mux
1
Simulink
Simulink
( 9-53 Demux
) Mux,Demux
Signal Bus
4-32
1
Simulink
Simulink Format Signal
Dimentions Simulink
Simulink
445
( )
1 1 1-D 2-D
Mux Demux
Simulink
(2-D)
M x N M
N
4-33
source
Source
source source
Constant Sine Wave (Simulink source
9-1, Sources Library )source
Interpret Vector Parameters as 1-D
off( )
Interpret Vector Parameters as
1-D on N 1
1 N
N
source Interpret Vector Parameters as 1-D
Constant
Constant value
Constant value Interpret Vector Parameters as 1-D
4-34
Constant value
Interpret vector
parameters as 1-D
2-D
off
2-D
2-D
on
1-D
1 N
off
1 N
1 N
on
N 1
off
N 1
N 1
on
Constant value
Interpret vector
parameters as 1-D
M N
off
M N
M N
on
M N
Simulink source
Source
(
Simulink
( 4-36
)
2
Simulink
( 4-37
)
4-35
Nx1 1xN
Simulink N
MATLAB
1xN Nx1
Simulink
Simulink
1 1
1 1
Simulink
1
1 Simulink 1 1
527
Simulink
9 Simulink
Simulink
4-36
Constant1 Constant
[3 3 3]
Simulink
Simulink
Gain
Simulink
Simulink
(Gain)
3
Simulink
MATLAB
Constant
4-37
Real-Imag to Complex
Simulink
9 , .
Simulink
Simulink
Simulink
Simulink
Signal dimensions
Simulink Format
( )
4-38
Name (4-41
)
name
p = get_param(gcb, PortHandles)
l = get_param(p.Inport, Line)
set_param(l, Name, s9)
(<)
Ctrl
4-39
1
Shift Delete
Backspace
Format
Font Set Font
(<) (
)
Simulink
(4-41 )
4-40
Signal Properties
Signal Name
4-41
off
on
s1 s2 s3
s1
s1<s2,s3>
all
s1 s2 s3
s3 s4 s5
s1
s1<s2,s4,s5>
Description
Document link
MATLAB
(
)
web([file:/// which(foo_signal.html)])
MATLAB
Web foo_signal.html
4-42
2 Real-Time Workshop
4-43
Format Font
( )
Format Text Alignment
Text Alignment 1
( Center)
4-44
MATLAB
MATLAB MATLAB
Simulink Simulink
Simulink The
MathWorks Real-Time Workshop
Simulink
( 4-48
)
Simulink
Simulink MATLAB "
" MATLAB
MATLAB
4-45
double
single
int8
uint8
int16
16
uint16
16
int32
32
uint32
32
Simulink boolean (1 0)
uint8
Simulink double
boolean
9
double
type(value)
4-46
type value
single(1.0)
1.0
int8(2)
8 2
int32(3+2i)
32
Simulink Format
Port Data Types Simulink
Ctrl-D
Simulink
Simulink
Simulink
4-47
typecasting ( )
4-49
Constant
Simulink
4-49
Constant
Data Type Conversion
Mux Demux
( ) boolean
double
Solver double
double
4-48
Boolean
Simulink boolean double
double
Simulink Simulation Parameters
Advanced Boolean logic signals
boolean (5-29
)
Simulink
Simulink Data
Type Conversion ( 9-49
Data Type Conversion )
Simulink
( )
Simulink
uint8( 8 )
4-49
int32( 32 )
Simulink
Simulink
(uint8)
uint8 (0 255) 255
Simulink
( 256)Simulink
out-of-range
Simulink
( 5-27 )
Simulink
(2)
2.0 Simulink
4-50
Simulink Simulink
( )
Simulink
Simulink
Simulink
2 Simulink.Parameter Simulink.Signal
Simulink
Simulink Simulink
Simulink Simulink.Parameter Simulink.Signal Simulink
MATLAB M-
PackageName.ClassName
4-51
PackageName.ClassName
Simulink
Simulink.Parameter
2
A B C
MATLAB
M-
Simulink
Parameter Signal
A.B a.b
Simulink Simulink
MATLAB
4-61
Simulink
MATLAB
Simulink.Parameter
4-52
Simulink
(4-61 Simulink )
MATLAB
4-58
MATLAB M-
hObject.property
hObject property
hGain = Simulink.Parameter;
hGain.Value = 5;
Simulink
5 gain.RTWInfo.StorageClass gain
StorageClass
hObject.method
method(hObject)
hObject Simulink
get
MATLAB
copy
4-53
Simulink
Simulink
Simulink
Simulink
Simulink.Parameter
1 MATLAB Simulink
2 Value
(4-56 )
( Real-Time Workshop )
4 set_param
4-56
4-54
(5-29
)
RTWInfo.StorageClass Auto
( )
gain.RTWInfo.StorageClass = SimulinkGlobal;
RTWInfo.StorageClass Auto
(5-32
)
Simulink
Simulink.Signal
1
2
(4-56
) (
Real-Time Workshop )
Simulink
4-56
4-55
(
)
RTWInfo.StorageClass auto
Signal
Properties (4-41
)
Simulink
Simulink
MAT- (4-54
)
PreLoadFcn
load data_objects.mat
M-
M-
4-56
Simulink (matlabroot/toolbox/simulink/simdemos)
UserDefined
MATLAB
@PackageName
PackageName
4-57
@ClassName
ClassName
schema.m M
schema.m ClassName.m
ClassName
@package_name
MATLAB @PackageName
schema.m
M- schema.m MATLAB
function schema ()
%
schema.package('PackageName);
PackageName
1 @ClassName
ClassName
2
3
MATLAB schema
create_user_class (4-60
create_user_class )
4-58
function schema()
%
%
userClass = UserDefined.Parameter;
%
deriveFromClass = Simulink.Parameter;
%
%
create_user_enumtype(colors, {red, green, blue});
%
addProperties = {
UserMATLABArray1, MATLAB array, []; ...
UserMATLABArray2, MATLAB array, ; ...
UserDouble,
double,
0; ...
UserInt32,
int32,
0; ...
UserOnOff,
on/off,
off; ...
UserString,
string,
; ...
UserColorEnum, colors,
red; ...
};
% ( )
create_user_class(userClass, deriveFromClass, addProperties);
Simulink
M-
function h = Parameter()
%
%
h = UserDefined.Parameter;
4-59
function h = Parameter(varargin)
%
%
h = UserDefined.Parameter;
% ( )
if nargin == 1
% 1 "Value"
h.Value = varargin{1};
end
(4-60 create_user_class
) n 3 n
( angle) ( double)
Simulink.Signal Simulink.Parameter
create_user_class.
(schema.m)
3
( UserDefined.Parameter)
( Simulink.Parameter)
4-60
(4-60
)
create_user_enumtype.
create_user_enumtype 2
colors
Simulink
Simulink MATLAB
4-61
2 MATLAB
Filter (
Simulink )
value
1
4-62
4-3:
Microsoft Windows
UNIX
LMB
LMB
Shift + LMB
Tab
Tab
Shift + Tab
Shift + Tab
Ctrl + LMB
Ctrl + LMB
RMB
RMB
LMB
LMB
Shift +
Shift +
CMB
Enter
Return
Esc
Esc
4-63
4-4:
Microsoft Windows
UNIX
LMB
LMB
Shift + LMB
Ctrl +
RMB
Ctrl +
RMB +
Shift +
Shift +
CMB +
Shift +
Shift +
CMB +
4-5:
4-64
Microsoft Windows
UNIX
Ctrl +
Ctrl +
4-5: (Continued)
Microsoft Windows
UNIX
Shift +
Delete
Shift +
Delete
4-6:
Microsoft Windows
UNIX
Ctrl +
Ctrl +
Shift + ,
Delete
Shift + +
Delete
4-65
1
Subsystem 1
2
Subsystem
Subsystem
Subsystem
Simulink (4-68
)
3 Subsystem
Inport Outport
Sum
Inport Outport
4-66
Select All
48
Sum
Unit Delay
Subsystem Simulink
Simulink
Inport Outport
4-67
Subsystem
Open
Open
Simulink Edit Open Enter
Go to Parent
Go to Parent
Esc Simulink
View Go to Parent
4-68
Open
Go to Parent (Esc)
none
reuse
replace
mixed
Simulink Subsystem
Inport Outport
( )
Format Hide Port Labels (
Show Port Labels)
Inport Outport Format
Hide Name ( Show Name)
Show port labels
4-69
2 2
Inport 1 Outport Subsystem
Access ReadOnly
NoReadOrWrite
9-228 Subsystem
(4-77 )
4-70
MATLAB
OpenFcn
clutch
(clutch.mdl)
Simulink
Simulink
Preferences (2-15 Simulink )
Callback tracing set_param(0, CallbackTracing, on)
Simulink
MATLAB
4-71
CloseFcn
PostLoadFcn
InitFcn
PostSaveFcn
PreLoadFcn
PreSaveFcn
StartFcn
StopFcn
StopFcn
4-72
CloseFcn
close_system
CopyFcn
Subsystem (
CopyFcn
Subsystem
)add_block
DeleteFcn
Subsystem
DestroyFcn
InitFcn
LoadFcn
Subsystem
ModelCloseFcn
Subsystem
MoveFcn
NameChangeFcn
Subsystem
NameChangeFcn
4-73
4-74
OpenFcn
Subsystem
open_system
OpenFcn
ParentCloseFcn
PreSaveFcn
Subsystem
PostSaveFcn
Subsystem
StartFcn
S-Function
StartFcn mdlProcessParameters
StopFcn
S-Function
StopFcn mdlTerminate
Writing S-Functions 3
"Overview of the C MEX S-Function Routines"
UndoDeleteFcn
CloseFcn
close_system
CopyFcn
Subsystem (
CopyFcn
Subsystem
)add_block
DeleteFcn
Subsystem
DestroyFcn
InitFcn
LoadFcn
Subsystem
ModelCloseFcn
Subsystem
MoveFcn
NameChangeFcn
Subsystem
NameChangeFcn
4-75
Simulink
466
(4-100
)
439 424
MATLAB
4-76
( )
Library block -
Reference block
Link
Simulink
Copy
link
library
block
Library (Source)
copy
reference
block
4-77
new_system(newlib, Library)
newlib
open_system
10
(
)
Edit
Unlock Library
(4-11 )
(4-83
)
Simulink
(4-79
)
MATLAB Simulink
unresolved Simulink
4-78
( )
MATLAB Edit
Update Diagram
Apply Close
Simulink
Edit
Link options Disable link
Link Options Restore link
Simulink
Simulink
4-79
Simulink
Simulink
Simulink
Simulink
Edit
Link options Propagate/Discard
changes
Link options View changes
Simulink
Edit Update Diagram
get_param ( 4-81 )
LinkStatus
find_system
4-80
Edit
Link options Go To Library Link
Simulink (
)
LinkStatus
none
resolved
resolved
unresolved
unresolved
implicit
inactive
4-81
library link
libinfo
libdata = libinfo(sys)
sys n 1
n sys
4
Block
4-82
Library
ReferenceBlock
LinkStatus'resolved' 'unresolved'
Library Browser
Library Browser MATLAB
Simulink Library
Browser MATLAB Simulink
Microsoft Windows
4-83
Documentation Pane
Tree Pane
Icon Pane
/
+/- +/- /
/
4-84
Find
Find
New
Open
slblocks.m
slblocks.m slblocks.m
MATLAB
which(slblocks.m, -all)
slblocks.m
4-85
MATLAB
4-86
Simulink 1
TF = 9/5(TC) + 32
Sources Ramp
Sources 32 Constant
Math 9/5 Gain
Math 2 Sum
Sinks Scope
( )
Gain Constant
Close
4-87
Ramp Initial
output 0 Gain 9/5
Sum 32
Scope Simulation
Start 10
x ( t ) = 2x ( t ) + u ( t )
u(t) 1 1 / Integrator
x x
Gain Sum Signal
Generator Wave form Square
rad/sec Scope
Gain
Gain
Format Flip Block Integrator
Gain Ctrl
425
4-88
Scope x 10
Transfer Fcn u x
x/u x sx
sx = 2x + u
x
x = u (s + 2)
x u = 1 (s + 2)
Transfer Fcn
1 s+2 s
[1]( 1) [1
2]
4-89
B
Save
31
Save
Save As
Simulink
1 mdl
2 Simulink PreSaveFcn
PreSaveFcn
3 Simulink mdl
4 Simulink PostSaveFcn
PostSaveFcn
5 Simulink
Simulink
. err
Simulink
2 4
4-90
Print
Print Print Print
Print
Microsoft Windows
4-91
Simulink
Expand Unique Library Links
1
4-77
MATLAB
frameedit
Print
print
4-92
device
untitled
print suntitled
Sub1
print sSub1
Requisite Friction
2 Friction Model
2
cr = sprintf('\n');
print (['sFriction' cr 'Model'])
print(['-s', gcb])
Simulink
set_param PaperType
PaperOrientation
4-93
( A-1
)MATLAB orient
Windows Print
Printer Setup
PaperPositionMode PaperPosition
PaperPosition
[left bottom width height] 2
2
PaperPositionMode manual Simulink
(
)
vdp
set_param(vdp, PaperType, usletter)
set_param('vdp', 'PaperOrientation', 'landscape')
set_param(vdp, PaperPositionMode, manual)
set_param(vdp, PaperPosition, [0.5 0.5 4 4])
print -svdp
vdp U.S.
4-94
Simulink
4-95
Finder
Simulink ( )
Type
1 2
4-96
Parameter Properties
Filter options
Object type
Finder
Search criteria
Basic. Basic
Find what
Find what
4-97
Advanced Property 1
Value
Finder Select
Match case.
Contains word
4-98
Regular expression
\.. .a .2
wo-
0
ba* b, ba, baa
1
ba+ ba, baa
[]
\w
([a-z_A-Z0-9])
\W
([^a-z_A-Z0-9])
\d
([0-9] )
\D
([^0-9] )
\s
([ \t\r\n\f] )
4-99
\S
([^ \t\r\n\f] )
\<WORD\>
WORD WORD
source control system MATLAB Users Guide 8
"Interfacing with Source Control Systems"
Microsoft Windows UNIX
Windows
Model Browser Simulink View Model
Browser 2
4-100
+/- /
+/- /
/
. /
/ +/-
4-101
Simulink Preferences
Simulink
View Model browser options Show library links
Simulink
Preferences
Simulink View Model browser options
Look under masks
UNIX
File Show Browser
Current
system and
subsystems
it contains
4-102
Blocks in
the selected
system
Help, Print, Close
Simulink OpenFcn
(+)
(-)
[M]
[L] 4-24
[O] open function (OpenFcn)
4-71
4-103
[S] Stateflow
-
Open System
- [M] [O]
Look Into System
([M] )
([L] )
Open System
(Open System
)
OpenFcn
Open System
(+)
(-)
4-104
Options
Display Alphabetical List
4-105
Simulink
Simulink
Simulink
4-114
( 4109 )
Simulink Model Info
MATLAB
Interfacing with Source Control Systems,
Simulink
Simulink USER, USERNAME,
LOGIN, LOGNAME
Simulink
UNIX USER
USER
Simulink
Windows
Windows
Simulink " "
MATLAB
4-106
getenv
MATLAB
getenv(user)
USER Windows
Windows95 98 autoexec.bat
set user=yourname
yourname
autoexec.bat
autoexec.bat c:\
4-107
Windows/NT Windows/NT
( )USER
> >
USER
OK
4-108
Model Properties
Creator. Simulink
USER
Created.
Model description.
4-109
Options Pane
Options
Configuration manager.
Model Info
%<AutoIncrement:#>
# Simulink
1.%<AutoIncrement:2>
4-110
1.2
Simulink # 1
1.%<1.%<AutoIncrement:2>
1.%<1.%<AutoIncrement:3>
Simulink 1.3
Modified by . History Model Info
4-111
History Pane
History
USER
Simulink
4113
Modified history. Simulink
Edit
4-112
Simulink
Simulink
Modified Comments
Save
Include "Modified Contents" in "Modified
History"
Show this dialog box next time when save
4-113
Apply OK
Simulink
MATLAB M Simulink get_param
Simulink
4-114
Created
Creator
ModifiedBy
ModifiedByFormat
ModifiedBy
%<Auto>
Simulink USER
ModifiedDate
ModifiedDateFormat
ModifiedDate
%<Auto>
Simulink
ModifiedComment
ModifiedHistory
ModelVersion
ModelVersionFormat
%<AutoIncrement:#>
# Simulink
#
#
Description
LastModificationDate
4-115
Simulink
Simulink Simulink
File MATLAB
4-116
. . . . . . . . . . . . . . . . . . . . . . . . . 5-2
. . . . . . . . . . . . . . . . . 5-2
Running a Simulation from the Command Line . . . . . . . . . . 5-3
. . . . . . .
. . . . . . . . . . . .
Simulation Diagnostics . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Simulation Parameters
Solver . . . . . . . . . . . .
Workspace I/O . . . . . . . . .
Diagnostics . . . . . . . . . .
. . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. . 5-8
. . 5-8
. 5-18
. 5-25
. 5-29
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
5-4
5-4
5-4
5-4
5-6
. . . . . . . . . . . . .5-34
5-33
5-35
. . . . . . . . .5-36
sim . . . . . . . . . . . . . . . . . . .
Using the set_param Command . . . . . . . . . . . . . . .
5-36
5-35
Simulink
MATLAB
ODE
( )Scope Display
-
-
-
-
-
5-2
536
5-3
Simulation Parameters
Simulink Simulation Parameters
3 " "
Solver
58 Simulation Parameters
MATLAB
MATLAB
Apply
Close
Simulation Start
Ctrl-T
Start Stop
5-4
Simulink Simulink
Simulation Stop
Ctrl-T
Simulation Pause
Pause Continue
Continue
Simulation Parameters
Simulink
5-5
Simulation Diagnostics
Message. ( )
Source. ( )
Fullpath
Summary.
Reported by. ( Simulink, Stateflow,
Real-Time Workshop )
5-6
( )
Open
5-7
Simulation Parameters
Simulation Parameters sim (5-38
sim ) simset( 5-43 simset )
OK
Cancel
Help
Apply
Solver
Solver Simulation Parameters
Solver
Solver
5-8
Simulation Parameters
0.0 10.0
10 10
Simulink (ODE)
Simulink
5-9
Using MATLAB
Simulink
ode45 ode45
ode45 ode15s
5-11
Variable-step solvers
Simulink discrete
ode45
Simulink discrete
2 discrete
discrete
[0.0 0.25 0.5 0.75 1.0 1.25 ...]
discrete
[0.0 0.5 0.75 1.0 1.5 2.0 2.25 ...]
discrete
discrete
ode45, ode23, ode113, ode15s,
ode23s discrete
ode45 discrete
5-10
Simulation Parameters
ode15s (NDF)
(BDF)(Gear )
ode113 , ode15s
ode45 ode15s
ode23s 2 Rosenbrock
ode15s
ode15s
ode23t " "
ode23tb
Runge-Kutta TR-BDF
ode23s
ode15s
discrete( )
Simulink
5-11
ode15s ode23s
534
( 534
)
Solver
auto
auto
5-12
Simulation Parameters
t stop t start
h max = ----------------------------50
1
(1/4 )
516
2
2 1 2
Diagnostics
5-13
(rtol ) (atol )
1e-3
0.1%
i ei
e i max ( rtol x i , atol i )
rtol*|x|
State
atol
Time
auto ( ) Simulink
1e-6 Simulink
0 1 reltol
1e-3 abstol 1e-3
0 1000 abstol 1
5-14
Simulation Parameters
Integrator
ode15s
ode15s 1 5 NDF
2 (NDF
A- )ode15s
1 ( A- )
ode23s
Multitasking
Simulation Parameters
Solver Mode
1
MultiTasking.
rate transition
Simulink 2 Unit Delay( 9-254 Unit Delay )
Zero-Order Hold ( 9-262 Zero-Order Hold )
Unit Delay
5-15
SingleTasking.
Auto. Simulink
Output options
3
Refine output
Produce additional output
Produce specified output only
. Refine output
ode45
ode45
( 3-14 )
5-16
Simulation Parameters
0, 2.5, 5, 8.5, 10
Refine output 2
5-17
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
[1:100]*0.01
[1:0.01:100]
Workspace I/O
Simulation Parameters
Workspace I/O
5-18
Simulation Parameters
Simulink
double ( )
( )Inport
[t,u]
t u
Input
2 1 2
1
u t
t = (0:0.1:1);
u = [sin(t), cos(t), 4*cos(t)];
double ( )
double (2-D)
5-19
2 time signals
time signals
values values
a.time = (0:0.1:1);
c1 = int8([0:1:10]);
c2 = int8([0:10:100]);
a.signals(1).values = [c1 c2];
a.signals(1).dimensions = 2;
[4 5] 4 5 51
5-20
Simulation Parameters
1 2
a
a.time = (0:0.1:1);
a.signals(1).values = sin(a.time);
a.signals(1).dimensions = 1;
a.signals(2).values = cos(a.time);
a.signals(2).dimensions = 1;
Input a
I/O Structure with time
Structure. time
Structure with time
time
a.time = []
Simulink 1
2 2
Simulink Structure
5-24 Structure
5-21
Per-Port Structures.
signals
Input
in1, in2, ..., inN
in1 in2
2
Time Expression.
MATLAB 2
1 timefcn 2
[3*sin(t), cos(2*t)]
4*timefcn(w*t)+7
Simulink
Simulink t 1
Simulink ( )
Simulink
To Workspace
( 9-240 To Workspace )
5-22
Simulation Parameters
Save options
Array. Simulink
2
2
2 1 2
2
Save to Workspace ( yout)
(
)
values time
2-Dvalue
M 3-
=1 MATLAB
label
5-23
dimensions label
blockName
outport
signals 4 valuesdemensionlabelblockName
values blockName
label
state CSTATE( ) DSTATE( )
S- label S-
values
values
2 2 51
Simulink values
51 4
2 1
2 2
Structure. Simulink time
Per-Port Structures.
signals
Output
out1, out2, ..., outN
out1 out2 2
Decimation
2 1
5-24
Simulation Parameters
States
WorkspaceI/O
Save
( ) Final State
Initial State
save final states
Simulink Structure Structure with time
([])
Simulink
Diagnostics
5-25
Simulink ODE
S- Simulink
( 40%) off
S-
Simulink
( )
1 t ( )
t
(ode23s ode15s)
Simulink
Simulink
5-26
Simulation Parameters
Simulink
S-
S-
-1
(Sine Wave ) -1
Simulink
318
Product
(9-170 Product )
4-45
5-27
5-28
(Continued)
int32 float
32-bit
4-45
514 514
2
(5-15 Multitasking
)
S-function
S-function
(4-31
)
2
(5-15 Multitasking
)
9-49
Data Type Conversion
Simulation Parameters
(Continued)
(436
)
.
() ( 35
)
Simulink
(5-32 )
5-29
MATLAB
(
)
Simulink
(Ctrl+D)
Simulink
Boolean . Boolean
boolean double
double boolean
Boolean
Boolean
5-30
Simulation Parameters
double
Simulink Simulink
. (
Real-Time Workshop )
.
Simulink
Simulink
C-MEX S-function
Scope Display
Simulink
Scope Display
314
5-31
(529 )
MATLAB
MATLAB
Referenced workspace variables
.
MATLAB
5-32
Simulation Parameters
MATLAB
. Real-Time Workshop
. Real-Time
Workshop
5-33
(auto)
(0.1% )
5-14
ode15s
5-34
3-18
Random Number Integrator
Sources Band-Limited White Noise
1e-4 (
1e-3)
" "
ode15s
2 ( A-
)ode23s
Integrator
5-35
MATLAB M
sim set_param
sim
model
Simulation Parameters
sim 5-38 sim
options
simset ( 5-43 simset )
options
5-8 Simulation Parameters
set_param
set_param
get_param
set_param
set_param(sys, SimulationCommand, cmd)
get_param
get_param(sys, SimulationStatus)
5-36
5-37
sim
5sim
[t,x,y] = sim(model,timespan,options,ut);
[t,x,y1, y2, ..., yn] = sim(model,timespan,options,ut);
1 ( ) ([])
sim
sim options
Simulation parameters
Workspace I/O (5-18 Workspace I/O )
5-38
Outport
Outport
y1,...,yn
yi n Outport
model
sim
timespan
tFinal 0
[tStart tFinal]
[tStart OutputTimes tFinal] t
t
OutputTimes Produce additional
output
options
simset
( 5-43 simset )
ut
Inport
ut u = UT(t) (
)MATLAB
vs.
ut1, ut2, ...,
MATLAB
5-19
[t,x,y] = sim(vdp)
Refine vdp
Van der Pol
5-39
sim
[t,x,y] = sim(vdp, 1000, simset(MaxRows, 100,
OutputVariables, ty, FinalStateName, xFinal));
5-40
simset, simget
simplot
5simplot
simplot(data);
simplot(time, data);
data
( Outport To
Workspace ) Array,
Structure, Structure with time
(5-18 Workspace I/O )
time
Array Structure
figure
5-41
simplot
vdp
set_param(gcs, SaveOutput, on)
set_param(gcs, SaveFormat, StructureWithTime)
sim(gcs)
simplot(yout)
figure vdp
5-42
sim, set_param
simset
5simset
simset
options
sim
options new_opstruct
old_opstruct
simset
get_param set_param
AbsTol
{1e-6}
.
AbsTol
Decimation
{1}
. t, x, y
1 2
1
5-43
simset
DstWorkspace
. To
Workspace
FinalStateName
string {}
. Simulink
FixedStep
positive scalar
50 1
InitialState
vector {[]}
. ( )
( )
InitialState
InitialStep
.
InitialStep
MaxOrder
1 | 2 | 3 | 4 | {5}
. t, x, y
MaxRows 0
MaxStep
.
50 1
OutputPoints
{specified} | all
. specified timespan
t, x, y all t, x, y
5-44
simset
OutputVariables
{txy} | tx | ty | xy | t | x | y
. t, x, y
t, x, y
Refine
.
Refine
Refine
RelTol
0.1%
1e-3
Solver
VariableStepDiscrete |
ode45 | ode23 | ode113 | ode15s | ode23s |
FixedStepDiscrete |
ode5 | ode4 | ode3 | ode2 | ode1
SrcWorkspace
.
MATLAB
Trace
.
( 1 )
'minstep'
Simulink
siminfo
compile
5-45
simset
ZeroCross
{on} | off
/
off
MaxRows Refine
myopts
5-46
sim, simget
simget
5simget
struct = simget(model)
value = simget(model, property)
value = simget(OptionStructure, property)
simget Simulink
simget
sim simset
OptionStructure
property
vdp
options = simget(vdp);
vdp Refine
refine = simget(vdp, Refine);
sim, simset
5-47
simget
5-48
. . . . . . . . . . . . . . . . . . . . . . . . 6-2
Scope . . . . . . . . . . . . . . . . . . 6-2
. . . . . . . . . . . . . . . . . . . . . 6-2
To Workspace . . . . . . . . . . . . . . . 6-3
. . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-4
. . . . . . . . . . . . . . . . . . . . . . . . . 6-7
linfun . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-9
trim . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-12
Simulink 3
Scope XY Graph
MATLAB
To Workspace MATLAB
Scope
Scope
Scope
Scope Scope
XY Graph
MATLAB
Simulation Parameters
Workspace I/O
6-2
Simulation
plot(tout,yout)
To Workspace
To Workspace MATLAB
y t
Clock To Workspace
6-3
Simulink A, B, C, D
linmod dlinmod
x = Ax + Bu
y = Cx + Du
x, u, y
lmod
Simulink
[A,B,C,D] = linmod(lmod)
A=
-2 -1 -1
1 0 0
0 1 -1
B=
1
0
0
C=
0 1 0
0 0 -1
D=
0
1
6-4
LTI :
sys = ss(A,B,C,D);
:
bode(A,B,C,D) or bode(sys)
:
step(A,B,C,D) or step(sys)
impulse(A,B,C,D) or impulse(sys)
lsim(A,B,C,D,u,t) or lsim(sys,u,t)
Control System Toolbox Robust Control Toolbox
linmod
dlinmod 2
linmod
6-9 linfun
6-5
s
----------s+a
6-6
trim 1
(x) (u)
(y)
x = [0; 0; 0];
u = 0;
y = [1; 1];
trim
[x,u,y,dx] = trim(lmod,x,u,y,ix,iu,iy)
x=
0.0000
1.0000
1.0000
u=
2
y=
1.0000
6-7
1.0000
dx =
1.0e015 *
-0.2220
-0.0227
0.3331
trim
trim
6-12 trim
6-8
linfun
6linfun
[A,B,C,D] = linfun(sys, x, u)
[num,den] = linfun(sys, x, u)
sys_struc = linfun(sys, x, u)
linfun
linmoddlinmod linmod2
sys
Simulink
xu
linmod Simulink
linmod
A, B, C, D
x = Ax + Bu
y = Cx + Du
Inport Outport Simulink
[num,den] = linfun(sys, x, u)
sys_struc = linfun(sys, x, u)
dlinmod
dlinmod linmod 2
6-9
linfun
Ts x u
Ts 0
dlinmod Ts
( )
Ts
-
dlinmod [A,B,C,D]
Ad
Ts>0
all(abs(eig(Ad))) < 1
Ts = 0
all(real(eig(Ad))) < 0
dlinmod Ad Bd
Ad
dlinmod
bode
pert 2 2
t
Simulink
6-10
linfun
[sizes,x0,xstring] = sys
xstring i i
ss2tf
ss2zp -
ss LTI
LTI LTI tf zpk
- -
Derivative Transport Delay
6-4
6-11
trim
6trim
[x,u,y,dx] = trim(sys)
[x,u,y,dx] = trim(sys,x0,u0,y0)
[x,u,y,dx] = trim(sys,x0,u0,y0,ix,iu,iy)
[x,u,y,dx] = trim(sys,x0,u0,y0,ix,iu,iy,dx0,idx)
[x,u,y,dx] = trim(sys,x0,u0,y0,ix,iu,iy,dx0,idx,options)
[x,u,y,dx] = trim(sys,x0,u0,y0,ix,iu,iy,dx0,idx,options,t)
[x,u,y,dx,options] = trim(sys,...)
trim
trim
trim
min-max
trim
[x,u,y] = trim(sys) x0
trim [x-x0,u,y]
trim
abs(dx-0)
x0
[sizes,x0,xstr] = sys([],[],[],0)
[x,u,y] = trim(sys,x0,u0,y0) x0,u0,y0
abs([x-x0; u-u0; y-y0])
x0, u0, y0
ix, iu, iy x0, u0, y0
6-12
trim
trim
[x,u,y,dx] = trim(sys, x0, u0, y0, ix, iu, iy, dx0, idx)
dx0 idx
dx0
options trim
trim
options
trim
No.
0 1
-1
0.0001
0.0001
0.0001
10
N/A
6-13
trim
options Optimization Toolbox Users Guide
x = Ax + Bu
y = Cx + Du
A, B, C, D sys
A = [-0.09 -0.01; 1 0];
B = [ 0 -7; 0 -2];
C = [ 0 2; 1 -5];
D = [-3 0; 1 0];
[x,u,y,dx,options] = trim(sys)
x=
0
0
u=
0
y=
0
0
dx =
0
0
6-14
trim
options(10)
ans =
7
x = [1;1], u = [1;1]
x0 = [1;1];
u0 = [1;1];
[x,u,y,dx,options] = trim(sys, x0, u0);
x=
1.0e11 *
-0.1167
-0.1167
u=
0.3333
0.0000
y=
-1.0000
0.3333
dx =
1.0e11 *
0.4214
0.0003
options(10)
ans =
25
1
y = [1;1];
iy = [1;2];
[x,u,y,dx] = trim('sys', [], [], y, [], [], iy)
x=
0.0009
-0.3075
u=
6-15
trim
-0.5383
0.0004
y=
1.0000
1.0000
dx =
1.0e-16 *
-0.0173
0.2396
1 0 1
y = [1;1];
iy = [1;2];
dx = [0;1];
idx = [1;2];
[x,u,y,dx,options] = trim(sys,[],[],y,[],[],iy,dx,idx)
x=
0.9752
-0.0827
u=
-0.3884
-0.0124
y=
1.0000
1.0000
dx =
0.0000
1.0000
options(10)
ans =
13
6-16
trim
trim
x, u, y
trim
Optimization Toolbox Users Guide
6-17
trim
6-18
. . . . . . . . . . . . . . . . . . . . . . . . . 7-2
. . . . . . . . . . . . . . 7-3
. . . . . . . . 7-4
. . . . . . . . . . . . 7-6
. . . . . . . . . . . . . . . . . . 7-6
Mask Editor:
. . . . . . . . . . . . . . . . . . . . . 7-8
Initialization . . . . . . . . . . . . . . . . . . . . . 7-9
. . . . . . . . . . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
.
.
.
.
.
.
.
.
. . 7-9
. 7-13
. 7-13
. 7-13
Icon . . . . . . . . . . . . . . . .
. . .
. . . . . . . .
. . .
. . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
. .7-17
. 7-17
. 7-19
. 7-20
. 7-21
. 7-22
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Documentation . . . . . . . . . . . . . . . . . . . .7-26
Mask Type . . . . . . . . . . . . . . . . . .
Block Description . . . . . . . . . . . . . . .
Mask Help Text . . . . . . . . . . . . . . . .
Self-Modifying
7-26
7-26
7-27
. . . . . . . . . . . . .7-28
. . . . . . . . .7-29
. . . . . . .
. . . . . . . . . . .
7-29
7-30
Simulink
7-2
y = mx + b
Subsystem Subsystem
mx + b Gain
m Slope Gain
b Intercept Constant
Subsystem
Slope Intercept
Simulink
Slope Intercept
Simulink
7-3
(
1
Subsystem
Edit Mask Subsystem
Mask Editor
Initialization
7-4
Mask Editor
-
-
Slope
Intercept
( 7-14 )
m Slope
Mask Editor
OK
Subsystem
Slope 3 Intercept
2
7-5
Documentation
mx + b
Subsystem Simulink
7-6
Icon
Icon
(0,0) (0,m)
1
Drawing coordinates
Normalized (0,0) (1,1)
7-19
7-7
Mask Editor:
(Subsystem )
Subsystem Edit Mask Subsystem
Mask Editor Mask Editor 3
Initialization
Icon
Documentation
Mask Editor 5
OK Mask Editor
Help
Apply
Mask Editor
Subsystem
Edit Look Under Mask
7-8
Initialization
Initialization
Initialization
mx+b Initialization
Prompt
Assignment Evaluate
MATLAB Literal
7-9
gain Assignment
Evaluate gain MATLAB
Literal MATLAB
gain
Literal
MATLAB eval
LitVal gain
value = eval(LitVal)
Evaluate Assignment
Prompt
Variable
Add
2 Prompt
Variable
2 Enter
Return Simulink
7-10
Initialization
1
2 Delete
1
2 1
Up
Down
Simulink
3
3
( )
7-11
(freq)
Assignment
Assignment
Evaluate
Literal
(label)
Assignment
on
off
Popup strings (|)
7-12
Initialization
(color)
Assignment
Assignment
Evaluate
1
3 3
Literal
3
'green'
1
2
4-77
MaskTunableValues
1
2 2
on off
get_param
7-13
on off
set_param MaskTunableValues
ca = get_param(gcb, MaskTunableValues);
ca(1) = off
set_param(gcb, 'MaskTunableValues, ca)
(
)
Simulink
MATLAB MATLAB
Simulink
7-14
Initialization
mx + b Mask Editor
m b
( )
( )
M-
Mask
Editor M-
" "
7-15
M
A A B
B A M
x x A
keyboard keyboard
MATLAB
dbstop if error
dbstop if warning
dbstop
7-16
Icon
Icon
Icon
Drawing commands
Icon
disp(text) or disp(variablename)
7-17
text(x, y, text)
text(x, y, stringvariablename)
text(x, y, text, horizontalAlignment, halign, verticalAlignment, valign)
fprintf(text) or fprintf(format, variablename)
port_label(port_type, port_number, label)
7-22
text (x,y)
"foobar"
text
left
right
center
text
7-18
base
bottom
middle
Icon
cap
top
fprintf
variablename text
MATLAB
\n
disp 2
port_label
port_label(input, 1, a)
1 a
1 plot
plot
plot(Y);
plot(X1,Y1,X2,Y2,...);
7-19
plot(Y) Y
Y
plot(X1,Y1,X2,Y2,...) X1 Y1X2 Y2
Sources Ramp
Simulink 3 (? ? ?)
image patch
Bitmap
image(a) a
a m n 3 RGB
Bitmap MATLAB
imread ind2rgb
image(imread(icon.tif))
7-20
Icon
Drawing commands
dpoly(num, den)
dpoly(num, den, character)
num den
character
s
s
dpoly(num, den)
7-21
dpoly(num, den, z)
num = [0 0 1] den = [1 2 1]
1/z
dpoly(num, den, z-)
num den
- -
droots(z, p, k)
4 (z z-) z 1/z
Simulink 3 (? ? ?)
Simulink
Drawing commands
7-22
Icon
Icon frame(
Icon frame
Visible Invisible
AND
Visible
Invisible
Icon transparency(
Opaque
Transparent Opaque
Simulink AND
(opaque) (transparent)
Opaque
Transparent
Icon rotation(
AND
Fixed ( ) Rotates ( )
Fixed
Rotates
7-23
Drawing coodinates(
min(X), min(Y)
Autoscale
1,1
0,0
Normalized
0,0
Pixel
Autoscale
X = [0 2 3 4 9]; Y = [4 6 3 5 8];
(0,3) (9,8) x 9 (0
9) y 5 (3 8)
Normalized (0,0) (1,1)
0 1 X Y
Pixel X Y
mx + b
7-24
Icon
plot(x,y)
7-25
Documentation
Documentation
Documentation mx+b
Mask Type
Mask
Editor
Simulink
"(mask)"
Block Description
7-26
Documentation
Simulink Enter
Return
Simulink
7-27
Self-Modifying
self-modifying MaskSelfModifiable
on Simulink
MaskSelfModifiable self-modifying
MATLAB
set_param(gcb, MaskSelfModifiable, on);
7-28
Simulink
Simulink
Simulink set_param
Simulink
Simulink
get_param set_param
set_param
MATLAB set_param
7-29
set_param
Simulink
MaskCallbacks
1 1
2 2
MATLAB M
MATLAB set_param
1 3
MaskDescription
MaskEnables
1 1
2 2
on
off
7-30
set_param(gcb,MaskEnables,{on,on,off});
3
Simulink
MaskPrompts
1 1
2 2
MaskType
MaskValues
1 1
2 2
MaskVisibilities
on off
set_param(gcb,MaskVisibilities,{on,off,on});
7-31
2
Simulink
7-32
. . . . . . . . . . . . . . . . . . . . . . . . . 8-2
Enabled . . . . . . . . . . . . . . . . . . . . 8-3
Enabled . . . . . . . . . . . . . . . . . 8-3
Enabled . . . . . . . . 8-5
Triggered . . . . . . . . . . . . . . . . . . . 8-8
Triggered . . . . . . . . . . . . . . . . 8-9
Function-Call . . . . . . . . . . . . . . . . 8-10
Triggered . . . . . . 8-10
Triggered and Enabled . . . . . . . . . . . . . .8-12
8-12
8-13
8-13
Subsystem
Simulink 3
enabled
( )
Enabled
8-3 Enabled
triggered subsystem ""
Triggered 8-8
Triggered
triggered and enabled
Enable Triggered and
Enabled 8-12 Triggered and Enabled
8-2
Enabled
Enabled
Enabled
Enabled
Simulink
Enabled
Enabled Signals & Systems Enable
Simulink Enable
Enable Subsystem .
8-3
Enabled
Enabled
Outport
Output when disabled
held
reset
Initial output
Outpurt
Enabled
Enable
States when enabling
held
reset
8-4
Enabled
Enable
Enable Enable
Show output port
Enabled
Enabled (1
)
Enabled
Enabled
Enabled
Enabled
Enabled GoTo
Enabled GoTo
Enabled GoTo Simulink
clutch
8-5
4 1
0.25 Block A
0.5 Block B
0.125 Enabaled Block C
0.25 Enabaled Block D
Enable Signal E Pulse Generator
0.375 0 1 0.875 0 .
1
0
Signal E
- Start of execution
Block D
for a block
Block C
Block B
Block A
0
8-6
Enabled
Enable 0.875 C
8-7
Triggered
Triggered
Triggered
1 3
Triggered
rising (
)
falling (
)
either rising falling
rising(R) falling(F)
0
F
Triggered
8-8
Triggered
Triggered
Triggered Signals & Systems Trigger
Simulink Trigger
Subsystem
Trigger
Trigger type
rising
falling
either
.
8-9
Enabled Triggered
Triggered
Trigger
Show output port
Function-Call
S-function Triggered
function-call
Writing S-Functions
Triggered
Triggered
Triggered
8-10
Triggered
-1 -1
8-11
Is
the enable
input signal
>0?
No
Dont execute the subsystem
Yes
Execute the subsystem
Triggered and Enabled Enable Trigger
Simulink Enable
Enable
Simulink
1
8-12
8-4
Enable Trigger
Merge
Enabled Merge
8-13
AC DC
"pos" AC
"neg"
Merge
Mux
Mux Scope
8-14
. . . . . . . . . . . . 9-2
Simulink . . . . . . . . . . . . . . . . . 9-3
(
)
- -
3-18
- - (
)
3-23
- -
4-36
- -
- - /
4-30
- - (state event)
3-14
9-2
Simulink
Simulink
Simulink
simulink
Sources
Sinks
Discrete
Continuous
Math
Functions & Tables
Nonlinear
Signal & Systems
9-1: Sources
Chirp Signal
9-3
Clock
Constant
Digital Clock
From File
From Workspace
Pulse Generator
Ramp
Random Number
Repeating Sequence
Signal Generator
Sine Wave
Step
Step
9-2: Sinks
9-4
Block Name
Display
Scope
Stop Simulation
Simulink
To File
To Workspace
XY Graph
MATLAB Figure
X-Y
9-3: Discrete
Discrete Filter
IIR FIR
Discrete State-Space
Discrete-Time Integrator
Discrete Zero-Pole
First-Order Hold
Unit Delay
Zero-Order Hold
9-4: Continuous
Derivative
Integrator
Memory
9-5
State-Space
Transfer Fcn
Transport Delay
Zero-Pole
9-5: Math
9-6
Abs
Algebraic Constraint
Combinatorial Logic
Complex to Magnitude-Angle
Complex to Real-Imag
Derivative
Dot Product
Gain
Logical Operator
Magnitude-Angle to Complex
Math Function
Matrix Gain
Simulink
MinMax
Product
Real-Imag to Complex
Relational Operator
Rounding Function
Sign
Slider Gain
Sum
Trigonometric Function
Look-Up Table
MATLAB Fcn
MATLAB
S-Function
S-
9-7
9-7: Nonlinear
Backlash
(
)
Dead Zone
( )
Manual Switch
Multiport Switch
Quantizer
Rate Limiter
Relay
Saturation
Switch
9-8
Bus Selector
Configurable Subsystem
Simulink
Demux
Enable
Enable
From
Goto
Goto
From
Goto
Ground
Hit Crossing
IC
Inport
Matrix Concatenation
Merge
Model Info
Mux
Outport
Reshape
Probe
Selector
Signal Specification
9-9
9-10
Subsystem
Terminator
Trigger
Trigger
Width
Abs
9Abs
Math
Abs
double double
N/A
9-11
Abs
9-12
Algebraic Constraint
9Algebraic Constraint
Math
1 (DAE)
Initial guess( )
z Initial guess( )
z2 + z1 = 1
z2 z1 = 1
Display z2 = 1, z1 = 0
9-13
Algebraic Constraint
Initial guess( )
0
9-14
Backlash
9Backlash
Nonlinear
Backlash
1 0
( )
-1.0
-0.5
0.5
1.0
3
-
- ( )
- ( )
Initial output( )
2 Backlash
2
Deadband width( )
( )
Initial output( )
9-15
Backlash
(
)
-1.0
-0.5
0.5
1.0
-1.0
-0.5
0.5
1.0
( )
-1.0
-0.5
0.5
1.0
= - ( /2)
2 5
y
u 4 6 5
u < 4 u + 1
u > 6 u - 1
9-16
Backlash
Backlash
Backlash (
1 0 ) (0.5
) Blacklash
(1.0 )
0
A
C
Backlash double
9-17
Backlash
Deadband width( )
1
Initial output( )
0
9-18
Sources
0
(PSD)
Simulink
1 2
t c --------- ---------100 f max
fmax /
PSD
1/tc tc
Noise power( ) tc
9-19
Noise power( )
PSD 0.1
Sample time( )
0.1
Seed( )
23341
9-20
Math
AND
OR
XOR
Bitwise Operator
9-21
1-D ( ) 1 1
Second
operand( 2 )
MATLAB
16 ( ,
'FFFF')
'FF00'
uint8 '00'
16
MATLAB ['00' 'FF'] 2
'FF00' ['FFFF';
'0000'] 2 ['FFFF'; '00']
MATLAB
16 10 16
({'F0' '0F'} ) 2 16
9-22
Second operand( 2 )
Bitwise operator( )
Second operand( 2 )
MATLAB
9-23
9-24
Second operand
Bus Selector
9Bus Selector
Muxed output( )
Muxed output( )
Bus Selector
9-25
Bus Selector
Signals in the bus( )
Signals in the bus
Selected signals( )
Selected signals Up(
)Down( ) Remove( )
Muxed output
Bus Selector
9-26
Chirp Signal
9Chirp Signal
Sources
Chirp Signal
(1-D )
Initial frequency( )
0.1 Hz
9-27
Chirp Signal
Target time( )
Frequency at target time
100
Frequency at target time( )
1 Hz
Interpret vector parameters as 1-D( 1-D )
Initial frequencyTarget time
Frequency at target time
9-28
Clock
9Clock
Sources
Clock
Digital Clock
Clock double
Display time( )
Display time
Clock
Decimation( )
Decimation
=
1000 1 1 2
1
N/A
9-29
Clock
9-30
Combinatorial Logic
9Combinatorial Logic
Math
Memory
Truth table
= 2 ^ ( )
Simulink
1 Simulink 0
1 2
1 m u
2 AND
2 1 1
0 2 AND
Truth table [0; 0; 0; 1] Combinatorial Logic
" 1"
1
" 2" 2
9-31
Combinatorial Logic
[1 0] 3 (21*1 + 1)
0
3 2 (a b)
- (c) - (c)
(s) 2
9-32
Combinatorial Logic
( )
Combinatorial Logic
Truth table( )
Truth table
9-33
Complex to Magnitude-Angle
9Complex to Magnitude-Angle
Math
Output( )
MagnitudeAndAngle
)Magnitude )Angle
)
9-34
Complex to Real-Imag
9Complex to Real-Imag
Math
Complex to Real-Imag
Output( )
/
( )
Output( )
RealAndImag(
)Real( )Imag( )
9-35
Configurable Subsystem
9Configurable Subsystem
Configurable Subsystem
Configurable Subsystem
Configurable Subsystem
Configurable Subsystem
Configurable
Subsystem
Configurable Subsystem
Configurable Subsystem
Configurable Subsystem
Configurable Subystem
/ Configurable Subystem
/
/ Configurable
Subystem /
Terminator/Ground
/
Configurable Subsystem
Configurable Subsystem
9-36
Configurable Subsystem
AB
A a, b, c d
B a b
e
Configurable Subsystem
a, b, c 3 d e
2
Configurable Subystem a
Configurable Subsystem c A
configurable subsytem
1 configurable subsystem
2 Configurable Subsystem
3 Configurable Subsystem
9-37
Configurable Subsystem
4 configurable subsystems
5
Configurable Subsystem
Configurable Subsystem
Library name
Port information
Up
Down
9-38
Configurable Subsystem
Configurable Subsystem
Configurable Subystem
Block choice
Configurable Subystem
configurable subsystem
Block choice
Subsystem block
Configurable Subsystem
9-39
Constant
9Constant
Sources
Constant
Constant value Interpret
vector parameters as 1-D
Interpret vector parameters as 1-D
Constant value
1 ( )
2 (
)
Constant ( )
Constant value
Constant value
9-40
Constant
9-41
Nonlinear
y u Gain Offset
1 1
9-42
9-43
Initial value
Data Store Write
9-44
1- ( )
N/A
9-45
Data
Store Memory 9-44 Data Store
Memory
Data Store Read
Sample time
-1
9-46
Sample time
-1
9-47
9-48
Data type
auto
Data Type Conversion
9-49
9-50
Yes
N/A
Dead Zone
9Dead Zone
Nonlinear
Dead Zone
Start of dead zone End of dead zone
( )
-0.5 0.5
Dead Zone
( ) -0.5 0.5
Dead Zone
9-51
Dead Zone
9-52
Demux
9Demux
Demux
(1- ) ( 4-32
oXM ) Number of outputs
Number of outputs
...
p=n
3
3
3
p>n
p<n
n/p
p
n mod p = 0
6 3
3
2
9-53
Demux
...
p<n
n mod p = m
(n/p)+1
m n/
p p-m
5 3
2 2
1
p1, p2,
p1+p2+...+pm=n
5
[3,2]
1
3
... pm m
pi > 0
p1+p2+...+pm=n
-1
some or all
pi = -1
9-54
pi
pi pi
Demux
-1
[-1, 3 -1] 2
3 1 2
-1
-1
7 [-1, 3 -1]
1 2 2 3
3 2
Number of outputs
9-55
Demux
2 2
5 [3,2]
1 3
2 2
Demux
{{[2 2], 3} {1}} 2 2 3
1
-1
Demux
{{-1}, {-1,-1}}
9-56
Demux
-1
Demux ( )
Number of outputs
9-57
Derivative
9Derivative
Continuous
Derivative
u
------t
u t
1 1
1
y ( k ) = ----- ( u ( k ) u ( k 1 ) )
t
z
1
Y( z)
1z
z1
---------- = ---------------- = -----------u( z)
t
t z
linmod Derivative
6-4
9-58
Derivative double
Derivative
N/A
9-59
Digital Clock
9Digital Clock
Sources
Digital Clock
( )Clock
Sample time
1
9-60
uint8
256
2 N
Table data
2
2
"2-D Matrix" 5
R C 2
9-61
4 4-D
"8-D T[k]"
1
"n-D Direct Table Lookup5"
6, 8, 12 7 9 2
10, 11 12 figure
a MATLAB 4
a = ones(20,4,5,7); L = prod(size(a));
a(1:L) = [1:L];
9-62
figure 4 3
3 4 2 20
(1 )MATLAB
a(:,1+1,1+3,1+2)
ans =
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
9-63
Direct Look-Up Table (n-D) double, single, int8, uint8 , int16, uint16, int32
, uint32
Table data
9-64
Table data ( )
4 N
breakpoint set Explicit number of dimensions
Table data
Table data Number of table dimensions
MATALB
MATALB Multidimensional Arrays
9-65
9-66
(
2 )
(
2 )
Discrete Filter
9Discrete Filter
Discrete
9-82 Discrete
Transfer Fcn
IIR FIR
Discrete Filter
z-1( ) Discrete
Transfer Fcn z
n n-1
Simulink
9-243 Transfer Fcn
double
Numerator
[1]
9-67
Discrete Filter
Denominator
[1 2]
Sample time
9-68
Numerator Denominator
Denominator -1
Sources
9-69
Amplitude
1
Period
2
Pulse width
1
Phase delay
0
Sample time
1
Interpret vector parameters as 1-D
pulse generation
9-70
9-71
Discrete State-Space
9Discrete State-Space
Discrete
Discrete State-Space
x ( n + 1 ) = Ax ( n ) + Bu ( n )
y ( n ) = Cx ( n ) + Du ( n )
u x y
A n n n
B n m m
C r n r
D r m
n
1 1
B D C D
Simulink
9-72
Discrete State-Space
A, B, C, D
Initial conditions
0
Sample time
D 0
9-73
Discrete-Time Integrator
9Discrete-Time Integrator
Discrete
Discrete-Time Integrator
Integrator
Discrete-Time Integrator
Forward Euler( )
Backward Euler( )Trapezoidal( ) Simulink
k y(k) x(k+1) T (
delta T)
x(0)=IC (
)
Forward Euler ( ) Forward Rectangular( )
1/s T/(z-1)
9-74
0:
y(0) = x(0) = IC ( )
x(1) = y(0) + T*u(0)
1:
y(1) = x(1)
x(2) = x(1) + T*u(1)
k:
y(k) = x(k)
Discrete-Time Integrator
1
Backward Euler Backward Rectangular( )
1/s T*z/(z-1)
y(0) = x(0) = IC ( )
x(1) = y(0)
1:
k:
1
Trapezoidal 1/s T/2*(z+1)/(z-1)
T ( )
0:
y(0) = x(0) = IC ( )
x(1) = y(0) + T/2 * u(0)
1:
k:
9-75
Discrete-Time Integrator
T ( )
0:
y(0) = x(0) = IC ( )
x(1) = y(0)
1:
k:
Initial condition
source internal Initial condition
9-76
Discrete-Time Integrator
bounce
clutch
Simulink
Show state port
Limit output
9-77
Discrete-Time Integrator
3
1
0
-1
Limit output 3
1 1
1
External reset
9-78
Discrete-Time Integrator
rising
falling
either
level
9-79
Discrete-Time Integrator
Integrator method
ForwardEuler
External reset
(rising, falling, either)
Initial condition
Initial condition source internal
Limit output
Lower saturation limit Upper saturation limit
9-80
Discrete-Time Integrator
Sample time
1
1
1
1
9-81
Discrete
n1
nm
num 0 z + num 1 z
+ + num m z
num ( z )
H ( z ) = ------------------ = -------------------------------------------------------------------------------------------------n
n
1
den ( z )
den0 z + den 1 z
+ + denn
m+1 n+1 num den
z num
den
9-82
Numerator
[1]
Denominator
[1 0.5]
Sample time
1
Numerator Denominator
Denominator -1
9-83
Discrete Zero-Pole
9Discrete Zero-Pole
Discrete
Discrete Zero-Pole z
- -
MATLAB
( z Z 1 ) ( z Z 2 ) ( z Z m )
Z( z)
H ( z ) = K ----------- = K ----------------------------------------------------------------P(z)
( z P 1 ) ( z P 2 ) ( z P n )
Z P K
(n m)
9-276 Zero-Pole
Zeros
[1]
9-84
Discrete Zero-Pole
Poles
[0 0.5]
Gain
1
Sample time
Poles
9-85
Display
9Display
Sinks
Display
Format
short 5
long 15
short_e 5
long_e 16
bank ( $
)
Display Floating display
Display
Decimation n
n
1
Sample time
-1
Display
9-86
Display
Display
Format
short
Decimation
1
Floating display
Display
9-87
Display
Sample time
9-88
Dot Product
9Dot Product
Math
Dot Product 2 y
MATLAB
y = sum(conj(u1) .* u2 )
u1 u2 2
double (
)
1
Product
9-89
Dot Product
9-90
Enable
9Enable
Enable Enabled
Enabled
Enable
Simulink Enabled
Enabled
( ) States when enabling
Enabled
reset ( )
held
Show output port
Enable
Enable
Enabled 8
9-91
Enable
Show output port
Simulink Enable Enable
9-92
Enable
Fcn
9Fcn
Fcn C
u u u(i) i
u(1) u
(+ * /)
(== != > < >= <=) TRUE( ) 1
0
(&& || !) TRUE( ) 1
0
abs, acos, asin, atan, atan2, ceil, cos, cosh, exp, fabs, floor, hypot, ln, log, log10,
pow, power, rem, sgn, sin, sinh, sqrt, tan, and tanh.
MATLAB
( A A(1,1))
C
1 ()
2 + ( )
3 pow ( )
4 !
5 */
6 +
7 > < <= >=
8 = !=
9-93
Fcn
9 &&
10 ||
MATLAB
(:)
Math Function
(
sin)
Fcn double
Expression
C
(
9-94
First-Order Hold
9First-Order Hold
Discrete
First-Order Hold 1
Sample time
1 1
9-95
First-Order Hold
9-96
From
9From
From Goto
Goto
From Goto
Goto
From Goto tag Goto
Goto
Goto From
From 1 Goto
Goto From
Block1 Block2
Block1 Goto
From Block2
Block1
Block2
Block1
Goto
From
Block2
Goto From
(
)
Goto
From
7
Goto From
9-111 Goto 9-114 Goto Tag
Visibility Goto
([])
({})
9-97
From
From
Goto tag
From Goto
9-98
Goro
From File
9From File
Sources
From File
t1
t2
t final
u1 1 u1 2 u1 final
un 1 un 2 un final
m
m-1
Simulink 2 2
time values: 0 1 2 2
data points: 2 3 4 5
2 4
Simulink
To File
9-99
From File
To File To Workspace
From File To File
To Workspace
Simulation
Parameters Workspace I/O
4
From File
From File
File name
untitled.mat
Simulink MATLAB (
MATLAB pwd
)Simulink
Sample time
9-100
From File
9-101
From Workspace
9From Workspace
Sources
( 5-19
)From Workspace Data
(2 )
structure-with-time
(1 )
Interpolate data
9-102
Interpolate
Extrapolate
On
Extrapolate
Off
SettingToZero
On
SettingToZero
Off
HoldingFinalValue
On
From Workspace
Interpolate
HoldingFinalValue
Off
CyclicRepetition
On
CyclicRepetition
Off
Simulink
time: 0 1 2 2
signal: 2 3 4 5
2 5 5
From Workspace
To Workspace ( 9-240 To Workspace
) ( 9-240 To
Workspace )To Workspace
From Workspace
double
double
9-103
From Workspace
Data
T U
[T,U]
Sample time
Interpolate data
9-104
From Workspace
9-105
Function-Call Generator
9Function-Call Generator
Function-Call double
Function-Call
Sample time
Number of iterations
9-106
Function-Call Generator
9-107
Gain
9Gain
Math
Gain
Gain
Multiplication
Gain Gain
Gain
single double
Gain boolean
Gain Gain
Gain
Gain
Simulink
Simulink
uint8 -1
Simulink
9-108
Gain
Multiplication
K.*u ( )
K*u ( )
u*K ( )
Gain
1Gain double
Grain
K
Saturate on integer overflow
Gain
9-109
Gain
9-110
Gain
Goto
9Goto
Goto From
From Goto
From
From From 1
Goto Goto
From
From Goto
9-97 From Goto
From Tag Goto
scoped Goto
Simulink
scoped Goto
Goto Tag Visibility
Goto From
local Goto
From global scoped
9-111
Goto
global
scoped
(A) 2 scoped
Goto
Tag
Goto
Goto
9-112
Goto
Tag visibility
Goto local, scoped, global
local
9-113
Goto
Goto tag
Goto
9-114
N/A
N/A
Ground
9Ground
Ground
Simulink
" " Ground
Ground
Ground ( )
.
Constant Ground
(int8) Ground
9-115
Hit Crossing
9Hit Crossing
1 2
(
) 2 1
Show output port
"Almost Equal"
9-116
Hit Crossing
9-117
IC
9IC
IC
IC "test signal"
t = 0 3 6
IC
3-18
IC double
Initial value
1
9-118
IC
9-119
Inport
9Inport
Inport
Simulink Inport
Inport 1
Inport
Inport
Inport
Inport
Inport
Inport
Sample time
(-1)
Inport Inport
Inport
Inport
Subsystem
Inport
Subsystem Inport Subsystem
Port number
Port number 1
9-120
Inport
Subsystem
Inport Subsystem
Inport Format
Hide Name Edit Update
Diagram
Inport
Inport 2 1
Simulation Parameters
sim
Simulation
Parameters ( 5-19
) sim ( 5-38 sim ) ut
linmod trim
Inport
Inport 5
Inport
Inport
Inport Signal type Data type
( )
Inport
Inport
Inport
9-121
Inport
Outport
Enabled
In1
In2
Port number
Inport
Port dimensions
Inport -1
9-122
Inport
Sample time
Data type
Signal type
( )
3 Inport
Inport
Interpolate data
5-19
9-123
Integrator
9Integrator
Continuous
Integrator
Integrator
Discrete-Time Integrator
9-124
Integrator
bounce
clutch
Simulink
Show state port
Limit output
9-125
Integrator
Show saturation port
3
1
0
-1
3
1 1
1
External reset
1
rising
falling
either
level
9-126
Integrator
Integrator
Absolute tolerance
5-14
Integrator double
double boolean
9-127
Integrator
External reset
(rising, falling, either, level)
Limit output
Lower saturation limit Upper saturation limit
9-128
Integrator
Absolute tolerance
Limit output
1
1
1
9-129
Logical Operator
9Logical Operator
Math
2 2
2 2
(
)
AND 2 2
AND
2 2
NOT
1 1 1
2
NOT 1
9-130
Logical Operator
Operator
9-131
Look-Up Table
9Look-Up Table
Look-Up Table
2 2
2 1 Look-Up Table (2-D)
9-135 Look-Up Table (2-D)
[2 1 1 0 0 0 1 1 2]
values [1 1 2 2 1 2 2 1 1]
u = -1, 0, +1 3
9-132
Look-Up Table
u
u -1 y
-2
u
u 1 y
2
u 2
u = 0 y = 1 1
0 u = 0 2
3
1
Look-Up Table
Apply Close
9-133
Look-Up Table
Vector of output values
9-134
Table
Row Column
Row Column
2
2 2
Row Column
Look-Up Table
Look-Up Table
( 9-132 Look-Up Table )
Row: [1 2]
Column: [3 4]
Table: [10 20; 30 40]
9-135
1 2 4
( 1) 2 ( 4)
1 10 20
2 30 40
2 1.72 3.4
(28)
3
3.4 4
1 10 14 20
1.7 24 28 34
2 30 34 40
Row
9-136
Column
Table
Row Column
1 1
9-137
N N
Flat ( )
Natural ( )
1 2 3
Table data N
( ) 2
9-138
9-139
9-140
"Linear Search"
"Begin index searches using previous index results"
1 2
Table data
N breakpoint set
4 Explicit number of dimensions
Interpolation method
None (flat), Linear, Cubic Spline.
Extrapolation method
None (clip), Linear, Cubic Spline.
Action for out of range input
None, Warning, Error
"Warning"
9-141
9-142
Magnitude-Angle to Complex
9Magnitude-Angle to Complex
Math
Magnitude-Angle to Complex
double
double
( )
Input
Angle (Magnitude)
9-143
Magnitude-Angle to Complex
9-144
2 1
Manual Switch
9Manual Switch
Nonlinear
Manual Switch 2
(
)
Manual Switch
Manual Switch
( )
N/A
9-145
Math Function
9Math Function
Math
Math Function
Simulink
Fcn
Math Function
Function
9-146
Math Function
magnitude squared
9-147
MATLAB Fcn
9MATLAB Fcn
MATLAB
sin
atan2(u(1), u(2))
u(1)^u(2)
MATLAB
Fcn (Fcn
Elementary Math ) M-
MEX- S- S-Function
9-148
MATLAB Fcn
MATLAB function
Output dimensions
-1
N/A
9-149
Matrix Gain
9Matrix Gain
Math
Matrix Gain
Gain
Gain
eye(3,3) Gain
Multiplication
9-150
Matrix Gain
9-151
Memory
9Memory
Continuous
Memory 1
(
)
Sum
Memory
ode15s ode113
Memory
Memory (
)
0
Initial condition
9-152
Memory
Initial condition
9-153
Merge
9Merge
Merge
Merge
Merge "
"
Merge
Selector 1 4
Merge Selector
9-154
Merge
( )
Merge (
)
0
9-155
Merge
Number of inputs
Initial output
1
Allow unequal port widths
9-156
MinMax
9MinMax
Math
MinMax
Function 1
MinMax double
Function
(min max)
Number of input ports
9-157
MinMax
9-158
Model Info
9Model Info
ModelInfo
vdp
Model Info
Model Info /
9-159
Model Info
Model Info
1.1
Version %<ModelVersion>
Version 1.1
Model properties.
Editable
text Created( )
9-160
Model Info
RCS properties.
( 4-110
Configuration manager )
( RCS
Properties)Model Info
Model Info
9-161
Multiport Switch
9Multiport Switch
Nonlinear
Multiport Switch
( )
Multiport Switch
( ) 1
out-of-bounds
( )
Multiport Switch
( )
Out of bound
Out of bounds
9-162
Multiport Switch
Number of inputs
9-163
Mux
9Mux
Mux 1
Mux
composite Mux
(1 )
1 1
Mux
( ., Demux, Subsystem, Go To )
1 composite
Mux
Simulink
signalN N
[2 3] 2 3
Simulink
-1
N N
[M N] M N -1
Simulink
position,velocity
9-164
Mux
Mux
Number of inputs
Display option
none
Mux
signals
bar
9-165
Outport
9Outport
Outport
Simulink Outport
Outport1
Outport
Outport
Outport
Outport
Outport
Outport
Outport
Outport
Outport Subsystem
Subsystem
Outport Port number Subsystem
Port number
1 Outport Subsystem
Outport Simulink
9-166
Outport
Outport Subsystem
Outport
Format Hide Name
Outport
Outport Enabled
Outport
Outport 2 1
Simulation
Parameters sim
1
Simulation Parameters
(5-22 Saving Output to the Workspace ) sim
( 5-38 sim). Outport
[t,x,y] = sim(...);
y Outport
Outport
2 ( ) Outport
2 Outport
Outport 1 speed
Outport 2 dist
[t,x,speed,dist] = sim(...);
linmod trim
Outport 5
9-167
Outport
Outport MATLAB
Outport
outport
Simulink
Simulink
Simulink
Port number
Outport
Output when disabled
Initial output
9-168
Outport
9-169
Product
9Product
Math
Number of inputs * /
*/
Multiplication element-wise
Multiplication element-wise *
/
n
n
y i = u1 i u2 i un i
( Dot Product
1 1 1
Multiplication matrix *
/
Number of Inputs
*/* AB-1C A, B, C 1,2,3
9-170
Product
Simulink
Product
single double
9-171
Product
Multiplication
Number of inputs
* / 2
Saturate on integer overflow
Product
Simulink Simulation
Parameters Diagnostics Data overflow
( 5-25 Diagnostics
)
9-172
Probe
9Probe
Probe Probe
Probe 1
(
)
Probe
double
Probe double
1 /
Probe width
( )
Probe sample time
9-173
Probe
Probe signal dimensions
9-174
Pulse Generator
9Pulse Generator
Sources
Pulse Generator
Amplitude, Period, Duty cycle, Start time
( )
Pulse Generator
Discrete Pulse Generator
Pulse Generator
( ) Amplitude
Period
1
Duty cycle
50
9-175
Pulse Generator
Amplitude
1
Start time
0
Interpret vector parameters as 1-D
1 1
1 ( )
9-176
Quantizer
9Quantizer
Nonlinear
Quantizer
1
y = q * round(u/q)
y u q Quantization interval
Quantization interval
Quantizer n*q
n q Quantization interval 0.5
Treat as gain when linearizing
Simulink Quantizer
9-177
Quantizer
9-178
Ramp
9Ramp
Sources
Ramp
SlopeStart timeDuty
CycleInitial output
Ramp double
Slope
1
Start time
0
Initial output
0
Interpret vector parameters as 1-D
1 1
1-D ( )
9-179
Ramp
9-180
Random Number
9Random Number
Sources
Random Number
0 1
Random Number
Initial seed
Uniform Random Number
9-181
Random Number
Mean
0
Variance
1
Initial seed
0
Sample time
0
9-182
Rate Limiter
9Rate Limiter
Nonlinear
Rate Limiter
u(i ) y(i 1)
rate = ---------------------------------t(i) t(i 1 )
u(i) t(i) y(i1) t(i1)
rate Rising slew rate Falling slew rate
y ( i ) = t R + y ( i 1 )
rate Falling slew rate (F )
y ( i ) = t F + y ( i 1 )
rate R F
y(i) = u(i )
9-183
Rate Limiter
Falling slew rate
9-184
Real-Imag to Complex
9Real-Imag to Complex
Math
Real-Imag to Complex
( )
1
( )
double
double
Input
9-185
Real-Imag to Complex
Real (Imag) part
9-186
Relational Operator
9Relational Operator
Math
Relational Operator 2
==
2 TRUE
~=
2 TRUE
<
2 TRUE
<=
2 TRUE
>=
2 TRUE
>
2 TRUE
TRUE 1 FALSE 0
Relational Operator
== != 1
boolean ( 4-49
Boolean )boolean
double
9-187
Relational Operator
Operator
9-188
Relay
9Relay
Nonlinear
Relay 2
Switch off point
Switch on point
1 1
Relay double
Switch on point
eps
Switch off point
eps
Output when on
1
9-189
Relay
Output when off
0
9-190
Repeating Sequence
9Repeating Sequence
Sources
Repeating Sequence
( )
1 Time values Output values
[0 2]
2 2
Repeating Sequence
1 Look-Up Table
Time values
[0 2]
9-191
Repeating Sequence
Output values
[0
2]
9-192
Reshape
9Reshape
N- 1xN Nx1
Output dimensionality
Output
Dimensionality
(2 ) (1 )
1
2 (
)
Mx1
M
1xN
N
Output dimensions
Output dimensions
1 2
[N] N [M N]
MxN Output
dimensions
9-193
Reshape
Reshape
Output dimensionality
Output dimensions
Output
dimensionality Customize
9-194
N/A
Rounding Function
9Rounding Function
Math
Rounding Function
Function 1
Function floor, ceil, round, fix
Rounding Function
double
Fcn Rounding
Function Fcn
Function
N/A
9-195
Saturation
9Saturation
Nonlinear
Saturation
Upper limit
Lower limit
9-196
Saturation
9-197
Scope
9Scope
Sinks
Scope
Scope ( 1 )
y-
Scope
Scope
Scope
Simulink Scope
Scope
Scope Scope (1 )
Scope
Scope
Scope Scope
Scope
Scope
x-y
x
y
Auto-Scale
9-198
Scope
Scope
scope
Scope
6 Scope
Properties....
Y-min
y
Y-max
y
Title
%<SignalLabel>
(%<SignalLabel>
9-199
Scope
Time Offset
vdp Scope
40 Scope
20 Time offset
0 x
9-200
Scope
Scope
Auto-scale
y
y
Auto-scale
Auto-scale
x y
Zoom
Scope
Scope y x-y
x-y x x-y
x-y x
9-201
Scope
x Zoom
9-202
Scope
Scope
Scope
y Zoom
x
Scope
Properties
Properties
9-203
Scope
Properties
General
General
floating scope
Number of axes
Scope
x y
y
Time range
Time range auto x
auto
x
Tick labels
Tick labels
bottom axis
9-204
Scope
Floating scope
Scope Floating scope
Scope
Scope
Scope Scope
Properties General
Floating scope
Scope Scope
Shift
1
1
Scope
5-31
Sampling
Decimation
Sample time
9-205
Scope
Apply OK
Scope
1000
2000 1000
Variable name
Variable name
Scope To Workspace
9-206
Scope
Scope
Scope To Workspace
Format
3
Matrix, Structure, Structure with time
Scope Matrix
Scope
Structure Structure
with time
Scope
Scope Scope
Print Scope Properties
Print icon
Scope
9-207
Selector
9Selector
Selector
Slector
Input
Type ( )
Selector
Elements
Source of element indices
(internal external) external
1
Selector [2 4 6
8 10] Elements [5 1 3]
external
Elements
9-208
Selector
-1
Selector
Rows Columns
Selector
9-209
Selector
Input Type
:
Source of element indices
internal Elements
external
Elements
9-210
Selector
Input Type
:
Source of row indices
internal
Rows external
Rows
9-211
S-Function
9S-Function
S-Function S-
S-function name S- S M- MEX-
S-
S-Function S-
MATLAB
A, B, C, D, [eye(2,2);zeros(2,2)]
S-Function S-
1 1
S-
S-
S-
2 2
S-
9-212
S-Function
S-Function
S-function name
S-function
S-function parameters
S-function
S-function
S-function
S-function
S-function
9-213
Sign
9Sign
Math
Sign
1
0
-1
double
Dialog Box
9-214
N/A
Signal Generator
9Signal Generator
Sources
Signal Generator 3 1
( )
/
Scope
Sine Wave
Square Wave
Sawtooth Wave
Amplitude 180 180
Clock MATLAB Fcn
9-215
Signal Generator
Signal Generator
Amplitude Frequency
Wave form
Amplitude
1
Frequency
1
Units
/
9-216
Signal Generator
9-217
Sine Wave
9Sine Wave
Sources
Sine Wave
Sine Wave
y = Amplitude sin ( frequency time + phase )
Sample time
0 ( )
>0
-1
Sine Wave
Sample time
Zero-Order Hold
Sine Wave /
Sine Wave
9-218
Sine Wave
Sine Wave
Sample time
Sine Wave
9-219
Sine Wave
Amplitude
1
Frequency
/ 1 /
Phase
0
Sample time
0
Interpret vector parameters as 1-D
Sine Wave
9-220
Slider Gain
9Slider Gain
Math
Slider Gain
1 1
Low
0
High
2
( )
2
Close
1%
10%
Gain
9-221
Slider Gain
9-222
State-Space
9State-Space
Continuous
State-Space
x = Ax + Bu
y = Cx + Du
x u y
A n n n
B n m m
C r n r
D r m
n
1 1
B D C D
Simulink
A State-Space double
9-223
State-Space
A, B, C, D
Initial conditions
9-224
D 0
Step
9Step
Sources
Step 2
Step time
Initial value Step
time Final value
Step
Step double
Step time
Initial value Final value
1
9-225
Step
Initial value
Step time
0
Final value
Step time
1
9-226
Stop Simulation
9Stop Simulation
Sinks
Stop Simulation
Relational Operator
10
9-227
Subsystem
9Subsystem
Subsystem 1
()
Edit
Create Subsystem Simulink Subsystem
Inport Outport
Subsystem
Inport
Outport
3 Subsystems
9-228
Subsystem
Simulink
Simulink
3-13 Atomic
9-229
Subsystem
Access
ReadWrite
ReadOnly
NoReadOrWrite
9-230
Subsystem
9-231
Sum
9Sum
Math
Sum
2 2
2 2
2 2 2
2
( )
9-232
Sum
Sum
Icon shape
Icon shape Sum
Sum
List of signs
List of signs -
Simulink
-
Simulink
List of signs |
|
++|-- 2 + -
9-233
Sum
Data overflow ( 5-25
Diagnostics )
9-234
Switch
9Switch
Nonlinear
Switch 3 2 1
(2 ) Threshold
3
( 0 1) 0.5
Switch ( 1 3)
Switch
Threshold
(2 )
9-235
Switch
9-236
Terminator
9Terminator
Terminator
Simulink
Terminator
Terminator
9-237
To File
9To File
Sinks
To File MAT-
1
t1
t2
t final
u1 1 u1 2 u1 final
un 1 un 2 un final
From File To File
From Workspace
To File
Decimation n
n 1
Sample time
-1
9-238
To File double
To File
Filename
MAT-
Variable name
Decimation
1
Sample time
9-239
To Workspace
9To Workspace
Sinks
To Workspace
Variable name
Save format
Array
To Workspace N-
N 1
1 ( )
2 2 ( ) 3
simout
simout(1,:) simout(2,:) 2
3
simout simout(:,:,1)
simout(:,:,2) 2
inf
Decimation n
n 1
Sample time
-1
9-240
To Workspace
Structure
3 blockName
blockName To Workspace
2
Structure
From Workspace
From Workspace
" "
Structure with Time
9-241
To Workspace
To Workspace MATLAB
Variable name
Save format
9-242
Transfer Fcn
9Transfer Fcn
Continuous
nn 1
nn 2
y(s)
num ( s )
num ( 1 )s
+ num ( 2 )s
+ + num ( nn )
H ( s ) = ---------- = ------------------ = -------------------------------------------------------------------------------------------------------------------nd 1
nd 2
u(s)
den ( s )
den ( 1 )s
+ den ( 2 )s
+ + den ( nd )
nn nd num den s
num
den
Transfer Fcn
tf2ss State-Space
tf2ss ABCD
help tf2ss Control System Toolbox Users Guide
Transfer Fcn
Transfer Fcn
s
Numerator [3,2,1]
Denominator ((den)) ( (den) [7,5,3,1])
9-243
Transfer Fcn
"(s)"
Numerator numDenominator den
Numerator
[1]
Denominator
[1 1]
9-244
Numerator Denominator
Denominator -1
Transfer Fcn
9-245
Transport Delay
9Transport Delay
Continuous
Transport Delay
Time delay
Initial input
Time delay
Simulink
1
t = 5 0.5
t = 4.5
t=4
Transport Delay t - tdelay
Unit Delay
9-246
Transport Delay
Time delay
Initial input
Time delay
Initial buffer size
9-247
Trigger
9Trigger
Trigger Triggered
Triggered
( )
1 Trigger 1
Triggered 7
Trigger type
rising (
)
falling
(
)
either
function-call S-function
( 7 "Function-Call "
)
Show output port
1
-1
0
9-248
Trigger
Trigger
Trigger type
9-249
Trigonometric Function
9Trigonometric Function
Math
Trigonometric Function
Function Function
sin, cos, tan, asin, acos, atan, atan2, sinh, cosh, tanh
Trigonometric Function
Simulink
Trigonometric Function
double
Fcn
Trigonometric Function
Function
9-250
Trigonometric Function
9-251
Sources
9-252
Minimum
-1
Maximum
1
Initial seed
0
Sample time
0
Interpret vector parameters as 1-D
Step
9-253
Unit Delay
9Unit Delay
Discrete
Unit Delay 1
z-1
Zero-Order Hold
1 Discrete Transfer Fcn
(Unit Delay Transport Delay
)
Unit Delay
Initial condition
Unit Delay
0
Sample time
1
9-254
Initial condition
Unit Delay
9-255
Continuous
2
2
Maximum delay
Maximum delay
Initial input
1 t = 5
0.5 t = 4.5
t = 4
Variable Transport Delay
t - tdelay
9-256
Maximum delay
10
Initial input
0
Buffer size
1024
Pade order (for linearization)
0
n
n transport delay
(2 )
Buffer size
9-257
9-258
Width
9Width
Width
Width
Width double
9-259
XY Graph
9XY Graph
Sinks
2 (x )
2 (y )
2
Simulink XY Graph
Figure
XY Graph
lorenzs
XY Graph double
x-min
x -1
9-260
XY Graph
x-max
x 1
y-min
y -1
y-max
y 1
Sample time
-1
9-261
Zero-Order Hold
9Zero-Order Hold
Discrete
Zero-Order Hold
1 1
Zero-Order Hold 1
Quantizer
A/D
A Zero-Order Hold
Sample time
1
9-262
States
Zero-Pole
9Zero-Pole
Continuous
Zero-Pole Laplace s
- -
MATLAB
Z( s)
( s Z ( 1 ) ) ( s Z ( 2 ) ) ( s Z ( m ) )
H ( s ) = K ----------- = K ---------------------------------------------------------------------------------P(x)
( s P ( 1 ) ) ( s P ( 2 ) ) ( s P ( n ) )
Z P K Z
P K
Z
Zero-Pole
Zero-Pole
"(s)" Zeros zerosPoles polesGain
gain
9-263
Zero-Pole
Zero-Pole double
Zeros
[1]
Poles
[0 -1]
Gain
[1]
9-264
Poles Zeros
Poles
10
. . . . . . . . . . . . . . . .
. . .
Simulink
add_block . . . . . . . . . . . . . . . .
add_line . . . . . . . . . . . . . . . . .
bdclose . . . . . . . . . . . . . . . . .
bdroot . . . . . . . . . . . . . . . . .
close_system . . . . . . . . . . . . . . .
delete_block . . . . . . . . . . . . . . .
delete_line . . . . . . . . . . . . . . . .
find_system . . . . . . . . . . . . . . .
gcb . . . . . . . . . . . . . . . . . . .
gcbh . . . . . . . . . . . . . . . . . .
gcs . . . . . . . . . . . . . . . . . . .
get_param . . . . . . . . . . . . . . . .
new_system . . . . . . . . . . . . . . .
open_system . . . . . . . . . . . . . . .
replace_block . . . . . . . . . . . . . .
save_system . . . . . . . . . . . . . . .
set_param . . . . . . . . . . . . . . . .
simulink . . . . . . . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.10-2
10-3
10-3
10-4
10-5
10-6
10-7
10-8
10-10
10-11
10-12
10-17
10-18
10-19
10-20
10-22
10-23
10-24
10-26
10-27
10-29
10
10-2
Simulink
new_system
open_system
close_system, bdclose
save_system
find_system
add_block
delete_block
replace_block
add_line
delete_line
get_param
set_param
gcb
gcs
gcbh
Simulink
bdroot
Simulink
simulink
Simulink
Simulink
mdl
system
system/subsystem1/.../subsystem
system/subsystem1/.../subsystem/block
sprintf('\n')
cr
Signal Generator Amplitude
cr = sprintf(\n);
get_param([untitled/Signal,cr,Generator],Amplitude)
ans =
1
(/)
mymodel Signal/
Noise Location
get_param(mymodel/Signal//Noise,Location)
10-3
add_block
Simulink
add_block(src, dest)
add_block(src, dest, parameter1, value1, ...)
built-in Simulink
( Simulink
)
add_block(src, dest_obj, parameter1, value1, ...)
add_block(simulink/Sinks/Scope, engine/timing/Scope1)
F14 controller
add_block(built-in/SubSystem, F14/controller)
delete_block, set_param
10add_block
10
10-4
add_line
10add_line
add_line
2
Simulink
add_line('sys', 'oport', 'iport')
'oport' 'iport' 'oport' 'iport'
'block/port'
delete_line
10-5
bdclose
10bdclose
10
Simulink
bdclose
bdclose(sys)
bdclose(all)
bdclose
bdclose(sys)
bdclose(all)
vdp
bdclose(vdp)
10-6
bdroot
10bdroot
bdroot
bdroot(obj)
bdroot
Simulink
bdroot(obj) obj
bdroot(gcb)
find_system, gcb
10-7
close_system
10close_system
close_system
close_system(sys)
close_system(sys, saveflag)
close_system(sys, newname)
close_system(blk)
close_system
close_system
gcs
Simulink
close_system(sys)
close_system(sys, saveflag)
saveflag 0
saveflag 1
close_system(sys, newname)
close_system(blk) 'blk'
CloseFcn
close_system
vdp
close_system(vdp)
engine
close_system(engine, 1)
10-8
close_system
mymdl12 testsys
close_system(mymdl12, testsys)
10-9
delete_block
10delete_block
delete_block(blk)
delete_block(blk) blk
Simulink
vdp Out1
delete_block(vdp/Out1)
10-10
add_block
delete_line
10delete_line
Sum Mux 2
mymodel
delete_line(mymodel,Sum/1,Mux/2)
add_line
10-11
find_system
10find_system
( CaseSensitive
)
A
10-12
SearchDepth
(0 --
1 --
2 --
LookUnderMasks
none
find_system
{graphical}
functional
all
FollowLinks
on| {off}
on
off
FindAll
on| {off}
on
off
find_system
on sys
CaseSensitive
{on}| off
on
on
RegExp
on| {off}
on
off
constraint
find_system
find_system
10-13
find_system
clutch Unlocked
Goto
find_system(clutch/Unlocked,SearchDepth,1,BlockType,Goto)
Gain 1 vdp
Gain
gb = find_system(vdp, BlockType, Gain)
find_system(gb, Gain, 1)
vdp
RegExp on find_system
(.)
find_system
find_subystem
10-14
find_system
a. aa, ab,
ac
0
ab* a, ab, abb
.*
1
ab+ ab, abb
^a.* a
.*a$ a
" "
\\ \
[]
1
f[oa]r for far
(-)
[a-zA-Z1-9]
circumflex (^)
f[^i]r far for
fir
\w
( [a-z_A-Z0-9]
)^\w mu
&mu
\d
([0-9] )\d+
\D
([^0-9] )
10-15
find_system
\s
([ \t\r\n\f] )
\S
([^ \t\r\n\f] )
\<WORD\>
WORD WORD
\<to\> to today
Simulink regexp
find_system on
Simulink clutch
inport outport
find_system(clutch, regexp, on, blocktype, port)
10-16
get_param, set_param
gcb
10gcb
gcb
gcb(sys)
gcb
Simulink
gcb(sys)
S-Function
MATLAB S-Function
MaskInitialization
gcb
ans =
clutch/Locked/Inertia
Gain
get_param(gcb,Gain)
ans =
1/(Iv+Ie)
gcbh, gcs
10-17
gcbh
10gcbh
gcbh
gcbh
gcbh
ans =
281.0001
10-18
gcb
gcs
10gcs
gcs
gcs
S-Function
S-Function
MaskInitialization
bdroot
gcs
ans =
clutch/Locked
gcb, bdroot
10-19
get_param
10get_param
get_param(obj, parameter)
get_param( { objects }, parameter)
get_param(handle, parameter)
get_param('obj', ObjectParameters)
get_param('obj', 'DialogParameters')
Name Name
Name,Type,Attributes
3 3
"Gain"
get_param(obj, DialogParameters)
10-20
get_param
73
mx+b ( )
get_param(gcb, Name)
Name
p = get_param(gcb, ObjectParameters);
a = p.Name.Attributes
ans =
read-write always-save
Sine Wave
p = get_param(untitled/Sine Wave, DialogParameters)
p=
Amplitude
Frequency
Phase
SampleTime
find_system, set_param
10-21
new_system
10new_system
new_system(sys)
new_system(sys) sys
new_system
Simulink
'mysys'
new_system(mysys)
vdp 'mysys'
new_system(vdp/mysys)
10-22
open_system
10open_system
open_system(sys)
open_system(blk)
open_system(blk, force)
Simulink
open_system(sys)
open_system(blk) blk
OpenFcn
controller
open_system(controller)
controller Gain
open_system(controller/Gain)
10-23
replace_block
10replace_block
Simulink
RepNames = replace_block(f14,Gain,Integrator)
replace_block(clutch/Unlocked,Gain,bv,Integrator)
replace_block(f14,Gain,Integrator,noprompt)
10-24
replace_block
find_system, set_param
10-25
save_system
10save_system
save_system
save_system(sys)
save_system(sys, newname)
save_system
Simulink
save_system(sys)
save_system(sys, newname)
save_system
vdp
save_system(vdp)
vdp myvdp
save_system(vdp, myvdp)
10-26
set_param
10set_param
Simulink
2 Position
UserData
vdp Fcn
set_param(vdp/Fcn, Position, [50 100 110 120])
Gain
k Gain
10-27
set_param
set_param(mymodel/Subsystem, k, 10)
mymodel Compute
OpenFcn my_open_fcn
Compute 4
71
set_param(mymodel/Compute, OpenFcn, my_open_fcn)
10-28
get_param, find_system
simulink
10simulink
simulink
Simulink
10-29
simulink
10-30
11
Simulink
. . . . . . . . . . . . . . . . . . . . . .11-3
. . . . . . . . . . . . . . . . . . .11-4
. . . . . . .11-6
. . . . . . . . . . . . . . . . . . . . .11-7
. . . . . . . . . . . . . . . . . . .11-8
. . . . . . . . . . . . . . . . . . 11-11
. . . . . . . . . . . . 11-16
. . . . . . . . . . . . . . . . . 11-20
. . . . . . . . . . . . . . . 11-24
11 Simulink
Simulink Simulink
Simulink
11-2
Tools
Debugger
sldebug
sim
(sim 5-38 sim )
sim(vdp,[0,10],simset(debug,on))
sldebug 'vdp
Simulink vdp
GUI
114
11-3
11 Simulink
Start/Continue
Start/Continue button
First block to
be executed.
MATLAB
11-4
GUI
( 116
)
GUI
MATLAB
11-5
11 Simulink
MATLAB
1124
MATLAB (Return )
Simulink
s:b s
b
0:1
0 1 slist
(11-43
slist )
MATLAB
sldebug MATLAB
tout yout
sldebug
s step
sldebug s
(sldebug...) eval(s)
11-6
Help
F1
Help
Help button
MATLAB F1
help
11-7
11 Simulink
Simulink
(1111 )
GUI
Start/ContinueStop
...
step
next
continue
run
GUI
Run/Continue
Run/Continue continue
11-8
( 1111 )
run
MATLAB
step
( 1120
)
vdp
(U) (Y)
(GUI
) MATLAB ( )
11-9
11 Simulink
Y1 = [2]
(sldebug @0:1 vdp/Out1):
GUI
MATLAB vdp
MATLAB
(sldebug @0:8 vdp/Sum): step
U1 = [2]
U2 = [0]
Y1 = [-2]
[Tm=0.0001004754572603832 ] **Start** of system vdp outputs
next
11-10
Simulink
continue
2
continue
Breakpoint
(GUI )
...
11-11
11 Simulink
...
tbreak [t]
nanbreak
(NaN)
(Inf)
xbreak
zcbreak
break gcb
( )
break s:b
s:b ( 116
)
11-12
slist
(1121 )
bafter
break
clear gcb
11-13
11 Simulink
Stop at time
(GUI ) tbreak
vdp
tbreak 9
continue
continue 9.0785
[Tm=9.07847133212036
Simulink
Simulink (rising
falling) zeroxing
sldebug zeroxing
[Tm=0
] **Start** of system zeroxing outputs
(sldebug @0:0 zeroxing/Sine Wave): zcbreak
11-14
rising
[Tm=0.34350110879329
[Tm=0.34350110879329
Saturation
11-15
11 Simulink
Simulink
I/O
I/O
Watch Block I/O Display Block I/O
I/O ...
probe
disp
trace
I/O
I/O GUI
probe
11-16
probe
probe probe
probe
probe gcb
I/O
probe s:b
s b
I/O
(GUI ) MATLAB
probe I/O
I/O
disp
disp gcb
undisp
block 0:0
undisp gcb undisp 0:0
I/O GUI
disp
I/O disp
I/O step
I/
O I/O
disp
11-17
11 Simulink
I/O
trace GUI
Watch points watch
trace
untrace
I/O
I/O
atrace
( 318 )
atrace 0
atrace 1
atrace 2
atrace 3
atrace 4
states MATLAB
Simulink
(bounce) 1 2
11-18
sldebug bounce
[Tm=0
] **Start** of system bounce outputs
(sldebug @0:0 bounce/Position): states
Continuous state vector (value,index,name):
10
0 (0:0 bounce/Position)
15
1 (0:5 bounce/Velocity)
(sldebug @0:0 bounce/Position): next
[Tm=0.01
] **Start** of system bounce outputs
(sldebug @0:0 bounce/Position): states
Continuous state vector (value,index,name):
10.1495095
0 (0:0 bounce/Position)
14.9019
1 (0:5 bounce/Velocity)
ishow
[Tm=9.996264188473381
[Ts=9.676264188473388
11-19
11 Simulink
Simulink
Simulink
" "
GUI Execution Order
slist
MATLAB
---- Sorted list for vdp [12 blocks, 9 nonvirtual blocks, directFeed=0]
0:0 vdp/Integrator1 (Integrator)
0:1 vdp/Out1 (Outport)
0:2 vdp/Integrator2 (Integrator)
0:3 vdp/Out2 (Outport)
0:4 vdp/Fcn (Fcn)
0:5 vdp/Product (Product)
0:6 vdp/Mu (Gain)
0:7 vdp/Scope (Scope)
0:8 vdp/Sum (Sum)
systems
Simulink clutch (clutch)
sldebug clutch
[Tm=0
] **Start** of system clutch outputs
(sldebug @0:0 clutch/Clutch Pedal): systems
11-20
0 clutch
1 clutch/Locked
2 clutch/Unlocked
systems
Simulink
Simulink
( )
systems
slist
sldebug vdp
[Tm=0
] **Start** of system vdp outputs
(sldebug @0:0 vdp/Integrator1): slist
---- Sorted list for vdp [12 blocks, 9 nonvirtual blocks, directFeed=0]
0:0 vdp/Integrator1 (Integrator)
0:1 vdp/Out1 (Outport)
0:2 vdp/Integrator2 (Integrator)
0:3 vdp/Out2 (Outport)
0:4 vdp/Fcn (Fcn)
0:5 vdp/Product (Product)
0:6 vdp/Mu (Gain)
0:7 vdp/Scope (Scope)
0:8 vdp/Sum (Sum)
slist
11-21
11 Simulink
zclist
zclist clutch
ashow
ashow s#n,
s ( 1120
) n
ashow
gcb ashow s:b
s:b
ashow clear
GUI
Status
status
vdp
sim(vdp,[0,10],simset(debug,on))
[Tm=0
] **Start** of system vdp outputs
(sldebug @0:0 vdp/Integrator1): status
Current simulation time: 0 (MajorTimeStep)
Last command: ""
Stop in minor times steps is disabled.
11-22
11-23
11 Simulink
Repeat
Return
11-24
ashow
as
atrace
at
bafter
ba
break
bshow
bs
clear
cl
continue
disp
I/O
help
? or h
ishow
minor
nanbreak
na
next
probe
1 I/O
quit
run
slist
sli
states
state
status
stat
step
stop
sto
systems
sys
tbreak
tb
trace
tr
I/O
undisp
und
untrace
unt
xbreak
11-25
11 Simulink
11-26
zcbreak
zcb
zclist
zcl
ashow
11ashow
s:b
s b
gcb
s#n
s n
clear
atrace, slist
11-27
atrace
11atrace
atrace level
level
atrace
11-28
(0 = 4 = )
atrace 0
atrace 1
atrace 2
atrace 3
atrace 4
systems, states
bafter
11bafter
bafter gcb
bafter s:b
s:b
s b
gcb
bafter
11-29
break
11break
break gcb
break s:b
s:b
s b
gcb
break
11-30
bshow
11bshow
bshow s:b
s:b
slist
s b
11-31
clear
11clear
clear gcb
clear s:b
s:b
s b
gcb
clear
bafter, slist
11-32
continue
11continue
continue
continue
11-33
disp
11disp
disp gcb
disp s:b
disp
s:b
s b
gcb
I/O
disp 1
MATLAB
disp
undisp
11-34
help
11help
help
help
11-35
ishow
11ishow
ishow
ishow
atrace
11-36
minor
11minor
minor
minor
step
step
step
step
11-37
nanbreak
11nanbreak
nanbreak
nanbreak
11-38
next
11next
next
next
next
step
11-39
probe
11probe
s:b
s b
gcb
level io
I/O
level all
probe probe /
probe I/O
probe probe gcb
I/O probe s:b
s:b I/O
disp, trace
11-40
quit
11quit
quit
quit
stop
11-41
run
11run
run
run
run
11-42
slist
11slist
slist
slist
systems
11-43
states
11states
states
states
ishow
11-44
systems
11systems
systems
systems MATLAB
slist
11-45
status
11status
status
status
11-46
step
11step
step
step
step
next
11-47
stop
11stop
stop
stop
11-48
tbreak
11tbreak
tbreak t
tbreak
tbreak
tbreak
tbreak
/
11-49
trace
11trace
trace gcb
trace s:b
s:b
s b
gcb
I/O
trace 1
I/O
11-50
undisp
11undisp
undisp gcb
undisp s:b
s:b
s b
gcb
undisp
disp, slist
11-51
untrace
11untrace
untrace gcb
untrace s:b
s:b
s b
gcb
untrace
trace, slist
11-52
xbreak
11xbreak
xbreak
xbreak
xbreak
xbreak
11-53
zcbreak
11zcbreak
zcbreak
zcbreak
zcbreak
11-54
zclist
11zclist
zclist
zclist
MATLAB
zcbreak
11-55
zclist
11-56
12
Performance Tools
Simulink Performance Tools
. . . . . . . . . . . .12-2
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . .
Simulink Accelerator . . . . . . . . . . .
. . . . . . . . . . . .
Accelerator . . . . . . . . . . . .
. . . . . . . . . . .
Simulink Accelerator Simulink Debugger . . . .
Simulink Accelerator . .
. . . . . . . . . . . . . . . . . . . .
Simulink Accelerator Build . . .
Simulink Accelerator S-
Simulink Accelerator
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.12-3
12-3
12-4
12-5
12-6
12-7
12-8
12-9
12-10
12-10
12-11
. . . . . . . . . . . . . . . . . . . . . 12-15
. . . . . . . . . . . . . . . . . 12-15
. . . . . . . . . . .
. . .
. . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
12-17
12-17
12-19
12-20
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
12-23
12-23
12-23
12-24
12-26
12-29
12-31
12 Performance Tools
Performance Tools
12-2
Simulink Accelerator
Simulink Accelerator
Simulink Accelerator Simulink MathWorks
Simulink Accelerator Simulink C
MathWorks Real-Time Workshop
C Simulink
Accelerator Real-Time Workshop Real-Time
Workshop Windows PC C
MathWorks lcc
Simulink
Simulink 2 6
12-3
12 Performance Tools
Simulink Accelerator
Simulink Accelerator Simulation
Accelerator F14
Accelerator
Simulation Start
Accelerator C
Accelerator
modelname_accel_rtw ( f14_accel_rtw)
MEX-
12-4
Simulink Accelerator
mex
MATLAB mex -setup
C
Accelerator Real-Time
Workshop
Real-Time Workshop
Simulink Accelerator
MEX-
MATLAB MATLAB Simulink
MEX-
Simulink
Accelerator C MEX- (
)
Accelerator
Trigonometric Function
Sum
S- TLC
Simulink Accelerator
Gain
12-5
12 Performance Tools
Accelerator
Accelerator
Accelerator
Simulink Accelerator Simulink
Accelerator
12-6
Simulink Accelerator
Accelerator Normal
(
) Accelerator
12-1:
Simulink
DSP Blockset
Display
Biquadratic Filter
From File
Convolution
From Workspace
Inport ( )
MATLAB Fcn
Outport (
)
Scope
To File
To Workspace
12-7
12 Performance Tools
12-1: (Continued)
Simulink
DSP Blockset
Transport Delay
XY Graph
Accelerator
Accelerator Simulink
Simulation Accelerator MATLAB
sldebug modelname
tbreak 10000
continue
emode (execution )
Accelerator Normal execution
Accelerator
Simulink 11 Simulink
12-8
Simulink Accelerator
Simulink Accelerator
set_param, sim, accelbuild 3 MATLAB
M-
MATLAB
set_param(gcs,simulationmode,mode)
set_param(modelname,simulationmode,mode)
sim(gcs); % MATLAB
set_param(gcs,simulationcommand,start); % MATLAB
gcs modelname
12-9
12 Performance Tools
MEX-
accelbuild MEX-
Accelerator
elapsed_time =
6.5880
Accelerator MEX-
Normal
12-10
Simulink Accelerator
3 Make
makefiles
Real-Time
Workshop Make
makefile Real-Time Workshop
Users Guide MathWorks Web
www.mathworks.com MATLAB CD
Simulink Accelerator S-
Target Language Compiler S-
Simulink Accelerator
Accelerator S- TLC
1 I/O
S-Function S- TLC
I/O
Accelerator
S- TLC
TLC S- MEX-
S-
S- mdlInitializeSizes
SS_OPTION_USE_TLC_WITH_ACCELERATOR S MEX- TLC
12-11
12 Performance Tools
Accelerator
12-12
2 1
Simulink Tool Model differences Model
Differencing Tool Select Second Model
12-13
12 Performance Tools
2
2
2
( )
12-14
Options
Show items with differences only 2
Include only non-graphical differences
12-15
12 Performance Tools
12-16
Simulink
Simulink
Sim()
ModelInitialize().
ModelExecute()
for t = tStart to tEnd
Output()
Update()
Integrate()
Compute states from derivs by repeatedly calling:
MinorOutput()
MinorDeriv()
Locate any zero crossings by repeatedly calling:
MinorOutput()
MinorZeroCrossings()
EndIntegrate
Set time t = tNew.
EndModelExecute
ModelTerminate
EndSim
12-17
12 Performance Tools
Simulink
0 1 Simulink
12-18
sim
ModelInitialize
ModelExecute
output
updateintegrate
Output
Update
Integrate
MinorOutput
MinorDeriv
MinorZeroCrossings
ModelTerminate
Nonvirtual Subsystem
output,
update, integrate
( 3-13 Atomic
Simulink Tools
Profiler
Simulink MATLAB help browser
12-19
12 Performance Tools
Simulink MATLAB
12-20
( Output())
( ModelExecute)
Number of Nonvirtual
Subsystem Methods
Clock Precision
Name
Time
Calls
Time/Call
Self Time
Location
12-21
12 Performance Tools
( )
( )
12-22
model coverage( )
Switch
Multiport Switch
Triggered subsystem (Trigger )
Enabled subsystem (Enable )
Absolute Value
Saturation
Stateflow
12-23
12 Performance Tools
2
3 Simulink
4
Simulink covdata
HTML
12-24
Simulink
Stateflow Model Converage Tool
12-25
12 Performance Tools
Summary
Tests
12-26
Test throttle,
cvtest
Model Systems
Details ( )
Details
Details
12-27
12 Performance Tools
Simulink
MATLAB
backward( ) forward( )
forward
back
Stateflow
12-28
Coverage Settings
12-29
12 Performance Tools
Browse
OK
Save to workspace( )
Simulink
12-30
Model Coverage
cvhtml
cvdata HTML
cvhtml(file,data)
cvhtml(file,data,data2,...,detail)
0 3 detail
2
cvload
FILENAME.CVT
cvtest TESTS
DATA cvdata
DATA TESTS
Simulink
12-31
12 Performance Tools
cvreport
cvreport(file,data)
cvdata
cvreport(file,data1,data2,...)
cvreport(file,data1,data2,...,detail)
0 3 detail
2
cvsave
cvsave(filename,model)
filename.cvt model
filename.cvt
12-32
cvsim
( 12-24
)
data = cvsim(test)
cvtest
test cvdata
[data,t,x,y] = cvsim(test)
t x y
[data,t,x,y] = cvsim( test, timespan, options)
sim
cvtest
cvtest
root
label setupcmd
cvsim MATLAB
2 2 cvtest
12-33
12 Performance Tools
12-34
. . . . . . . . . . . . . . . . . . . . . . . . . A-2
. . . . . . . . . . . . . . . . . . . . . A-3
. . . . . . . . . . . . . . . . . . A-7
. . . . . . . . . . . . . . . . . A-10
. . . . . . . . . . . . . . . . . . . . A-26
set_param
10-27
set_param
A-2
B.
471
Simulation Parameters
58
Simulation Parameters
( )
( )
A-1:
AbsTol
{1e6}
AlgebraicLoopMsg
ArrayBoundsChecking
BooleanDataType
Boolean
on | {off}
BufferReuse
I/O
{on} | off
CloseFcn
ConfigurationManager
ConsistencyChecking
on | {off}
Created
Creator
Decimation
{1}
Description
ExternalInput
[t, u]
A-3
A-1: (Continued)
A-4
FinalStateName
{xFinal}
FixedStep
{auto}
InitialState
{xInitial}
InitialStep
{auto}
InvariantConstants
on | {off}
LimitDataPoints
on | {off}
LoadExternalInput
on | {off}
LoadInitialState
on | {off}
MaxDataPoints
{1000}
MaxOrder
ode15s
1 | 2 | 3 | 4 | {5}
MaxStep
{auto}
MinStepSizeMsg
{warning} | error
ModelVersionFormat
ModifiedBy
ModifiedDateFormat
Name
ObjectParameters
OutputOption
|
{ } |
OutputSaveName
{yout}
OutputTimes
OutputOption
{[]}
PaperOrientation
portrait | {landscape}
PaperPosition
A-1: (Continued)
PaperPositionMode
auto | {manual}
PaperSize
PaperUnits PaperType
PaperType
{usletter} | uslegal | a0 | a1 | a2 | a3 | a4 | a5
| b0 | b1 | b2 | b3 | b4 | b5 | arch-A | arch-B |
arch-C | arch-D | arch-E | A | B | C | D | E |
tabloid
PaperUnits
PostLoadFcn
PreLoadFcn
Refine
{1}
RelTol
{1e3}
SampleTimeColors
on | {off}
SaveFcn
SaveFinalState
on | {off}
SaveFormat
MATLAB
| |
SaveOutput
{on} | off
SaveState
on | {off}
SaveTime
{on} | off
ShowLineWidths
on | {off}
SimParamPage
Simulation Parameters
(
)
{Solver} | I/O |
Solver
StartFcn
A-5
A-1: (Continued)
StartTime
{0.0}
StateSaveName
{xout}
StopFcn
StopTime
{10.0}
TimeSaveName
{tout}
UnconnectedInputMsg
UnconnectedLineMsg
UnconnectedOutputMsg
Version
Simulink
( )
(release)
WideVectorLines
on | {off}
ZeroCross
( 314
)
{on} | off
mymodel
set_param(mymodel,StartTime,5,StopTime,100)
ode15s
set_param(mymodel,Solver,ode15s,MaxOrder,3)
SaveFcn
set_param(mymodel,SaveFcn,my_save_cb)
A-6
471
Simulink
A-2:
AttributesFormat
String
BackgroundColor
BlockDescription
BlockType
CloseFcn
MATLAB
CompiledPortWidths
CopyFcn
MATLAB
DeleteFcn
MATLAB
Description
DialogParameters
DropShadow
{off} | on
FontAngle
FontName
{Helvetica}
FontSize
{10}
FontWeight
ForegroundColor
A-7
A-2: (Continued)
A-8
InitFcn
MATLAB
InputPorts
LinkStatus
LoadFcn
MATLAB
ModelCloseFcn
MATLAB
Name
NameChangeFcn
MATLAB
NamePlacement
{normal} | alternate
ObjectParameters
OpenFcn
MATLAB
Orientation
OutputPorts
Parent
string
ParentCloseFcn
MATLAB
Position
PostSaveFcn
MATLAB
PreSaveFcn
MATLAB
Selected
on | {off}
ShowName
{on} | off
A-2: (Continued)
StartFcn
MATLAB
StopFcn
MATLAB
Tag
Type
Simulink(
)
block
UndoDeleteFcn
MATLAB
UserData
MATLAB
(mdl
)
[]
mymodel Gain
( )
set_param(mymodel/Gain,Orientation,left)
set_param(mymodel/Gain,OpenFcn,my_open_cb)
A-9
Simulink
set_param
BlockType
BlockType
MaskType
A-26
( )( )
( )
A-3: Sources
(Block Type)/
off {on}
Constant value
{1}
VectorParams1D
off {on}
A-10
Sample time
off {on}
Filename
{untitled.mat}
Matrix table
{[T,U]}
off {on}
off {on}
Seed
Initial seed
{0}
VectorParams1D
off {on}
SampleTime
Wave form
Amplitude
Amplitude
{1}
Frequency
Frequency
{1}
Units
Units
{Hertz} | rad/sec
A-11
off {on}
Amplitude
Amplitude
{1}
Frequency
Frequency
{1}
Phase
Phase
{0}
SampleTime
Sample time
( ) {1}
[period offset]
VectorParams1D
off {on}
Time
Step time
{1}
Before
Initial value
{0}
After
Final value
{1}
VectorParams1D
off {on}
VectorParams1D
Step (Step)
A-12
Minimum
Minimum
{1}
Maximum
Maximum
{1}
Seed
Initial Seed
{0}
SampleTime
Sample Time
{0}
VectorParams1D
off {on}
A-4: Sinks
(Block Type)/
Format
Format
Decimation
Decimation
{1}
Floating
Floating display
{off} on
SampleTime
Sample time
( ) {1}
[period offset]
Location
Open
{off} | on
NumInputPorts
Number of Axes
> 0
TickLabels
{on} | off
ZoomMode
AxesTitles
{auto}
Grid
{on} | off
TimeRange
Time range
{auto}
YMin
Y min
{5}
YMax
Y max
{5}
SaveToWorkspace
{off} | on
SaveName
Variable name
{ScopeData}
DataFormat
Format
{ | }
Display (Display)
Scope (Scope)
A-13
LimitMaxRows
{on} | off
MaxRows
(no label)
{5000}
Decimation
(Value if Decimation
selected)
{1}
SampleInput
{off} | on
SampleTime
(SampleInput value)
( ) {0}
[period offset]
Filename
{untitled.mat}
MatrixName
Variable name
{ans}
Decimation
Decimation
{1}
SampleTime
Sample time
( ) {1}
[period offset]
VariableName
Variable name
{simout}
Buffer
{inf}
Decimation
Decimation
{1}
SampleTime
Sample time
( ) {1}
[period offset]
To Workspace (ToWorkspace)
A-14
A-5: Discrete
(Block Type)/
Numerator
Numerator
{[1]}
Denominator
Denominator
{[1 2]}
SampleTime
Sample time
( ) {1}
[period offset]
{1}
{1}
{1}
{1}
X0
Initial conditions
{0}
SampleTime
Sample time
( ) {1}
[period offset]
Integrator method
ExternalReset
External reset
InitialConditionSource
{internal} | external
InitialCondition
Initial condition
{0}
LimitOutput
Limit output
{off} | on
UpperSaturationLimit
{inf}
LowerSaturationLimit
{inf}
ShowSaturationPort
{off} | on
ShowStatePort
{off} | on
A-15
Sample time
( ) {1}
[period offset]
Numerator
Numerator
{[1]}
Denominator
Denominator
{[1 0.5]}
SampleTime
Sample time
( ) {1}
[period offset]
Zeros
Zeros
{[1]}
Poles
Poles
[0 0.5]
Gain
Gain
{1}
SampleTime
Sample time
( ) {1}
[period offset]
SampleTime
Initial condition
{0}
SampleTime
Sample time
( ) {1}
[period offset]
Sample time
( ) {1}
[period offset]
A-16
A-6: Continuous
(Block Type)/
External reset
InitialConditionSource
{internal} | external
InitialCondition
Initial condition
{0}
LimitOutput
Limit output
{off} | on
UpperSaturationLimit
{inf}
LowerSaturationLimit
{inf}
ShowSaturationPort
{off} | on
ShowStatePort
{off} | on
AbsoluteTolerance
Absolute tolerance
{auto}
X0
Initial condition
{0}
InheritSampleTime
{off} | on
{1}
{1}
{1}
{1}
X0
Initial conditions
{0}
Numerator
{[1]}
Memory (Memory)
State-Space (StateSpace)
A-17
Denominator
{[1 1]}
DelayTime
Time delay
{1}
InitialInput
Initial input
{0}
BufferSize
{1024}
Denominator
Transport Delay (TransportDelay)
Maximum delay
{10}
InitialInput
Initial input
{0}
MaximumPoints
Buffer size
{1024}
Zeros
Zeros
{[1]}
Poles
Poles
{[0 1]}
Gain
Gain
{[1]}
Zero-Pole (ZeroPole)
A-7: Math
(Block Type)/
Truth table
Complex to Magnitude-Angle
A-18
Gain
{1}
Operator
Operator
Inputs
{2}
Function
Function
Function
{min} | max
Inputs
{1}
Number of inputs
{2}
Operator
Operator
Function
Complex to Real-Imag
Dot Product (Dot Product) (masked)
Gain (Gain)
Gain
Logical Operator (Logic)
Magnitude-Angle to Complex
Math Function (Math)
Operator
Product (Product)
Inputs
Relational Operator (RelationalOperator)
Operator
Relational Operator (RelationalOperator)
Operator
Rounding Function (Rounding)
Operator
A-19
List of signs
{++}
Function
Expression
{sin(u(1)*exp(2.3*(u(2))))}
InputValues
{[5:5]}
OutputValues
{tanh([5:5])}
Fcn (Fcn)
Expr
Row
ColumnIndex
Column
OutputValues
Table
2-D
MATLABFcn
MATLAB function
MATLAB {sin}
OutputWidth
Output width
{1}
S-Function (S-Function)
A-20
FunctionName
S-function name
{system}
Parameters
S-function parameters
A-9: Nonlinear
(Block Type)/
BacklashWidth
Deadband width
{1}
InitialOutput
Initial output
{0}
Backlash (Backlash)
{0.5}
UpperValue
{0.5}
Number of inputs
{3}
Quantization interval
{0.5}
RisingSlewLimit
{1.}
FallingSlewLimit
{1.}
OnSwitchValue
Switch on point
{eps}
OffSwitchValue
{eps}
Relay (Relay)
A-21
OnOutputValue
Output when on
{1}
OffOutputValue
{0}
UpperLimit
Upper limit
{0.5}
LowerLimit
Lower limit
{0.5}
FunctionName
S-function name
{system}
Parameters
S-function parameters
Saturation (Saturate)
S-Function (S-Function)
Threshold
{0}
InputSignals
Block choice
LibraryName
Library name
{A}
A-22
Initial value
{0}
DataStoreName
{A}
SampleTime
Sample time
( ) {1}
[period offset]
DataStoreName
{A}
SampleTime
Sample time
( ) {1}
[period offset]
Number of outputs
{3}
StatesWhenEnabling
{held} | reset
ShowOutputPort
{off} | on
Goto tag
{A}
GotoTag
Tag
{A}
TagVisibility
Tag visibility
Goto tag
{A}
InitialValue
Data Store Read (DataStoreRead)
From (From)
GotoTag
Goto (Goto)
A-23
HitCrossingOffset
{0}
HitCrossingDirection
ShowOutputPort
{on} | off
Initial value
{1}
Port
Port number
{1}
PortWidth
Port width
{1}
SampleTime
Sample time
( ) {1}
[period offset]
Number of inputs
{3}
Port
Port number
{1}
OutputWhenDisabled
{held} | reset
InitialOutput
Initial output
{0}
ProbeWidth
Probe width
{on} | off
ProbeSampleTime
{on} | off
ProbeCompexSignal
{on} | off
IC (InitialCondition)
Value
In (Inport)
Merge
Model Info (CMBlock) (mask)
Mux (Mux)
Inputs
Out (Outport)
Probe (Probe)
Subsystem (SubSystem)
A-24
{on} | off
Trigger type
ShowOutputPort
{off} | on
A-25
Mask Editor
A-11:
Mask
onoff
{on} | off
MaskCallbackString
MaskCallbacks
MaskDescription
Block description
MaskDisplay
Drawing commands
MaskEditorHandle
handle
MaskEnableString
MaskEnables
, on off
MaskHelp
Block help
MaskIconFrame
{on} | off
MaskIconOpaque
Icon transparency ( on
off)
{on} | off
MaskIconRotate
on | {off}
MaskIconUnits
Drawing coordinates
MaskInitialization
Initialization commands
MATLAB
MaskPrompts
Prompt ( )
MaskPromptString
Prompt ( )
on | {off}
MaskNames
MaskPropertyNameString
MaskSelfModifiable
A-26
A-11:
MaskStyles
Control type ( )
MaskStyleString
Control type ( )
MaskTunableValues
MaskTunableValue
MaskType
Mask type
MaskValues
MaskValueString
MaskVariables
Variable ( )
MaskVisibilities
String
Mask Editor
Prompt
Variable
Control type
Assignment
Prompt
(|)
MaskPromptString
"Slope:|Intercept:"
Variable
MaskVariables
A-27
Assignment
@ Evaluate & Literal
"a=@1;b=&2;"
a MATLAB
2 b
Control type
MaskStyleString
Popup strings popup
"edit,checkbox,popup(red|blue|green)"
MaskValueString
MaskPromptString "Slope:|Intercept:"
MaskValueString "2|5"
A-28
. . . . . . . . . . . . . . . . . . . . B-2
Model . . . . .
BlockDefaults . .
AnnotationDefaults
System . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
B-3
B-3
B-3
B-3
ASCII
Model {
<Model Parameter Name> <Model Parameter Value>
...
BlockDefaults {
<Block Parameter Name> <Block Parameter Value>
...
}
AnnotationDefaults {
<Annotation Parameter Name> <Annotation Parameter Value>
...
}
System {
<System Parameter Name> <System Parameter Value>
...
Block {
<Block Parameter Name> <Block Parameter Value>
...
}
Line {
<Line Parameter Name> <Line Parameter Value>
...
Branch {
<Branch Parameter Name> <Branch Parameter Value>
...
}
}
Annotation {
<Annotation Parameter Name> <Annotation Parameter Value>
...
}
}
}
B-2
Model
BlockDefaults
AnnotationDefaults
System (
) System
Model
Model
Simulink
BlockDefaults
BlockDefaults
Block
AnnotationDefaults
AnnotationDefaults BlockDefaults
set_param
System
System
System
B-3
B-4