Simulink Tutorial

605 Pages · 3.76 mb ·

Tutorials

Table of contents

- Getting Started (Page 17)
- What Is Simulink? (Page 18)
- How to Use This Manual (Page 19)
- Application Toolboxes (Page 21)
- The Communications Toolbox. (Page 21)
- The Control System Toolbox (Page 22)
- The Financial Toolbox. (Page 22)
- The Frequency-Domain System Identification Toolbox... (Page 22)
- The Fuzzy Logic Toolbox (Page 22)
- The Higher-Order Spectral Analysis Toolbox (Page 22)
- The Image Processing Toolbox (Page 22)
- The LMI Control Toolbox. (Page 23)
- The Model Predictive Control Toolbox (Page 23)
- The Mu-Analysis and Synthesis Toolbox (Page 23)
- The NAG Foundation Toolbox (Page 23)
- The Neural Network Toolbox (Page 23)
- The Optimization Toolbox (Page 23)
- The Partial Differential Equation Toolbox. (Page 24)
- The QFT Control Design Toolbox (Page 24)
- The Robust Control Toolbox (Page 24)
- The Signal Processing Toolbox (Page 24)
- The Spline Toolbox (Page 24)
- The Statistics Toolbox (Page 25)
- The Symbolic Math Toolbox (Page 25)
- The System Identification Toolbox (Page 25)
- The Wavelet Toolbox. (Page 25)
- The Simulink Real-Time Workshop (Page 26)
- Key Features (Page 26)
- The Real-Time Workshop Ada Extension (Page 28)
- Key Features (Page 28)
- Blocksets (Page 30)
- The DSP Blockset (Page 30)
- The Fixed-Point Blockset (Page 30)
- The Nonlinear Control Design Blockset (Page 32)
- The Power System Blockset (Page 32)
- Quick Start (Page 33)
- Description of the Demo (Page 35)
- Some Things to Try (Page 36)
- What This Demo Illustrates (Page 37)
- Other Useful Demos (Page 37)
- Building a Simple Model (Page 38)
- Creating a Model (Page 47)
- Creating a New Model (Page 49)
- Editing an Existing Model (Page 49)
- Entering Simulink Commands (Page 49)
- Using the Simulink Menu Bar to Enter Commands (Page 49)
- Using Context-Sensitive Menus to Enter Commands (Page 50)
- Using the Simulink Toolbar to Enter Commands (Page 50)
- Using the MATLAB Window to Enter Commands (Page 50)
- Undoing a Command (Page 51)
- Simulink Windows (Page 51)
- Status Bar (Page 51)
- Zooming Block Diagrams (Page 52)
- Selecting Objects (Page 53)
- Selecting One Object (Page 53)
- Selecting More than One Object (Page 53)
- Selecting Multiple Objects One at a Time (Page 53)
- Selecting Multiple Objects Using a Bounding Box (Page 53)
- Selecting the Entire Model (Page 54)
- Blocks (Page 55)
- Block Data Tips (Page 55)
- Virtual Blocks (Page 55)
- Copying and Moving Blocks from One Window to Anoth... (Page 56)
- Moving Blocks in a Model (Page 58)
- Duplicating Blocks in a Model (Page 58)
- Specifying Block Parameters (Page 58)
- Block Properties Dialog Box (Page 59)
- Description (Page 59)
- Priority (Page 60)
- Tag (Page 60)
- Open function (Page 60)
- Attributes format string (Page 60)
- Deleting Blocks (Page 60)
- Changing the Orientation of Blocks (Page 61)
- Resizing Blocks (Page 61)
- Manipulating Block Names (Page 62)
- Changing Block Names (Page 62)
- Changing the Location of a Block Name (Page 63)
- Changing Whether a Block Name Appears (Page 63)
- Displaying Parameters Beneath a Block’s Icon (Page 63)
- Disconnecting Blocks (Page 64)
- Vector Input and Output (Page 64)
- Scalar Expansion of Inputs and Parameters (Page 64)
- Scalar Expansion of Inputs (Page 64)
- Scalar Expansion of Parameters (Page 65)
- Assigning Block Priorities (Page 65)
- Using Drop Shadows (Page 66)
- Libraries (Page 67)
- Terminology (Page 67)
- Creating a Library (Page 67)
- Modifying a Library (Page 68)
- Copying a Library Block into a Model (Page 68)
- Updating a Linked Block (Page 69)
- Breaking a Link to a Library Block (Page 69)
- Finding the Library Block for a Reference Block (Page 70)
- Getting Information About Library Blocks (Page 70)
- Browsing Block Libraries (Page 71)
- Navigating the Library Tree (Page 71)
- Searching Libraries (Page 71)
- Opening a Library (Page 71)
- Creating and Opening Models (Page 72)
- Copying Blocks (Page 72)
- Displaying Help on a Block (Page 72)
- Pinning the Library Browser (Page 72)
- Lines (Page 73)
- Drawing a Line Between Blocks (Page 73)
- Drawing a Branch Line (Page 74)
- Drawing a Line Segment (Page 74)
- Moving a Line Segment (Page 75)
- Dividing a Line into Segments (Page 75)
- Moving a Line Vertex (Page 77)
- Displaying Line Widths (Page 77)
- Inserting Blocks in a Line (Page 77)
- Signal Labels (Page 78)
- Using Signal Labels (Page 79)
- Signal Label Propagation (Page 79)
- Setting Signal Properties (Page 80)
- Signal Properties Dialog Box (Page 81)
- Signal Name (Page 81)
- Description (Page 81)
- Document Link (Page 81)
- Displayable (Test Point) (Page 81)
- RTW storage class (Page 82)
- RTW storage type qualifier (Page 82)
- Annotations (Page 83)
- Working with Data Types (Page 84)
- Data Types Supported by Simulink (Page 84)
- Block Support for Data and Numeric Signal Types (Page 85)
- Specifying Block Parameter Data Types (Page 89)
- Creating Signals of a Specific Data Type (Page 89)
- Displaying Port Data Types (Page 89)
- Data Type Propagation (Page 89)
- Data Typing Rules (Page 90)
- Enabling Strict Boolean Type Checking (Page 91)
- Typecasting Signals (Page 91)
- Typecasting Parameters (Page 91)
- Working with Complex Signals (Page 93)
- Summary of Mouse and Keyboard Actions (Page 94)
- Creating Subsystems (Page 97)
- Creating a Subsystem by Adding the Subsystem Block... (Page 97)
- Creating a Subsystem by Grouping Existing Blocks (Page 98)
- Labeling Subsystem Ports (Page 99)
- Using Callback Routines (Page 99)
- Tips for Building Models (Page 103)
- Modeling Equations (Page 104)
- Converting Celsius to Fahrenheit (Page 104)
- Modeling a Simple Continuous System (Page 105)
- Saving a Model (Page 107)
- Printing a Block Diagram (Page 108)
- Print Dialog Box (Page 108)
- Print Command (Page 109)
- Specifying Paper Size and Orientation (Page 110)
- Positioning and Sizing a Diagram (Page 110)
- The Model Browser (Page 112)
- Using the Model Browser on Windows (Page 112)
- Using the Model Browser on UNIX (Page 113)
- Contents of the Browser Window (Page 113)
- Interpreting List Contents (Page 114)
- Opening a System (Page 114)
- Looking into a Masked System or a Linked Block (Page 115)
- Displaying List Contents Alphabetically (Page 115)
- Tracking Model Versions (Page 116)
- Specifying the Current User (Page 116)
- Model Properties Dialog (Page 118)
- Model Properties Pane (Page 118)
- Creator (Page 118)
- Created (Page 118)
- Model description (Page 118)
- Options Pane (Page 119)
- Configuration manager (Page 119)
- Model version format (Page 119)
- Modified by format (Page 120)
- Modified date format (Page 120)
- History Pane (Page 121)
- Last modified by (Page 121)
- Last modified date (Page 121)
- Modified history update (Page 121)
- Modified history (Page 122)
- Creating a Model Change History (Page 122)
- Logging Changes (Page 122)
- Editing the Change History (Page 123)
- Version Control Properties (Page 123)
- Ending a Simulink Session (Page 125)
- Running a Simulation (Page 127)
- Introduction (Page 128)
- Using Menu Commands (Page 128)
- Running a Simulation from the Command Line (Page 129)
- Running a Simulation Using Menu Commands (Page 130)
- Setting Simulation Parameters and Choosing the Sol... (Page 130)
- Applying the Simulation Parameters (Page 130)
- Starting the Simulation (Page 130)
- Simulation Diagnostics Dialog Box (Page 132)
- Message (Page 132)
- Source (Page 132)
- Fullpath (Page 132)
- Summary (Page 132)
- Reported by (Page 132)
- The Simulation Parameters Dialog Box (Page 134)
- The Solver Page (Page 134)
- Simulation Time (Page 135)
- Solvers (Page 135)
- Default solvers (Page 136)
- Variable-step solvers (Page 137)
- Fixed-step solvers (Page 138)
- Solver Options (Page 138)
- Step Sizes (Page 138)
- Maximum step size (Page 139)
- Initial step size (Page 139)
- Error Tolerances (Page 139)
- The Maximum Order for ode15s (Page 140)
- Multitasking Options (Page 141)
- MultiTasking (Page 141)
- SingleTasking (Page 141)
- Auto (Page 141)
- Output Options (Page 141)
- Refine output (Page 142)
- Produce additional output (Page 142)
- Produce specified output only (Page 142)
- Comparing Output options (Page 142)
- The Workspace I/O Page (Page 143)
- Loading Input from the Base Workspace (Page 143)
- External Input Matrix (Page 144)
- Structure with time (Page 144)
- Structure (Page 145)
- Per-Port Structures (Page 145)
- External Input Time Expression. (Page 145)
- Saving Output to the Workspace (Page 146)
- Matrix (Page 146)
- Structure with time (Page 147)
- Structure (Page 147)
- Per-Port Structures (Page 147)
- Loading and Saving States (Page 147)
- Structure with time (Page 148)
- Structure (Page 148)
- When the Model Has Multiple States (Page 148)
- The Diagnostics Page (Page 150)
- Consistency Checking (Page 150)
- Disabling Zero Crossing Detection (Page 151)
- Disable optimized I/O storage (Page 151)
- Relax boolean type checking (2.x compatible) (Page 152)
- Improving Simulation Performance and Accuracy (Page 153)
- Speeding Up the Simulation (Page 153)
- Improving Simulation Accuracy (Page 154)
- Running a Simulation from the Command Line (Page 155)
- Using the sim Command (Page 155)
- Using the set_param Command (Page 155)
- sim (Page 156)
- simset (Page 158)
- simget (Page 162)
- Analyzing Simulation Results (Page 163)
- Viewing Output Trajectories (Page 164)
- Using the Scope Block (Page 164)
- Using Return Variables (Page 164)
- Using the To Workspace Block (Page 165)
- Linearization (Page 166)
- Equilibrium Point Determination (Page 169)
- linfun (Page 171)
- trim (Page 175)
- Using Masks to Customize Blocks (Page 181)
- Introduction (Page 182)
- A Sample Masked Subsystem (Page 183)
- Creating Mask Dialog Box Prompts (Page 184)
- Creating the Block Description and Help Text (Page 186)
- Creating the Block Icon (Page 186)
- Summary (Page 188)
- The Mask Editor: An Overview (Page 189)
- The Initialization Page (Page 190)
- Prompts and Associated Variables (Page 190)
- Creating the First Prompt (Page 191)
- Inserting a Prompt (Page 191)
- Editing a Prompt (Page 191)
- Deleting a Prompt (Page 192)
- Moving a Prompt (Page 192)
- Control Types (Page 192)
- Defining an Edit Control (Page 192)
- Defining a Check Box Control (Page 193)
- Defining a Pop-Up Control (Page 193)
- Default Values for Masked Block Parameters (Page 194)
- Tunable Parameters (Page 194)
- Initialization Commands (Page 195)
- The Mask Workspace (Page 195)
- Debugging Initialization Commands (Page 197)
- The Icon Page (Page 198)
- Displaying Text on the Block Icon (Page 198)
- Displaying Graphics on the Block Icon (Page 200)
- Displaying Images on Masks (Page 201)
- Displaying a Transfer Function on the Block Icon (Page 202)
- Controlling Icon Properties (Page 203)
- Icon frame (Page 203)
- Icon transparency (Page 204)
- Icon rotation (Page 204)
- Drawing coordinates (Page 204)
- The Documentation Page (Page 206)
- The Mask Type Field (Page 206)
- The Block Description Field (Page 206)
- The Mask Help Text Field (Page 207)
- Creating Dynamic Dialogs for Masked Blocks (Page 208)
- Setting Masked Block Dialog Parameters (Page 208)
- Predefined Masked Dialog Parameters (Page 209)
- MaskCallbacks (Page 209)
- MaskDescription (Page 209)
- MaskEnables (Page 209)
- MaskPrompts (Page 210)
- MaskType (Page 210)
- MaskValues (Page 210)
- MaskVisibilities (Page 210)
- Conditionally Executed Subsystems (Page 211)
- Introduction (Page 212)
- Enabled Subsystems (Page 213)
- Creating an Enabled Subsystem (Page 213)
- Setting Output Values While the Subsystem Is Disab... (Page 214)
- Setting States When the Subsystem Becomes Re-enabl... (Page 214)
- Outputting the Enable Control Signal (Page 215)
- Blocks an Enabled Subsystem Can Contain (Page 215)
- Triggered Subsystems (Page 218)
- Creating a Triggered Subsystem (Page 219)
- Outputs and States Between Trigger Events (Page 220)
- Outputting the Trigger Control Signal (Page 220)
- Function-Call Subsystems (Page 220)
- Blocks That a Triggered Subsystem Can Contain (Page 220)
- Triggered and Enabled Subsystems (Page 221)
- Creating a Triggered and Enabled Subsystem (Page 221)
- A Sample Triggered and Enabled Subsystem (Page 222)
- Creating Alternately Executing Subsystems (Page 222)
- Block Reference (Page 225)
- What Each Block Reference Page Contains (Page 226)
- Simulink Block Libraries (Page 227)
- Abs (Page 235)
- Algebraic Constraint (Page 236)
- Backlash (Page 238)
- Band-Limited White Noise (Page 242)
- Bus Selector (Page 244)
- Chirp Signal (Page 246)
- Clock (Page 248)
- Combinatorial Logic (Page 249)
- Complex to Magnitude-Angle (Page 252)
- Complex to Real-Imag (Page 253)
- Configurable Subsystem (Page 254)
- Constant (Page 258)
- Coulomb and Viscous Friction (Page 259)
- Data Store Memory (Page 260)
- Data Store Read (Page 262)
- Data Store Write (Page 263)
- Data Type Conversion (Page 265)
- Dead Zone (Page 267)
- Demux (Page 269)
- Derivative (Page 273)
- Digital Clock (Page 275)
- Discrete Filter (Page 276)
- Discrete Pulse Generator (Page 278)
- Discrete State-Space (Page 280)
- Discrete-Time Integrator (Page 282)
- Discrete Transfer Fcn (Page 289)
- Discrete Zero-Pole (Page 291)
- Display (Page 293)
- Dot Product (Page 296)
- Enable (Page 298)
- Fcn (Page 300)
- First-Order Hold (Page 302)
- From (Page 304)
- From File (Page 306)
- From Workspace (Page 309)
- Function-Call Generator (Page 312)
- Gain (Page 313)
- Goto (Page 315)
- Goto Tag Visibility (Page 318)
- Ground (Page 319)
- Hit Crossing (Page 320)
- IC (Page 322)
- Inport (Page 323)
- Integrator (Page 327)
- Logical Operator (Page 332)
- Look-Up Table (Page 334)
- Look-Up Table (2-D) (Page 337)
- Magnitude-Angle to Complex (Page 340)
- Manual Switch (Page 342)
- Math Function (Page 343)
- MATLAB Fcn (Page 345)
- Matrix Gain (Page 347)
- Memory (Page 348)
- Merge (Page 350)
- MinMax (Page 353)
- Model Info (Page 355)
- Editable text (Page 356)
- Model properties (Page 356)
- RCS properties (Page 357)
- Multiport Switch (Page 358)
- Mux (Page 360)
- Outport (Page 363)
- Product (Page 367)
- Probe (Page 369)
- Pulse Generator (Page 370)
- Quantizer (Page 372)
- Ramp (Page 373)
- Random Number (Page 374)
- Rate Limiter (Page 376)
- Real-Imag to Complex (Page 378)
- Relational Operator (Page 380)
- Relay (Page 382)
- Repeating Sequence (Page 384)
- Rounding Function (Page 385)
- Saturation (Page 386)
- Scope (Page 387)
- Selector (Page 397)
- S-Function (Page 399)
- Sign (Page 401)
- Signal Generator (Page 402)
- Sine Wave (Page 404)
- Slider Gain (Page 407)
- State-Space (Page 409)
- Step (Page 411)
- Stop Simulation (Page 413)
- Subsystem (Page 414)
- Sum (Page 415)
- Switch (Page 418)
- Terminator (Page 420)
- To File (Page 421)
- To Workspace (Page 423)
- Transfer Fcn (Page 427)
- Transport Delay (Page 430)
- Trigger (Page 432)
- Trigonometric Function (Page 434)
- Uniform Random Number (Page 436)
- Unit Delay (Page 438)
- Variable Transport Delay (Page 440)
- Width (Page 442)
- XY Graph (Page 443)
- Zero-Order Hold (Page 445)
- Zero-Pole (Page 446)
- Additional Topics (Page 449)
- How Simulink Works (Page 450)
- Zero Crossings (Page 451)
- State Event Handling (Page 451)
- Integration of Discontinuous Signals (Page 451)
- Implementation Details (Page 452)
- Caveat (Page 453)
- Blocks with Zero Crossings (Page 454)
- Algebraic Loops (Page 455)
- Non-Algebraic Direct-Feedthrough Loops (Page 457)
- Invariant Constants (Page 459)
- Discrete-Time Systems (Page 461)
- Discrete Blocks (Page 461)
- Sample Time (Page 461)
- Purely Discrete Systems (Page 461)
- Multirate Systems (Page 462)
- Sample Time Colors (Page 463)
- Mixed Continuous and Discrete Systems (Page 465)
- Model Construction Commands (Page 467)
- Introduction (Page 468)
- How to Specify Parameters for the Commands (Page 469)
- How to Specify a Path for a Simulink Object (Page 469)
- add_block (Page 470)
- add_line (Page 471)
- bdclose (Page 472)
- bdroot (Page 473)
- close_system (Page 474)
- delete_block (Page 476)
- delete_line (Page 477)
- find_system (Page 478)
- gcb (Page 480)
- gcbh (Page 481)
- gcs (Page 482)
- get_param (Page 483)
- new_system (Page 485)
- open_system (Page 486)
- replace_block (Page 487)
- save_system (Page 489)
- set_param (Page 490)
- simulink (Page 492)
- Simulink Debugger (Page 493)
- Introduction (Page 494)
- Using the Debugger (Page 495)
- Starting the Debugger (Page 495)
- Getting Help (Page 496)
- Entering Commands (Page 496)
- About Block Indexes (Page 496)
- Accessing the MATLAB Workspace (Page 496)
- Running a Simulation Incrementally (Page 498)
- Stepping by Blocks (Page 498)
- Crossing a Time Step Boundary (Page 499)
- Stepping by Minor Time Steps (Page 499)
- Stepping by Time Steps (Page 499)
- Stepping by Breakpoints (Page 500)
- Running a Simulation Nonstop (Page 500)
- Setting Breakpoints (Page 501)
- Breaking at Blocks (Page 501)
- Breaking at a Block’s Beginning (Page 502)
- Breaking at a Block’s End (Page 503)
- Clearing Breakpoints from Blocks (Page 503)
- Breaking at Time Steps (Page 503)
- Breaking on Nonfinite Values (Page 503)
- Breaking on Step-Size Limiting Steps (Page 504)
- Breaking at Zero-Crossings (Page 504)
- Displaying Information About the Simulation (Page 505)
- Displaying Block I/O (Page 505)
- probe Command (Page 505)
- disp Command (Page 506)
- trace Command (Page 506)
- Displaying Algebraic Loop Information (Page 506)
- Displaying System States (Page 507)
- Displaying Integration Information (Page 507)
- Displaying Information About the Model (Page 509)
- Displaying a Model’s Block Execution Order (Page 509)
- Displaying a Block (Page 509)
- Displaying a Model’s Nonvirtual Systems (Page 510)
- Displaying a Model’s Nonvirtual Blocks (Page 510)
- Displaying Blocks with Potential Zero-Crossings (Page 512)
- Displaying Algebraic Loops (Page 512)
- Displaying Debug Settings (Page 513)
- Debugger Command Reference (Page 514)
- ashow (Page 516)
- atrace (Page 517)
- bafter (Page 518)
- break (Page 519)
- bshow (Page 520)
- clear (Page 521)
- continue (Page 522)
- disp (Page 523)
- help (Page 524)
- ishow (Page 525)
- minor (Page 526)
- nanbreak (Page 527)
- next (Page 528)
- probe (Page 529)
- quit (Page 530)
- run (Page 531)
- slist (Page 532)
- states (Page 533)
- systems (Page 534)
- status (Page 535)
- step (Page 536)
- stop (Page 537)
- tbreak (Page 538)
- trace (Page 539)
- undisp (Page 540)
- untrace (Page 541)
- xbreak (Page 542)
- zcbreak (Page 543)
- zclist (Page 544)
- Model and Block Parameters (Page 545)
- Introduction (Page 546)
- Model Parameters (Page 547)
- Common Block Parameters (Page 551)
- Block-Specific Parameters (Page 554)
- Mask Parameters (Page 568)
- Model File Format (Page 571)
- Model File Contents (Page 572)
- Model Section (Page 573)
- BlockDefaults Section (Page 573)
- AnnotationDefaults Section (Page 573)
- System Section (Page 573)
- A Sample Model File (Page 574)
- Index (Page 585)