logo资料库

MATLAB Simulink User's Guide 官方用户指导教程(最新版).pdf

第1页 / 共3584页
第2页 / 共3584页
第3页 / 共3584页
第4页 / 共3584页
第5页 / 共3584页
第6页 / 共3584页
第7页 / 共3584页
第8页 / 共3584页
资料共3584页,剩余部分请下载后查看
Introduction to Simulink
Simulink Basics
Programmatic Modeling Basics
Load a Model
Create a Model and Specify Parameter Settings
Programmatically Load Variables When Opening a Model
Programmatically Add and Connect Blocks
Name a Signal Programmatically
Arrange Model Layouts Automatically
Open the Same Model in Multiple Windows
Locate Diagram Elements Using Highlighting
Specify Colors Programmatically
Simulink Identifiers
Build and Edit a Model Interactively
Create a Model
Use Customized Settings When Creating New Models
Open a Model
Load Variables When Opening a Model
Open a Model with Different Character Encoding
Simulink Model File Types
Add Blocks and Set Parameters
Add Blocks to the Model
Align and Connect Blocks
Set Block Parameters
Extend the Model
Add More Blocks
Branch a Connection
Organize Your Model Into Components
Simulate the Model and View Results
Edit and Simulate the Model
Save the Model
How to Tell If a Model Needs Saving
Save a Model
What Happens When You Save a Model?
Save Models in the SLX File Format
Save Models with Different Character Encodings
Export a Model to a Previous Simulink Version
Save from One Earlier Simulink Version to Another
Preview Content of Model Components
Bookmark Parts of Model
What Are Viewmarks?
Create a Viewmark
Open and Navigate Viewmarks
Manage Viewmarks
Refresh a Viewmark
Update Diagram and Run Simulation
Updating the Diagram
Simulation Updates the Diagram
Update Diagram While Editing
Simulate a Model
Print Model Diagrams
Print Interactively or Programmatically
Printing Options
Canvas Color
Basic Printing
Print the vdp Model Using Default Settings
Print a Subsystem Hierarchy
Select the Systems to Print
Print Current System
Print Subsystems
Print a Model Referencing Hierarchy
Specify the Page Layout and Print Job
Page and Print Job Setup
Set Paper Size and Orientation Without Printing
Tiled Printing
Print Multiple Pages for Large Models
Add a Log of Printed Models
Add a Sample Time Legend
Print from the MATLAB Command Line
Printing Commands
Print Systems with Multiline Names or Names with Spaces
Set Paper Orientation and Type
Position and Size a System
Use Tiled Printing
Print to a PDF
Print Model Reports
Model Report Options
Print Models to Image File Formats
Copy Model Views to Third-Party Applications
Keyboard Shortcuts and Mouse Actions for Simulink Modeling
Perform File and Clipboard Operations
Zoom, Scroll, and Change Current Window
Navigate Model Hierarchy
Modify Block Diagram Contents
Select Objects
Modify Objects
Name Objects
Modify Block Diagram Appearance
Perform Actions
Update, Simulate, and Generate Code for Models
Debug Models
Simulation Stepping
How Simulation Stepper Helps With Model Analysis
How Stepping Through a Simulation Works
Simulation Snapshots
How Simulation Stepper Uses Snapshots
How Simulation Stepper Differs from Simulink Debugger
Use Simulation Stepper
Simulation Stepper Access
Simulation Stepper Pause Status
Tune Parameters
Referenced Models
Simulation Stepper and Interval Logging
Simulation Stepper and Stateflow Debugger
Simulation Stepper Limitations
Interface
Model Configuration
Blocks
Step Through a Simulation
Step Forward and Back
Set Conditional Breakpoints for Stepping a Simulation
Add and Edit Conditional Breakpoints
Observe Conditional Breakpoint Values
Simulation Pacing
Use Simulation Pacing
Use Simulation Pacing with Dashboard Blocks
Limitations
How Simulink Works
Simulation Phases in Dynamic Systems
Model Compilation
Link Phase
Simulation Loop Phase
Compare Solvers
Fixed-Step Versus Variable-Step Solvers
Continuous Versus Discrete Solvers
Explicit Versus Implicit Continuous Solvers
One-Step Versus Multistep Continuous Solvers
Single-Order Versus Variable-Order Continuous Solvers
Zero-Crossing Detection
Demonstrating Effects of Excessive Zero-Crossing Detection
Preventing Excessive Zero Crossings
How the Simulator Can Miss Zero-Crossing Events
Zero-Crossing Detection in Blocks
Zero-Crossing Algorithms
Signal Threshold for Adaptive Zero-Crossing Detection
Algebraic Loop Concepts
Mathematical Interpretation
Physical Interpretation
Artificial Algebraic Loops
How the Algebraic Loop Solver Works
Implications of Algebraic Loops in a Model
Identify Algebraic Loops in Your Model
Highlight Algebraic Loops in the Model
Use the Algebraic Loop Diagnostic
Remove Algebraic Loops
Introduce a Delay to Remove Algebraic Loops
Solve Algebraic Loops Manually
How Simulink Eliminates Artificial Algebraic Loops
Eliminate Artificial Algebraic Loops Caused by Atomic Subsystems
Bundled Signals That Create Artificial Algebraic Loops
Model and Block Parameters to Diagnose and Eliminate Artificial Algebraic Loops
Block Reduction and Artificial Algebraic Loops
When Simulink Cannot Eliminate Artificial Algebraic Loops
Modeling Considerations with Algebraic Loops
Managing Large Models with Artificial Algebraic Loops
Model Blocks and Direct Feedthrough
Changing Block Priorities When Using Algebraic Loop Solver
Artificial Algebraic Loops
Modeling Dynamic Systems
Creating a Model
Create a Template from a Model
Edit a Template
Describe Models Using Notes and Annotations
Manage Notes
Manage Annotations
Create and Edit Annotations Programmatically
Create Annotation Programmatically
Programmatically Find and Modify Existing Annotations
Delete Annotation
Create Annotations That Contain Hyperlinks
Add Image to Model
Create Area Programmatically
Create and Hide Markup Annotation
Find Annotation Executing Callback Function
Create Subsystems
Types of Subsystems
Create Subsystems
Add Ports to Subsystems
Configure Subsystems
Restrict Subsystem Access
Navigate Model Hierarchies
Open a Subsystem or Referenced Model
Subsystem Reference
Create a Subsystem Block Diagram
Reference a Subsystem File in a Model
Convert an Existing Subsystem to a Referenced Subsystem
Edit and Save Referenced Subsystem
Add a System Mask for Subsystem Reference
Simulate a Subsystem Block Diagram with a Test Harness
Subsystem Reference Compatibility with Previous Versions
Control Referenced Subsystem Programmatically
Best Practices
Reference a Subsystem File in a Model
Expand Subsystem Contents
Why Expand a Subsystem?
What Subsystems Can You Expand?
Expand a Subsystem
Results of Expanding a Subsystem
Use Control Flow Logic
What is a Control Flow Subsystem
Equivalent C Language Statements
Conditional Control Flow Logic
While and For Loops
Callbacks for Customized Model Behavior
Model, Block, and Port Callbacks
What You Can Do with Callbacks
Avoid run Commands in Callback Code
Model Callbacks
Create Model Callbacks
Referenced Model Callbacks
Model Callback Parameters
Block Callbacks
Specify Block Callbacks
Block Callback Parameters
Port Callbacks
Callback Tracing
Manage Model Versions and Specify Model Properties
How Simulink Helps You Manage Model Versions
Model File Change Notification
Manage Model Properties
Access Model Information Programmatically
Model Discretizer
What Is the Model Discretizer?
Requirements
Discretize a Model with the Model Discretizer
View the Discretized Model
Discretize Blocks from the Simulink Model
Discretize a Model with the sldiscmdl Function
Model Advisor
Check Your Model Using the Model Advisor
Model Advisor Overview
Run Model Advisor Checks and Review Results
Run Model Checks Programmatically
Access Other Advisors
Find Model Advisor Check IDs
Run Model Advisor Checks in Background
Address Model Check Results
Address Model Check Results with Highlighting
Fix a Model Advisor Check Warning or Failure
Save and View Model Advisor Check Reports
Save Model Advisor Check Reports
View Model Advisor Check Reports
Upgrade Advisor
Consult the Upgrade Advisor
Upgrade Programmatically
Upgrade Advisor Checks
Working with Sample Times
What Is Sample Time?
Specify Sample Time
Designate Sample Times
Specify Block-Based Sample Times Interactively
Specify Port-Based Sample Times Interactively
Specify Block-Based Sample Times Programmatically
Specify Port-Based Sample Times Programmatically
Access Sample Time Information Programmatically
Specify Sample Times for a Custom Block
Determining Sample Time Units
Change the Sample Time After Simulation Start Time
View Sample Time Information
Inspect Sample Time Using Timing Legend
Inspect Sample Times Throughout a Model
Types of Sample Time
Discrete Sample Time
Continuous Sample Time
Fixed-in-Minor-Step
Inherited Sample Time
Constant Sample Time
Variable Sample Time
Controllable Sample Time
Triggered Sample Time
Asynchronous Sample Time
Blocks for Which Sample Time Is Not Recommended
Best Practice to Model Sample Times
Appropriate Blocks for the Sample Time Parameter
Specify Sample Time in Blocks Where Hidden
Block Compiled Sample Time
Sample Times in Subsystems
Sample Times in Systems
Purely Discrete Systems
Hybrid Systems
Resolve Rate Transitions
Automatic Rate Transition
Visualize Inserted Rate Transition Blocks
How Propagation Affects Inherited Sample Times
Process for Sample Time Propagation
Simulink Rules for Assigning Sample Times
Backpropagation in Sample Times
Specify Execution Domain
Domain Specification Badge
Types of Execution Domains
Set Execution Domain
Enforce Discrete Execution Domain for a Subsystem
Referencing a Model
Model Reference Basics
Model Reference Advantages
Model Hierarchies
Model Block and Referenced Model Interface
Model Workspaces and Data Dictionaries
Referenced Model Execution
Referenced Model Simulation and Code Generation
Model Reference Requirements and Limitations
Model Reuse
Model Masks
S-Functions in Referenced Models
Model Architecture Requirements and Limitations
Signal Requirements and Limitations
Simulation Requirements and Limitations
Code Generation Requirements and Limitations
Reference Existing Models
Reference Protected Models from Third Parties
Load Supporting Files for Protected Model
Verify Digital Signature of Protected Model
View Protected Model Contents
Test Protected Model in Isolated Environment
Reference Protected Model
Use Models Protected in Previous Releases
Convert Subsystems to Referenced Models
Prepare Subsystem for Conversion
Convert Subsystems to Referenced Models
Conversion Results
Compare Simulation Results Before and After Conversion
Revert Conversion
Integrate Referenced Model into Parent Model
Modify Referenced Models for Conditional Execution
Conditional Models
Requirements for Conditional Models
Modify a Referenced Model for Conditional Execution
Inspect Model Hierarchies
Content Preview
Model Dependency Graph
List of Model References
Model Version Numbers
Model Reference Interface and Boundary
Refresh Model Blocks
Signal Propagation
Signal Logging in Referenced Models
Sample Time Requirements
Share Data Among Referenced Model Instances
Referenced Model Sample Times
How Sample-Time Inheritance Works for Model Blocks
Conditions for Inheriting Sample Times
Determining Sample Time of a Referenced Model
Blocks That Depend on Absolute Time
Blocks Whose Outputs Depend on Inherited Sample Time
Sample Time Consistency
Sample Rates and Solvers
Choose Simulation Modes for Model Hierarchies
Model Reference Simulation Modes
Overridden Simulation Modes
Simulate Conditionally Executed Referenced Models
Triggered, Enabled, and Triggered and Enabled Models
Function-Call Models
Simulate Multiple Referenced Model Instances in Normal Mode
Normal Mode Visibility
Example Models with Multiple Referenced Model Instances
Configure Models with Multiple Referenced Model Instances
Specify the Instance Having Normal Mode Visibility
Manage Simulation Targets for Referenced Models
Reduce Time Spent Checking For Changes
Use Custom Code
Control Location of Simulation Targets
Reduce Update Time for Referenced Models by Using Parallel Builds
Share Simulink Cache Files for Faster Simulation
Inspect Simulink Cache File Contents
Use Simulink Cache Files
Check for Simulink Cache Files in Projects
Set Configuration Parameters for Model Hierarchies
Manage Configuration Parameters by Using Configuration References
Configuration Requirements for All Referenced Model Simulation
Diagnostics That Are Ignored in Accelerator Mode
Parameterize Instances of a Reusable Referenced Model
Specify a Different Value for Each Instance of a Reusable Model
Combine Multiple Arguments into a Structure
Parameterize a Referenced Model
Change Model Argument Name or Value
Customize User Interface for Reusable Components
Configure Instance-Specific Data for Lookup Tables
Parameterize a Referenced Model Programmatically
Group Multiple Model Arguments into a Single Structure
Configure Instance-Specific Data for Lookup Tables Programmatically
Simulink Units
Unit Specification in Simulink Models
Specify Physical Quantities
Specify Units in Objects
Specify Units for Temperature Signals
Specify Units in MATLAB Function Blocks
Specify Units in Constant Blocks
Specify Units for Logging and Loading Signal Data
Restricting Unit Systems
Displaying Units
Unit Consistency Checking and Propagation
Unit Propagation Between Simulink and Simscape
Converting Units
Automatic Unit Conversion Limitations
Update an Existing Model to Use Units
Working with Custom Unit Databases
Custom Units Spreadsheet Format
Define Custom Units in Excel Spreadsheet
Create and Load Custom Unit Database
Troubleshooting Units
Undefined Units
Overflow and Underflow Errors or Warning
Mismatched Units Detected
Mismatched Units Detected While Loading
Disallowed Unit Systems
Automatic Unit Conversions
Unsuccessful Automatic Unit Conversions
Simscape Unit Specification Incompatible with Simulink
Conditional Subsystem
Conditionally Executed Subsystems Overview
Model Examples
Ensure Outport is Virtual
Conditional Output Signal
Partial Write Signals With a Merge Block
Using Enabled Subsystems
Create an Enabled Subsystem
Blocks in Enabled Subsystems
Alternately Executing Enabled Subsystem Blocks
Model Examples
Using Triggered Subsystems
Create a Triggered Subsystem
Triggering with Discrete Time Systems
Triggered Model Versus a Triggered Subsystem
Blocks in a Triggered Subsystem
Model Examples
Using Enabled and Triggered Subsystems
Creating an Enabled and Triggered Subsystem
Blocks in an Enabled and Triggered Subsystem
Model Examples
Select Subsystem Execution
Models with If-Else Structures
Models with Switch Case Structure
Model Examples
Iterate Subsystem Execution
Models with While Structures
Model with For Structures
Model Examples
Using Function-Call Subsystems
Creating a Function-Call Subsystem
Sample Time Propagation in a Function-Call Subsystem
Model Examples
Conditional Subsystem Initial Output Values
Inherit Initial Output Values from Input Signals
Specify Initial Output Values Using Dialog Parameters
Rate-Based Models Overview
Create A Rate-Based Model
Multi-Tasking and Multi-Rate Model for Code Generation
Test Rate-Based Model Simulation Using Function-Call Generators
Create Test Model That References a Rate-Based Model
Simulate Rate-Based Model
Generate Code from Rate-Based Model
Sorting Rules for Explicitly Scheduled Model Components
Export-Function Models
Test Harness for Export Function Models with Strict Scheduling
Test Harness for Export-Function Models Without Strict Scheduling
Data Dependency Error Caused by Data Sorting Rules
Test Harness for Models with Initialize, Reset, and Terminate Function Blocks
Initiators for Model Block in Test Harness
Conditional Subsystem Output Values When Disabled
Simplified Initialization Mode
When to Use Simplified Initialization
Set Initialization Mode to Simplified
Classic Initialization Mode
When to Use Classic Initialization
Set Initialization Mode to Classic
Classic Initialization Issues and Limitations
Identity Transformation Can Change Model Behavior
Inconsistent Output with Discrete-Time Integrator or S-Function Block
Execution Order Affecting Merge Block Output
Tunable Parameters
State
Simulink does not provide correct consistency check
Convert from Classic to Simplified Initialization Mode
Blocks to Consider
Create an Export-Function Model
Create Model Algorithms
Add Function-Call Inputs
Satisfy Export-Function Model Requirements
Test Export-Function Model Simulation Using Input Matrix
Create Function-Call Inputs and Data Inputs
Simulate Export-Function Model
Test Export-Function Model Simulation Using Function-Call Generators
Create Referenced Export-Function Model
Create Test Model (Harness) for Simulation
Simulate Export Function Model
Test Export-Function Model Simulation Using Stateflow Chart
Create Referenced Export-Function Model
Create Periodic Scheduler Using Stateflow Chart
Create Test Model (Harness) for Simulation
Simulate Export Function Model
Test Export-Function Model Simulation Using Schedule Editor
Create Test Model (Harness) for Simulation
Create Function-Call Events Using the Schedule Editor
Simulate Export Function Model
Generate Code for Export-Function Model
Generate Code for Exported Functions
Generate Code for Export-Function Model with Rate-Based Model
Create Export-Function Model with Scheduled Subsystems
Generate Code for Exported Functions
Export-Function Models Overview
Workflows for Export-Function Models
Allowed Blocks
Requirements for Export Function Models
Sample Time for Function-Call Subsystems
Execution Order for Root-Level Function-Call Inport Blocks
Latched Input Data for Function-Call Subsystems
Nested Export-Function Models
Export-Function Model with a Multi-Instanced Function-Call Model
Export-Function Models and Models with Asynchronous Function-Call Inputs
Use Resettable Subsystems
Behavior of Resettable Subsystems
Comparison of Resettable Subsystems and Enabled Subsystems
Model Examples
Simulink Functions Overview
What Are Simulink Functions?
What Are Simulink Function Callers?
Connect to Local Signals
Reusable Logic with Functions
Input/Output Argument Behavior
Shared Resources with Functions
How a Function Caller Identifies a Function
Reasons to Use a Simulink Function Block
Choose a Simulink Function or Reusable Subsystem
When Not to Use a Simulink Function Block
Tracing Simulink Functions
Simulink functions: Simulink Function block, exported Stateflow graphical and MATLAB functions
Create a Simulink function using a Simulink Function Block
Create a Simulink function using an exported graphical function from a Stateflow chart
Create a Simulink function using an exported MATLAB function from a Stateflow chart
Simulink function callers: Function Caller block, MATLAB Function block, Stateflow chart
Use a Function Caller block to call a Simulink Function block
Use a MATLAB Function block to call a Simulink Function block
Use a Stateflow chart to call a Simulink Function block
Call a Simulink Function block from multiple sites
Argument Specification for Simulink Function Blocks
Example Argument Specifications for Data Types
Input Argument Specification for Bus Data Type
Input Argument Specification for Enumerated Data Type
Input Argument Specification for an Alias Data Type
Simulink Function Blocks in Referenced Models
Simulink Function Block in Referenced Model
Function Caller Block in Referenced Model
Function and Function Caller Blocks in Separate Referenced Models
Function and Function Caller in the Same Model
Scoped and Global Simulink Function Blocks Overview
Scoped Simulink Function Blocks in Subsystems
Resolve to a Function Hierarchically
Resolve to a Function by Qualification
Scoped Simulink Function Blocks in Models
Resolve to a Function Hierarchically
Resolve to a Function by Qualification
Multi-Instance Modeling with Simulink Functions
Diagnostics Using a Client-Server Architecture
Diagnostic Messaging with Simulink Functions
Client-Server Architecture
Modifier Pattern
Observer Pattern
Using Initialize, Reset, and Terminate Functions
Create Model Component with State
Initialize Block State
Reset Block State
Read and Save Block State
Prepare Model Component for Testing
Create an Export-Function Model
Create Test Harness to Generate Function Calls
Reference the Export-Function Model
Model an Event Scheduler
Connect Chart to Test Model
Initialize and Reset Parameter Values
Using the Parameter Writer Block
Initialize, Reset, and Terminate Function Limitations
Unsupported Blocks
Unsupported Features
Component I/O Blocks
Model A House Heating System
Define a House Heating System
Model House Heating System
Integrate a House Heating Model
Prepare for Simulation
Run and Evaluate Simulation
Messages in Simulink
Simulink Messages Overview
Model Message Send and Receive Interfaces and Generate Code
Simulate Middleware Effects on a Distributed Architecture
Animate and Understand Sending and Receiving Messages
Use a Queue Block to Manage Messages
Establish Message Send and Receive Interfaces Between Software Components
Model a Message Receive Interface that Runs on Message Availability
Modeling Message Communication Patterns with SimEvents
Build a Shared Communication Channel with Multiple Senders and Receivers
Model Wireless Message Communication with Packet Loss and Channel Failure
Model an Ethernet Communication Network with CSMA/CD Protocol
Send and Receive Messages Carrying Bus Data
Use the Sequence Viewer Block to Visualize Messages, Events, and Entities
Components of the Sequence Viewer Window
Navigate the Lifeline Hierarchy
View State Activity and Transitions
View Function Calls
Simulation Time in the Sequence Viewer Window
Redisplay of Information in the Sequence Viewer Window
Modeling Variant Systems
What Are Variants and When to Use Them
What Are Variants?
Advantages of Using Variants
When to Use Variants
Options for Representing Variants in Simulink
Mapping Inports and Outports of Variant Choices
Variant Badges
Comment Out and Comment Through
Variant Terminology
Command Line Parameters
Working with Variant Choices
Default Variant Choice
Active Variant Choice
Inactive Variant Choice
Empty Variant Choice
Open Active Variant
Introduction to Variant Controls
Variant control mode
Operands
Operators
Known Limitations
Approaches for Specifying Variant Controls
Viewing Variant Conditions
Operators and Operands in Variant Condition Expressions
Net Variant Condition
Create a Simple Variant Model
Create Variant Controls Programmatically
Create and Export Variant Controls
Reuse Variant Conditions
Enumerated Types as Variant Controls
Define, Configure, and Activate Variants
Represent Variant Choices
Include Simulink Model as Variant Choice
Configure Variant Controls
Convert to Variants
Prepare Variant-Containing Model for Code Generation
Convert Variant Control Variables into Simulink.Parameter Objects
Configure Model for Generating Preprocessor Conditionals
Visualize Variant Implementations in a Single Layer
How Variant Sources and Sinks Work
Advantages of Using Variant Sources and Sinks
Limitations of Using Variant Sources and Sinks
Define and Configure Variant Sources and Sinks
Variant Condition Propagation with Variant Sources and Sinks
View Variant Condition Annotations
How Variant Condition Propagation Works
Condition Propagation with Subsystems
Condition Propagation with Other Simulink Blocks
Known Limitations
Create and Validate Variant Configurations
Step 1: Open Variant Manager
Step 2: Define Variant Configuration
Step 3: Activate and Validate Variant Configuration
Import Control Variables to Variant Configuration
Step 1: Open Variant Manager
Step 2: Import Variant Configuration
Step 3: View Referenced Model Configuration
Define Constraints
Reduce Models Containing Variant Blocks
Reduce Model Programmatically
Considerations and Limitations
Condition Propagation with Variant Subsystem
Propagate Conditions Without Generate Preprocessor Conditionals
Propagate Conditions with Generate Preprocessor Conditionals
Adaptive Interface for Variant Subsystems
Condition Propagation with Conditional Systems
Known Limitations
Propagate Conditions Programmatically
Code Generation with Conditional Systems
Variant Systems with Conditional Systems
Convert Configurable Subsystem to Variant Subsystem
Behavior of Configurable Subsystem on Loading
Changing Active Variant
Convert Configurable Subsystem Blocks to Variant Subsystem Blocks Programmatically
Variant Elements within Buses
Create Buses with Variant Conditions
Variant Condition Propagation with Bus
Code Generation
Virtual and Nonvirtual Bus Behavior
Variant Bus with Model Block
Known Limitations
Initialization Function
Model InitFcn
Block InitFcn
Analyze Variant Configurations in Models Containing Variant Blocks
Analyze a Model with Variant Configurations
View Blocks
Block Activeness
Viewing Annotation
Variants Example Models
Approaches to Control Active Variant Choice of a Variant Subsystem
Model
Limitations in Recommended Approaches
Approach 1: Use Mask Parameter as a Variant Control Variable
Approach 2: Use Mask Initialization Variable as a Variant Control Variable
Approach 3: Use Model Workspace Variable as a Variant Control Variable
Approach 4: Use Mask Initialization Script to Control Active Variant Choices
Control Active Choice of Locked Custom Library Variant Subsystem Using Mask Parameter
Model
Switch Between Active Choices
Propagating Variant Conditions to Subsystems
Variant Subsystems
Variant Source and Variant Sink Blocks
Control Variant Condition Propagation
Propagate Variant Condition to Conditional Subsystem
Hierarchical Nesting of Variant Sources and Variant Sinks
Export-Function model with Variant Subsystem
Variant Subsystem with Enable Subsystem as Choice
Managing Model Configurations
Set Model Configuration Parameters for a Model
Configuration Panes
Manage Configuration Sets for a Model
Create a Configuration Set in a Model
Change Configuration Parameter Values in a Configuration Set
Activate a Configuration Set
Copy, Delete, and Move a Configuration Set
Save a Configuration Set
Load a Saved Configuration Set
Compare Configuration Sets
Share a Configuration with Multiple Models
Create a Configuration Set in the Data Dictionary
Create and Attach a Configuration Reference
Resolve a Configuration Reference
Activate a Configuration Reference
Create a Configuration Reference in Another Model
Change Parameter Values in a Referenced Configuration Set
Change Parameter Value in a Configuration Reference
Save a Referenced Configuration Set
Load a Saved Referenced Configuration Set
Configuration Reference Limitations
Share a Configuration Across Referenced Models
Automate Model Configuration by Using a Script
Configuration Object Functions
Configuring Models for Targets with Multicore Processors
Concepts in Multicore Programming
Basics of Multicore Programming
Types of Parallelism
System Partitioning for Parallelism
Challenges in Multicore Programming
Multicore Programming with Simulink
Basic Workflow
How Simulink Helps You to Overcome Challenges in Multicore Programming
Implement Data Parallelism in Simulink
Implement Task Parallelism in Simulink
Implement Pipelining in Simulink
Configure Your Model for Concurrent Execution
Specify a Target Architecture
Choose from Predefined Architectures
Define a Custom Architecture File
Partition Your Model Using Explicit Partitioning
Prerequisites for Explicit Partitioning
Add Periodic Triggers and Tasks
Add Aperiodic Triggers and Tasks
Map Blocks to Tasks, Triggers, and Nodes
Implicit and Explicit Partitioning of Models
Partitioning Guidelines
Configure Data Transfer Settings Between Concurrent Tasks
Optimize and Deploy on a Multicore Target
Generate Code
Build on Desktop
Profile and Evaluate Explicitly Partitioned Models on a Desktop
Customize the Generated C Code
Programmatic Interface for Concurrent Execution
Map Blocks to Tasks
Supported Targets For Multicore Programming
Supported Multicore Targets
Supported Heterogeneous Targets
Limitations with Multicore Programming in Simulink
Modeling Best Practices
General Considerations when Building Simulink Models
Avoiding Invalid Loops
Shadowed Files
Model Building Tips
Model a Continuous System
Best-Form Mathematical Models
Series RLC Example
Solving Series RLC Using Resistor Voltage
Solving Series RLC Using Inductor Voltage
Model a Simple Equation
Model Differential Algebraic Equations
Overview of Robertson Reaction Example
Simulink Model from ODE Equations
Simulink Model from DAE Equations
Simulink Model from DAE Equations Using Algebraic Constraint Block
Basic Modeling Workflow
Model a System Algorithm
Create Model Components
Manage Signal Lines
Manage Model Data
Reuse Model Components from Files
Create Interchangeable Variations of Model Components
Set Up a File Management System
Project Setup
Organize Large Modeling Projects
What Are Projects?
Explore Project Tools with the Airframe Project
Explore the Airframe Project
Set Up Project Files and Open the Project
View, Search, and Sort Project Files
Open and Run Frequently Used Files
Review Changes in Modified Files
Run Dependency Analysis
Run Project Integrity Checks
Commit Modified Files
View Project and Source Control Information
Create a Project from a Model
Create a New Project From a Folder
Add Files to the Project
Create a New Project from an Archived Project
Create a New Project Using Templates
Use Project Templates from R2014a or Before
Open Recent Projects
Specify Project Details, Startup Folder, and Derived Files Folders
Specify Project Path
What Can You Do With Project Shortcuts?
Automate Startup Tasks
Automate Shutdown Tasks
Create Shortcuts to Frequent Tasks
Create Shortcuts
Group Shortcuts
Annotate Shortcuts to Use Meaningful Names
Customize Shortcut Icons
Use Shortcuts to Find and Run Frequent Tasks
Create Templates for Standard Project Settings
Using Templates to Create Standard Project Settings
Create a Template from the Current Project
Create a Template from a Project Under Version Control
Edit a Template
Remove a Template
Explore the Example Templates
Project File Management
Group and Sort File Views
Search Inside Project Files and Filter File Views
Project-Wide Search
Filter Project File Views
More Ways to Search
Work with Project Files
Manage Shadowed and Dirty Models and Other Project Files
Identify Shadowed Project Files When Opening a Project
Find Models and Other Project Files With Unsaved Changes
Manage Open Models and Data Dictionaries When Closing a Project
Move, Rename, Copy, or Delete Project Files
Move or Add Files
Automatic Updates When Renaming, Deleting, or Removing Files
Back Out Changes
Create Labels
Add Labels to Files
View and Edit Label Data
Automate Project Tasks Using Scripts
Create a Custom Task Function
Run a Project Custom Task and Publish Report
Sharing Projects
Share Project by Email
Share Project as a MATLAB Toolbox
Share Project on GitHub
Archive Projects
Upgrade All Project Models, Libraries, and MATLAB Code Files
Upgrade Libraries
Analyze Model Dependencies
Open and Explore Dependency Graph
Model Dependency Views
Find Required Products
Export Dependency Analysis Results
Create Project from the Dependency Graph
View Linked Requirements in Models and Blocks
Requirements Traceability in Simulink
Highlight Requirements in a Model
View Information About a Requirements Link
Navigate to Requirements from a Model
Filter Requirements in a Model
Project Dependency Analysis
What Is Dependency Analysis?
Dependency Analysis for Projects
Dependency Analysis for Models
Dependency Analyzer Scope and Limitations
Analysis Scope
Analysis Limitations
Run a Dependency Analysis
Explore the Dependency Graph, Views, and Filters
Select, Pan, and Zoom
Investigate Dependency Between Two Files
Color Files by Type, Status, or Label
Apply and Clear Filters
Perform an Impact Analysis
About Impact Analysis
Run a Dependency Analysis
Find Required Products and Toolboxes
Find Dependencies of Selected Files
Check Dependency Results and Resolve Problems
Investigate Problem Files in Dependency Graph
Investigate Problem Files in File List
Find Requirements Documents in a Project
Export Dependency Analysis Results
Send Files to Project Tools
Project Source Control
About Source Control with Projects
Classic and Distributed Source Control
Add a Project to Source Control
Add a Project to Git Source Control
Add a Project to SVN Source Control
Register Model Files with Source Control Tools
Set Up SVN Source Control
Set Up SVN Provided with Projects
Set Up Project SVN for SVN Version Already Installed
Set Up Project SVN for SVN Version Not Yet Provided with Projects
Register Model Files with Subversion
Enforce SVN Locking Model Files Before Editing
Share a Subversion Repository
Manage SVN Externals
Set Up Git Source Control
Configure MATLAB on Windows
Use SSH Authentication with MATLAB
Register Model Files with Git
Add Git Submodules
Update Submodules
Use Fetch and Merge with Submodules
Use Push to Send Changes to the Submodule Repository
Create New GitHub Repository
Disable Source Control
Change Source Control
Write a Source Control Integration with the SDK
Clone Git Repository
Troubleshooting
Check Out SVN Repository
Tag and Retrieve Versions of Project Files
Refresh Status of Project Files
Check for Modifications
Update Revisions of Project Files
Update Revisions with SVN
Update Revisions with Git
Update Selected Files
Get SVN File Locks
Manage SVN Repository Locks
View Modified Files
Project Definition Files
Compare Revisions
Run Project Checks
Commit Modified Files to Source Control
Revert Changes
Discard Local Changes
Revert a File to a Specified Revision
Revert the Project to a Specified Revision
Pull, Push, and Fetch Files with Git
Pull and Push
Pull, Fetch, and Merge
Push Empty Folders
Use Git Stashes
Branch and Merge Files with Git
Create a Branch
Switch Branch
Compare Branches and Save Copies
Merge Branches
Revert to Head
Delete Branches
Resolve Conflicts
Resolve Conflicts
Merge Text Files
Merge Models
Extract Conflict Markers
Work with Derived Files in Projects
Customize External Source Control to Use MATLAB for Diff and Merge
Finding the Full Paths for MATLAB Diff, Merge, and AutoMerge
Integration with Git
Integration with SVN
Integration with Other Source Control Tools
Project Reference
Componentization Using Referenced Projects
Add or Remove a Reference to Another Project
View, Edit, or Run Referenced Project Files
Extract a Folder to Create a Referenced Project
Manage Referenced Project Changes Using Checkpoints
Compare Simulink Models
About Simulink Model Comparison
Creating Model Comparison Reports
Examples of Model Comparison
Using Model Comparison Reports
Select Simulink Models to Compare
Compare Simulink Models
Navigate the Simulink Model Comparison Report
Step Through Changes
Explore Changes in the Original Models
Merge Differences
Open Child Comparison Reports for Selected Nodes
Understand the Report Hierarchy and Matching
Filter Comparison Reports
Change Color Preferences
Save Comparison Results
Examples of Model Comparison
Display Differences in Original Models
Highlighting in Models
Control Highlighting in Models
View Changes in Model Configuration Parameters
Merge Simulink Models from the Comparison Report
Resolve Conflicts Using Three-Way Model Merge
Use Three-Way Merge with External Source Control Tools
Open Three-Way Merge Without Using Source Control
Two-Way Model Merge
Merge MATLAB Function Block Code
Export, Print, and Save Model Comparison Results
Save Printable Report
Export Results to the Workspace
Comparing Models with Identical Names
Work with Referenced Models and Library Links
Compare Project or Model Templates
Compare Project Templates
Compare Model Templates
Large-Scale Modeling
Component-Based Modeling Guidelines
Should You Create Model Components?
Define Model Components
Choose Among Types of Model Components
Simulink Components
High-Level Component Selection Guidelines
Compare Capabilities of Model Components
Development Process
Performance Requirements
Features
Define Interfaces of Model Components
Guidelines for Interface Design
Partitioning Data
Configure Data Interface for Component
Configuration Management
Manage Designs Using Source Control
Determine the Files Used by a Component
Manage Model Versions
Create Configurations
Power Window Example
Power Window
Study Power Windows
MathWorks Software Used in This Example
Quantitative Requirements
Simulink Power Window Controller Project
Simulink Power Window Controller
Create Model Using Model-Based Design
Automatic Code Generation for Control Subsystem
References
Schedule Editor
What are Partitions?
Create Partitions
Partitioning a Model
Create Partitions from a Rate-Based Model
Export-Function Partitions
Using the Schedule Editor
Using the Schedule Editor
Schedule the Partitions
Schedule an Export-Function Model Using the Schedule Editor
Schedule a Rate-Based Model Using the Schedule Editor
Generate Code from a Partitioned Model
Export-Function Conversion
Create and Analyze Random Schedules for a Model Using the Schedule Editor API
Events in Schedule Editor
Event Management in the Schedule Editor
Schedule Partitions with Events
Test Harness Generation
Limitations and Error Conditions
Simulating Dynamic Systems
Running Simulations
Simulate a Model Interactively
Simulation Basics
Run, Pause, and Stop a Simulation
Use Blocks to Stop or Pause a Simulation
Choose a Solver
Solver Selection Criteria
Choose a Jacobian Method for an Implicit Solver
Sparsity of Jacobian
Solver Jacobian Methods
Heuristic 'auto' Method
Full and Sparse Perturbation Methods
Full and Sparse Analytical Methods
Code Generation Support
Variable Step Solvers in Simulink
Variable-Step Discrete Solver
Variable-Step Continuous Solvers
Variable-Step Continuous Explicit Solvers
Variable-Step Continuous Implicit Solvers
Error Tolerances for Variable-Step Solvers
Fixed Step Solvers in Simulink
Fixed-Step Discrete Solver
Fixed-Step Continuous Solvers
Choose a Fixed-Step Solver
When to Use a Fixed-Step Solver
Establish Baseline Results Using a Variable-Step Solver
Run Fixed-Step Simulations of the Model
Compare Fixed-Step Simulations with the Variable-Step Baseline
Select Solver Using Auto Solver
Save and Restore Simulation Operating Point
Benefits of Using Operating Point
Save an Operating Point
Restore Operating Point
Operating Point Behavior
Change the States of a Block Within Operating Point
S-Functions
Model Changes and Operating Point Restore
Limitations of Saving and Restoring Operating Point
View Diagnostics
Toolbar
Diagnostic Message Pane
Trace Diagnostics Location
Identify Diagnostics from Custom Compilers
Suppress Diagnostics
Suggested Actions
Systematic Diagnosis of Errors and Warnings
Suppress Diagnostic Messages Programmatically
Suppress Diagnostic Messages Programmatically
Suppress Diagnostic Messages of a Referenced Model
Customize Diagnostic Messages
Display Custom Text
Create Hyperlinks to Files, Folders, or Blocks
Create Programmatic Hyperlinks
Report Diagnostic Messages Programmatically
Create Diagnostic Stages
Report Diagnostic Messages
Log Diagnostic Messages
Running a Simulation Programmatically
Run Simulations Programmatically
Specify Parameter Name-Value Pairs
Enable Simulation Timeouts
Capture Simulation Errors
Access Simulation Metadata
Control and Check Status of Simulation
Automate Simulation Tasks Using Callbacks
Run Parallel Simulations
How parsim works
Using sim function within parfor
Overview of Calling sim from Within parfor
Error Handling in Simulink Using MSLException
Error Reporting in a Simulink Application
The MSLException Class
Methods of the MSLException Class
Capturing Information about the Error
Multiple Simulations
Run Multiple Simulations
Other Advantages
Simulation Manager
Data Logging for Multiple Simulations
Run Parallel Simulations Using parsim
Run Multiple Parallel Simulations with Different Set Points
View the Runs in the Simulation Manager
Multiple Simulation Workflows
parsim Workflow
batchsim Workflow
Analyze Results Using Simulation Manager
Open Simulation Manager
Add and Configure Plots
Save and Load Simulation Manager
Visualizing and Comparing Simulation Results
Prototype and Debug Models with Scopes
Scope Blocks and Scope Viewer Overview
Overview of Methods
Simulink Scope Versus Floating Scope
Simulink Scope Versus DSP System Toolbox Time Scope
Scope Trace Selection Panel
Scope Triggers Panel
What Is the Trigger Panel
Main Pane
Source/Type and Levels/Timing Panes
Hysteresis of Trigger Signals
Delay/Holdoff Pane
Cursor Measurements Panel
Scope Signal Statistics Panel
Scope Bilevel Measurements Panel
Bilevel Measurements
Settings
Transitions Pane
Overshoots / Undershoots Pane
Cycles Pane
Peak Finder Measurements Panel
Spectrum Analyzer Cursor Measurements Panel
Spectrum Analyzer Channel Measurements Panel
Spectrum Analyzer Distortion Measurements Panel
Spectral Masks
Set Up Spectral Masks
Check Spectral Masks
Spectrum Analyzer CCDF Measurements Panel
Common Scope Block Tasks
Connect Multiple Signals to a Scope
Save Simulation Data Using Scope Block
Pause Display While Running
Copy Scope Image
Plot an Array of Signals
Scopes in Referenced Models
Scopes Within an Enabled Subsystem
Modify x-axis of Scope
Show Signal Units on a Scope Display
Select Number of Displays and Layout
Dock and Undock Scope Window to MATLAB Desktop
Floating Scope and Scope Viewer Tasks
Add Floating Scope Block to Model and Connect Signals
Add Scope Viewer to a Signal
Add Signals to an Existing Floating Scope or Scope Viewer
Save Simulation Data from Floating Scope
Add and Manage Viewers
Quickly Switch Visualization of Different Signals on a Floating Scope
Generate Signals Without Source Blocks
Attach Signal Generator
Modify Signal Generator Parameters
Remove Signal Generator
Viewers and Generators Manager
Open the Viewers and Generators Manager
Change Parameters
Connect Viewers and Generators
View Test Point Data
Customize Viewers and Generators Manager
Control Scope Blocks Programmatically
Plot Circle with XY Graph
Inspecting and Comparing Simulation Data
View Data in the Simulation Data Inspector
View Logged Data
Import Data from the Workspace or a File
View Complex Data
View String Data
View Frame-Based Data
View Event-Based Data
Import Workspace Variables Using a Custom Data Reader
Import Data Using a Custom File Reader
View and Replay Map Data
Visualize Simulation Data on an XY Plot
Analyze Data Using the XY Visualization
Microsoft Excel Import and Export Format
Basic File Format
Multiple Time Vectors
Signal Metadata
User-Defined Data Types
Complex, Multidimensional, and Bus Signals
Function-Call Signals
Simulation Parameters
Multiple Runs
Import Data from a CSV File into the Simulation Data Inspector
Basic File Format
Multiple Time Vectors
Signal Metadata
Import Data from a CSV File
Configure the Simulation Data Inspector
Incoming Run Names and Location
Signal Metadata to Display
Signal Selection on the Inspect Pane
How Signals Are Aligned for Comparison
Colors Used to Display Comparison Results
Signal Grouping
Data to Stream from Parallel Simulations
Options for Saving and Loading Session Files
Archive Behavior and Run Limit
Signal Display Units
Control Display of Streaming Data Using Triggers
Examine the Model
Interactively Generate Trigger Events
Capture Signal Transient Response
Stabilize a Steady-State Periodic Signal
Iterate Model Design Using the Simulation Data Inspector
View and Inspect Signals During Simulation
Automatically Transfer View to Current Simulation
Control Data Retention
Visualize Many Logged Signals
Access Data in a MATLAB Function During Simulation
Write a Callback Function for Data Access
Configure Signals for Data Access
Save and Share Simulation Data Inspector Data and Views
Save and Load Simulation Data Inspector Sessions
Share Simulation Data Inspector Views
Share Simulation Data Inspector Plots
Create a Simulation Data Inspector Report
Export Data from the Simulation Data Inspector
Create an Interactive Comparison Report
Create Plots Using the Simulation Data Inspector
Select a Plot Layout
Add Visualizations
Customize Time Plot Appearance
Customize Signal Appearance
Shade Signal Regions
Rename Signals
Inspect Simulation Data
Configure Signals for Logging
View Signals
View Signals on Multiple Plots
Zoom, Pan, and Resize Plots
Inspect Simulation Data Using Cursors
Replay Data
Inspect Metadata
Modify Signal Properties in the Simulation Data Inspector
Modify Signal Units
Modify Signal Data Type
Modify Signal Names
Replay Data in the Simulation Data Inspector
Compare Simulation Data
Setup
Compare Signals
Compare Runs
How the Simulation Data Inspector Compares Data
Signal Alignment
Synchronization
Interpolation
Tolerance Specification
Organize Your Simulation Data Inspector Workspace
Modify the Layout
Modify Signal Grouping
Specify How the Simulation Data Inspector Names Runs
Filter Runs and Signals in the Work Area
Inspect and Compare Data Programmatically
Create a Run and View the Data
Compare Signals Within a Simulation Run
Compare and Analyze Simulation Data Programmatically
Analyze Simulation Data Using Signal Tolerances
Create a Report for Plotted Signals
Save and Restore a Set of Logged Signals
Keyboard Shortcuts for the Simulation Data Inspector
General Actions
Plot Zooming
Data Cursors
Import Dialog Box
The Simulation Data Inspector Archive
Manage Runs in the Archive
Limit Data Retention
Tune and Visualize Your Model with Dashboard Blocks
Explore Connections Within the Model
Simulate Changing Model States
View Signal Data
Tune Parameters During Simulation
Interactively Design and Debug Models Using Panels
Create a New Panel
Manage Panels in Your Model
Edit and Annotate a Panel
Interactively Simulate a Model Using Panels
Analyzing Simulation Results
Decide How to Visualize Simulation Data
Simulation Data Inspector
Scope Blocks and the Scope Viewer
Dashboard Blocks
Port Value Displays
Custom MATLAB Visualizations
Linearizing Models
About Linearizing Models
Linearization with Referenced Models
Linearization Using the 'v5' Algorithm
Finding Steady-State Points
Improving Simulation Performance and Accuracy
How Optimization Techniques Improve Performance and Accuracy
Speed Up Simulation
How Profiler Captures Performance Data
How Profiler Works
Start Profiler
Save Profiler Results
Check and Improve Simulation Accuracy
Check Simulation Accuracy
Unstable Simulation Results
Inaccurate Simulation Results
Modeling Techniques That Improve Performance
Accelerate the Initialization Phase
Reduce Model Interactivity
Reduce Model Complexity
Choose and Configure a Solver
Save the Simulation State
Use Performance Advisor to Improve Simulation Efficiency
Understanding Total Time and Self Time in Profiler Reports
Performance Advisor
Improve Simulation Performance Using Performance Advisor
Performance Advisor Workflow
Prepare Your Model
Create a Performance Advisor Baseline Measurement
Run Performance Advisor Checks
View and Respond to Results
View and Save Performance Advisor Reports
Perform a Quick Scan Diagnosis
Run Quick Scan on a Model
Checks in Quick Scan Mode
Improve vdp Model Performance
Enable Data Logging for the Model
Create Baseline
Select Checks and Run
Review Results
Apply Advice and Validate Manually
Solver Profiler
Examine Model Dynamics Using Solver Profiler
Understand Profiling Results
Zero-Crossing Events
Solver Exception Events
Tolerance-Exceeding Events
Newton Iteration Failures
Infinite State and Infinite Derivative Exceptions
Differential Algebraic Equation Failures
Solver Resets
Zero-Crossing
Discrete Signal
ZOH Signal
Block Signal
Initial Reset
Internal
Jacobian Logging and Analysis
Modify Solver Profiler Rules
Change Thresholds of Profiler Rules
Develop Profiler Rule Set
Customize State Ranking
Solver Profiler Interface
Statistics Pane
Suggestions and Exceptions Pane
Simulink Debugger
Introduction to the Debugger
Debugger Graphical User Interface
Displaying the Graphical Interface
Toolbar
Breakpoints Pane
Simulation Loop Pane
Outputs Pane
Sorted List Pane
Status Pane
Debugger Command-Line Interface
Controlling the Debugger
Method ID
Block ID
Accessing the MATLAB Workspace
Debugger Online Help
Start the Simulink Debugger
Starting from a Model Window
Starting from the Command Window
Start a Simulation
Run a Simulation Step by Step
Introduction
Block Data Output
Stepping Commands
Continuing a Simulation
Running a Simulation Nonstop
Set Breakpoints
About Breakpoints
Setting Unconditional Breakpoints
Setting Conditional Breakpoints
Display Information About the Simulation
Display Block I/O
Display Algebraic Loop Information
Display System States
Display Solver Information
Display Information About the Model
Display Model’s Sorted Lists
Display a Block
Accelerating Models
What Is Acceleration?
How Acceleration Modes Work
Overview
Normal Mode
Accelerator Mode
Rapid Accelerator Mode
Code Regeneration in Accelerated Models
Determine If the Simulation Will Rebuild
Parameter Tuning in Rapid Accelerator Mode
Choosing a Simulation Mode
Simulation Mode Tradeoffs
Comparing Modes
Decision Tree
Design Your Model for Effective Acceleration
Select Blocks for Accelerator Mode
Select Blocks for Rapid Accelerator Mode
Control S-Function Execution
Accelerator and Rapid Accelerator Mode Data Type Considerations
Behavior of Scopes and Viewers with Rapid Accelerator Mode
Factors Inhibiting Acceleration
Perform Acceleration
Customize the Build Process
Run Acceleration Mode from the User Interface
Making Run-Time Changes
Interact with the Acceleration Modes Programmatically
Why Interact Programmatically?
Build JIT Accelerated Execution Engine
Control Simulation
Simulate Your Model
Customize the Acceleration Build Process
Run Accelerator Mode with the Simulink Debugger
Advantages of Using Accelerator Mode with the Debugger
How to Run the Debugger
When to Switch Back to Normal Mode
Comparing Performance
Performance of the Simulation Modes
Measure Performance
How to Improve Performance in Acceleration Modes
Techniques
C Compilers
Managing Blocks
Working with Blocks
Nonvirtual and Virtual Blocks
Specify Block Properties
Set Block Annotation Properties
Specify Block Callbacks
Specify Block Execution Priority and Tag
Use Block Description to Identify a Block
Create Block Annotations Programmatically
Format a Model
Improve Model Layout
Flip or Rotate Blocks
Manage Block Names and Ports
Specify Model Colors
Specify Fonts in Models
Increase Drop Shadow Depth
Box and Label Areas of a Model
Copy Formatting Between Model Elements
Display Port Values for Debugging
Display Port Values for Easy Debugging
Display Value for a Specific Port
Display Port Values for a Model
Port Value Display Limitations
Control and Display Execution Order
Execution Order Viewer
Navigation from Blocks to Tasks
Execution Order Notation
How Simulink Determines Execution Order
Checks for Execution Order Changes Involving Data Store Memory Blocks
Access Block Data During Simulation
About Block Run-Time Objects
Access a Run-Time Object
Listen for Method Execution Events
Synchronizing Run-Time Objects and Simulink Execution
Working with Block Parameters
Set Block Parameter Values
Programmatically Access Parameter Values
Specify Parameter Values
Considerations for Other Modeling Goals
Share and Reuse Block Parameter Values by Creating Variables
Reuse Parameter Values in Multiple Blocks and Models
Define a System Constant
Set Variable Value by Using a Mathematical Expression
Control Scope of Parameter Values
Permanently Store Workspace Variables
Manage and Edit Workspace Variables
Package Shared Breakpoint and Table Data for Lookup Tables
Parameter Interfaces for Reusable Components
Referenced Models
Subsystems
Organize Related Block Parameter Definitions in Structures
Create and Use Parameter Structure
Store Data Type Information in Field Values
Control Field Data Types and Characteristics by Creating Parameter Object
Manage Structure Variables
Define Parameter Hierarchy by Creating Nested Structures
Group Multiple Parameter Structures into an Array
Create a Structure of Constant-Valued Signals
Considerations Before Migrating to Parameter Structures
Combine Existing Parameter Objects Into a Structure
Parameter Structures in the Generated Code
Parameter Structure Limitations
Package Shared Breakpoint and Table Data for Lookup Tables
Create Parameter Structure According to Structure Type from Existing C Code
Tune and Experiment with Block Parameter Values
Iteratively Adjust Block Parameter Value Between Simulation Runs
Tune Block Parameter Value During Simulation
Prepare for Parameter Tuning and Experimentation
Interactively Tune Using Dashboard Blocks
Which Block Parameters Are Tunable During Simulation?
Why Did the Simulation Output Stay the Same?
Tunability Considerations and Limitations for Other Modeling Goals
Optimize, Estimate, and Sweep Block Parameter Values
Sweep Parameter Value and Inspect Simulation Results
Store Sweep Values in Simulink.SimulationInput Objects
Capture and Visualize Simulation Results
Improve Simulation Speed
Sweep Parameter Values to Test and Verify System
Estimate and Calibrate Model Parameters
Tune and Optimize PID and Controller Parameters
Control Block Parameter Data Types
Reduce Maintenance Effort with Data Type Inheritance
Techniques to Explicitly Specify Parameter Data Types
Use the Model Data Editor for Batch Editing
Calculate Best-Precision Fixed-Point Scaling for Tunable Block Parameters
Detect Numerical Accuracy Issues Due to Quantization and Overflow
Reuse Custom C Data Types for Parameter Data
Data Types of Mathematical Expressions
Block Parameter Data Types in the Generated Code
Specify Minimum and Maximum Values for Block Parameters
Specify Parameter Value Ranges
Restrict Allowed Values for Block Parameters
Specify Range Information for Tunable Fixed-Point Parameters
Unexpected Errors or Warnings for Data with Greater Precision or Range than double
Optimize Generated Code
Switch Between Sets of Parameter Values During Simulation and Code Execution
Working with Lookup Tables
About Lookup Table Blocks
Anatomy of a Lookup Table
Lookup Tables Block Library
Guidelines for Choosing a Lookup Table
Data Set Dimensionality
Data Set Numeric and Data Types
Data Accuracy and Smoothness
Dynamics of Table Inputs
Efficiency of Performance
Summary of Lookup Table Block Features
Enter Breakpoints and Table Data
Entering Data in a Block Parameter Dialog Box
Entering Data in the Lookup Table Editor
Entering Data Using Inports of the Lookup Table Dynamic Block
Characteristics of Lookup Table Data
Sizes of Breakpoint Data Sets and Table Data
Monotonicity of Breakpoint Data Sets
Formulation of Evenly Spaced Breakpoints
Methods for Approximating Function Values
About Approximating Function Values
Interpolation Methods
Extrapolation Methods
Rounding Methods
Example Output for Lookup Methods
Edit Lookup Tables
Edit N-Dimensional Lookup Tables
Edit Custom Lookup Table Blocks
Import Lookup Table Data from MATLAB
Import Standard Format Lookup Table Data
Propagate Standard Format Lookup Table Data
Import Nonstandard Format Lookup Table Data
Propagate Nonstandard Format Lookup Table Data
Import Lookup Table Data from Excel
Create a Logarithm Lookup Table
Prelookup and Interpolation Blocks
Optimize Generated Code for Lookup Table Blocks
Remove Code That Checks for Out-of-Range Inputs
Optimize Breakpoint Spacing in Lookup Tables
Reduce Data Copies for Lookup Table Blocks
Efficient Code for Row-Major Array Layout
Row-Major Algorithm in Existing Models Containing Lookup Table Blocks
View Simulink.LookupTable Object Data Using the Property Dialog Box Tabular Interface
Simulink.LookupTable Object Property Dialog Box Data Type Support
Create Simulink.LookupTable Objects
How to Open the Simulink.LookupTable Object Property Dialog Box
Create Table and Breakpoint Data
View Multidimensional Slices of Data
Edit Table and Breakpoint Data with MATLAB Expressions
Edit Table and Breakpoint Data
Overflow Handling
Data Validation
Simulink.LookupTable Object Property Dialog Box Tabular Interface Shortcuts
Update Lookup Table Blocks to New Versions
Comparison of Blocks with Current Versions
Compatibility of Models with Older Versions of Lookup Table Blocks
How to Update Your Model
What to Expect from the Model Advisor Check
Working with Block Masks
Masking Fundamentals
Masking Terminology
Create a Simple Mask
Step 1: Open Mask Editor
Step 2: Define the Mask
Step 3: Operate on Mask
Manage Existing Masks
Change a Block Mask
View Mask Parameters
Look Under Block Mask
Remove Mask
Mask Callback Code
Add Mask Code
Execute Drawing Command
Execute Initialization Command
Execute Callback Code
Draw Mask Icon
Draw Static Icon
Draw Dynamic Icon
Initialize Mask
Dialog Variables
Initialization Commands
Mask Initialization Best Practices
Promote Parameter to Mask
Promote Underlying Parameters to Block Mask
Promote Underlying Parameters to Subsystem Mask
Unresolved Promoted Parameter
Best Practices
Promote Block Parameters on a Mask
Control Masks Programmatically
Use Simulink.Mask and Simulink.MaskParameter
Use get_param and set_param
Programmatically Create Mask Parameters and Dialogs
Pass Values to Blocks Under the Mask
Parameter Promotion
Mask Initialization
Referencing Block Parameters Using Variable Names
Mask Linked Blocks
Guidelines for Mask Parameters
Mask Behavior for Masked, Linked Blocks
Mask a Linked Block
Dynamic Mask Dialog Box
Show Parameter
Enable Parameter
Create Dynamic Mask Dialog Box
Set Up Nested Masked Block Parameters
Dynamic Masked Subsystem
Allow Library Block to Modify Its Contents
Create Self-Modifying Masks for Library Blocks
Passing Mask Parameter Values from Parent Subsystem to Child Block
Debug Masks That Use MATLAB Code
Code Written in Mask Editor
Code Written Using MATLAB Editor/Debugger
Introduction to System Mask
Create and Reference a Masked Model
Step 1: Define Mask Arguments
Step 2: Create Model Mask
Step 3: View Model Mask Parameters
Step 4: Reference Masked Model
Control Model Mask Programmatically
Simulink.Mask.create
Simulink.Mask.get
Handling Large Number of Mask Parameters
Customize Tables for Masked Blocks
Adding a Custom Table Parameter
Control Custom Tables Programmatically
Add a Custom Table Parameter
Add Columns to a Table
Set and Get Table Properties
Set and Get Cell Level Specifications
Edit Rows in a Custom Table
Edit Columns in a Custom Table
Get and Set Table Parameter
Add Images in Masks
Store Mask Images Programmatically
Create Hierarchical List in Mask Dialog
Validating Mask Parameters Using Constraints
Create and Associate a Constraint
Create a Cross-Parameter Constraint
Rule Attributes in Constraint Manager
Custom Constraints
Shared Constraints
Control Constraints Programmatically
Define Measurement Units for Masked Blocks
Masking Example Models
Create a Custom Table in the Mask Dialog
Create a Block Mask Icon
Promote Block Parameters on a Mask
Mask a Variant Subsystem
Creating Custom Blocks
Types of Custom Blocks
MATLAB Function Blocks
MATLAB System Blocks
Subsystem Blocks
C Caller Block
S-Function Blocks
Masked Blocks
Comparison of Custom Block Functionality
Model State Behavior
Simulation Performance
Code Generation
Multiple Input and Output Ports
Speed of Updating the Simulink Diagram
Callback Methods
Comparing MATLAB S-Functions to MATLAB Functions for Code Generation
Expanding Custom Block Functionality
Design and Create a Custom Block
How to Design a Custom Block
Defining Custom Block Behavior
Deciding on a Custom Block Type
Placing Custom Blocks in a Library
Adding a User Interface to a Custom Block
Adding Block Functionality Using Block Callbacks
Working with Block Libraries
Create a Custom Library
Create a Library
Blocks for Custom Libraries
Annotations in Custom Libraries
Lock and Unlock Libraries
Prevent Disabling of Library Links
Add Libraries to the Library Browser
Specify Library Order in the Library List
Linked Blocks
Rules for Linked Blocks
Linked Block Terminology
Parameterized Links and Self-Modifiable Linked Subsystems
Parameterized Links
Self-Modifiable Linked Subsystems
Create a Self-Modifiable Library Block
Display Library Links
Disable or Break Links to Library Blocks
Break Links
Lock Links to Blocks in a Library
Rules for Locked Links
Restore Disabled Links
Restore Disabled Links Individually
Restore Disabled Links Hierarchically
Restore Parameterized Links
Fix Unresolved Library Links
Control Linked Block Programmatically
Linked Block Information
Lock Linked Blocks
Link Status
Forwarding Tables
Create Forwarding Table
Create Mask Parameter Aliases
Integrate C Code in Simulink Models
Integrate C Code Using C Caller Blocks
Specify Source Code and Dependencies
Call C Caller Block and Specify Ports
Map C Function Arguments to Simulink Ports
Create a Custom C Caller Library
Generate Debug Symbols for Custom Code
Limitations
Integrate Algorithms Using C Function
Call and Integrate External C Algorithms into Simulink
Write External Source Files
Enter the External Code Into Simulink
Call C Library Functions From C Function Block
Specify Simulation or Code Generation Code
Modify States of a C Function Block Using Persistent Symbols
Change Values of Signals Using C Function Block and Buses
Access Elements of a Matrix Using Output Code in a C Function Block
Use External Functions with Matrix Input in a C Function Block
Define an Alias Type in a C Function Block
Use Enumerated Data in a C Function Block
Use Inherited Sizes in a C Function Block
Call a Legacy Lookup Table Function Using C Caller block
Start and Terminate Actions Within a C Function Block
Call C++ Class Methods Using a C-style Wrapper Function From a C Function Block
Call Legacy Lookup Table Functions Using C Function Block
Using the MATLAB Function Block
Integrate MATLAB Algorithm in Model
Implementing MATLAB Functions Using Blocks
How MATLAB Function Blocks Work
MATLAB Function Block Capabilities
Create Custom Functionality Using MATLAB Function Block
Create Model
Program the MATLAB Function Block
Build the Function and Check for Errors
Define Inputs and Outputs
Create a MATLAB Function Object and Query Properties
Define Local Variables for Code Generation
Generate Code for the MATLAB Function Block
Add Code to a MATLAB Function Block Programmatically
Code Generation Readiness Tool
Summary Tab
Code Structure Tab
Check Code Using the Code Generation Readiness Tool
Run Code Generation Readiness Tool at the Command Line
Run the Code Generation Readiness Tool From the Current Folder Browser
Debugging a MATLAB Function Block
Debugging the Function in Simulation
Set Conditions on Breakpoints
Watching Function Variables During Simulation
Checking for Data Range Violations
Debugging Tools
Prevent Algebraic Loop Errors in MATLAB Function and Stateflow Blocks
MATLAB Function Block Editor
Customizing the MATLAB Function Block Editor
MATLAB Function Block Editor Tools
Editing and Debugging MATLAB Function Block Code
Ports and Data Manager
Ports and Data Manager Dialog Box
Opening the Ports and Data Manager
Ports and Data Manager Tools
Adding Function Call Outputs to a MATLAB Function Block
Considerations when Supplying Output to the Function-Call Subsystem
The Function Call Properties Dialog
Setting Function Call Output Properties
Adding Input Triggers to a MATLAB Function Block
The Trigger Properties Dialog
Setting Input Trigger Properties
Adding Data to a MATLAB Function Block
Defining Data in the Ports and Data Manager
Setting General Properties
Setting Description Properties
MATLAB Function Block Properties
Name
Update method
Saturate on integer overflow
Support variable-size arrays
Allow direct feedthrough
Lock Editor
Treat these inherited Simulink signal types as fi objects
MATLAB Function block fimath
Description
Document link
MATLAB Function Reports
Opening a MATLAB Function Report
Error and Warning Messages
Functions List
MATLAB Source
MATLAB Variables
Report Limitations
Type Function Arguments
About Function Arguments
Specifying Argument Types
Inheriting Argument Data Types
Built-In Data Types for Arguments
Specifying Argument Types with Expressions
Specifying Fixed-Point Designer Data Properties
Size Function Arguments
Specifying Argument Size
Inheriting Argument Sizes from Simulink
Specifying Argument Sizes with Expressions
Units in MATLAB Function Blocks
Units for Input and Output Data
Consistency Checking
Units for Stateflow Limitations
Add Parameter Arguments
Resolve Signal Objects for Output Data
Implicit Signal Resolution
Eliminating Warnings for Implicit Signal Resolution in the Model
Disabling Implicit Signal Resolution for a MATLAB Function Block
Forcing Explicit Signal Resolution for an Output Data Signal
Types of Structures in MATLAB Function Blocks
Attach Bus Signals to MATLAB Function Blocks
Structure Definitions in Example
Bus Objects Define Structure Inputs and Outputs
How Structure Inputs and Outputs Interface with Bus Signals
Working with Virtual and Nonvirtual Buses
Rules for Defining Structures in MATLAB Function Blocks
Index Substructures and Fields
Create Structures in MATLAB Function Blocks
Use Nonvirtual Buses with MATLAB Function Blocks
Assign Values to Structures and Fields
Initialize a Matrix Using a Nontunable Structure Parameter
Define and Use Structure Parameters
Defining Structure Parameters
FIMATH Properties of Nontunable Structure Parameters
Limitations of Structures and Buses in MATLAB Function Blocks
Control Support for Variable-Size Arrays in a MATLAB Function Block
Declare Variable-Size Inputs and Outputs
Use a Variable-Size Signal in a Filtering Algorithm
About the Example
Simulink Model
Source Signal
MATLAB Function Block: uniquify
MATLAB Function Block: avg
Variable-Size Results
Control Memory Allocation for Variable-Size Arrays in a MATLAB Function Block
Provide Upper Bounds for Variable-Size Arrays
Disable Dynamic Memory Allocation for MATLAB Function Blocks
Modify the Dynamic Memory Allocation Threshold
Use Dynamic Memory Allocation for Variable-Size Arrays in a MATLAB Function Block
Create Model
Configure Model for Dynamic Memory Allocation
Simulate Model Using Dynamic Memory Allocation
Use Dynamic Memory Allocation for Bounded Arrays
Generate C Code That Uses Dynamic Memory Allocation
Code Generation for Enumerations
Define Enumerations for MATLAB Function Blocks
Allowed Operations on Enumerations
MATLAB Toolbox Functions That Support Enumerations
Add Enumerated Inputs, Outputs, and Parameters to a MATLAB Function Block
Use Enumerations to Control an LED Display
Simulink Model
Enumeration Class Definitions
MATLAB Function Block Function
Simulation
Share Data Globally
When Do You Need to Use Global Data?
Using Global Data with the MATLAB Function Block
Choosing How to Store Global Data
Storing Data Using Data Store Memory Blocks
Storing Data Using Simulink.Signal Objects
Using Data Store Diagnostics to Detect Memory Access Issues
Limitations of Using Shared Data in MATLAB Function Blocks
Initialize Persistent Variables in MATLAB Functions
MATLAB Function Block With No Direct Feedthrough
State Control Block in Synchronous Mode
Stateflow Chart Implementing Moore Semantics
Create Custom Block Libraries
When to Use MATLAB Function Block Libraries
How to Create Custom MATLAB Function Block Libraries
Example: Creating a Custom Signal Processing Filter Block Library
Code Reuse with Library Blocks
Debugging MATLAB Function Library Blocks
Properties You Can Specialize Across Instances of Library Blocks
Use Traceability in MATLAB Function Blocks
Extent of Traceability in MATLAB Function Blocks
Traceability Requirements
Tutorial: Using Traceability in a MATLAB Function Block
Include MATLAB Code as Comments in Generated Code
How to Include MATLAB Code as Comments in the Generated Code
Location of Comments in Generated Code
Including MATLAB user comments in Generated Code
Limitations of MATLAB Source Code as Comments
Integrate C Code Using the MATLAB Function Block
Call C Code from a Simulink Model
Use coder.ceval in a MATLAB Function Block
Control Imported Bus and Enumeration Type Definitions
Enhance Code Readability for MATLAB Function Blocks
Requirements for Using Readability Optimizations
Converting If-Elseif-Else Code to Switch-Case Statements
Example of Converting Code for If-Elseif-Else Decision Logic to Switch-Case Statements
Control Run-Time Checks
Types of Run-Time Checks
When to Disable Run-Time Checks
How to Disable Run-Time Checks
Track Object Using MATLAB Code
Learning Objectives
Tutorial Prerequisites
Example: The Kalman Filter
Files for the Tutorial
Tutorial Steps
Best Practices Used in This Tutorial
Key Points to Remember
Filter Audio Signal Using MATLAB Code
Learning Objectives
Tutorial Prerequisites
Example: The LMS Filter
Files for the Tutorial
Tutorial Steps
Interface with Row-Major Data in MATLAB Function Block
Row-Major Layout in Simulation and Code Generation
Array Layout Conversions
Array Layout and Algorithmic Efficiency
Row-Major Layout for N-Dimensional Arrays
Specify Array Layout in External Function Calls
Integration Considerations for MATLAB Function Blocks
Use Nondirect Feedthrough in a MATLAB Function Block
System Objects in Simulink
MATLAB System Block
Why Use the MATLAB System Block?
Choosing the Right Block Type
System Objects
Interpreted Execution or Code Generation
Default Input Signal Attributes
MATLAB System Block Limitations
MATLAB System and System Objects Examples
Implement a MATLAB System Block
Understanding the MATLAB System Block
Change Blocks Implemented with System Objects
Call Simulink Functions from MATLAB System Block
Create a Simulink Function Block
Create a MATLAB System Block and Define System Object
Call a Simulink Function in a Subsystem from a MATLAB System Block
Call Simulink Functions from a MATLAB System Block
Specify Sample Time for MATLAB System Block
Types of Sample Time for MATLAB System Block
Change Block Icon and Port Labels
Modify MATLAB System Block Dialog
Change the MATLAB System Block Icon to an Image
Nonvirtual Buses and MATLAB System Block
Use System Objects in Feedback Loops
Simulation Modes
Interpreted Execution vs. Code Generation
Simulation Using Code Generation
Mapping System Object Code to MATLAB System Block Dialog Box
System Object to Block Dialog Box Default Mapping
System Object to Block Dialog Box Custom Mapping
Considerations for Using System Objects in Simulink
Variable-Size Signals
Tunable Parameters
System Objects as Properties
Default Property Values
System Objects in For Each Subsystems
Input Validation
Simulink Engine Interaction with System Object Methods
Simulink Engine Phases Mapped to System Object Methods
Add and Implement Propagation Methods
When to Use Propagation Methods
Implement Propagation Methods
Share Data with Other Blocks
Data Sharing with the MATLAB System Block
Choose How to Store Shared Data
How to Use Data Store Memory Blocks for the MATLAB System Block
How to Set Up Simulink.Signal Objects
Using Data Store Diagnostics to Detect Memory Access Issues
Limitations of Using Shared Data in MATLAB System Blocks
Use Shared Data with P-Coded System Objects
Troubleshoot System Objects in Simulink
Class Not Found
Error Invoking Object Method
Performance
Customize MATLAB System Block Dialog
Break Algebraic Loops
Customize MATLAB System Block Appearance
Implement Algorithm with Tunable Parameters
Implement a Simple Algorithm
Specify Output Characteristics of MATLAB System Block
Implement Algorithm that Calls External C Code
Customize System Block Appearance
Specify Input and Output Names
Add Text to Block Icon
Add Image to Block Icon
Customize System Block Dialog Box
Define Block Dialog Tabs, Sections, and Order of Properties
Define Property Sections
Add Header Description
Control Simulation Type in MATLAB System Block
Add Custom Button to MATLAB System Block
Specify Output
Set Output Size
Set Fixed- or Variable-Size Output
Set Output Data Type
Set Output Complexity
Set Discrete State Output Specification
Set Model Reference Discrete Sample Time Inheritance
Use Update and Output for Nondirect Feedthrough
Enable For Each Subsystem Support
Define System Object for Use in Simulink
Develop System Object for Use in MATLAB System Block
Define Block Dialog Box for Plot Ramp
Use Global Variables in System Objects
System Object Global Variables in MATLAB
System Object Global Variables in Simulink
System Design in Simulink Using System Objects
System Design and Simulation in Simulink
Define New System Objects for Use in Simulink
Test New System Objects in MATLAB
Add System Objects to Your Simulink Model
Specify Sample Time for MATLAB System Block System Objects
Create Moving Average Filter Block with System Object
Manage and Create a Blockset Using Blockset Designer
Create a Blockset Project
Create a New Blockset Project
Create a Project from an Existing Blockset
Blockset Project File Structure
Create and Organize Block Artifacts
Add Tests to Blocks
Document the Blocks
S-Function Related Artifacts
Publish the Created Blockset
FMUs and Co-Simulation in Simulink
Import FMUs
FMU XML File Directives
Additional Support and Limitations
FMU Import Examples
Implement an FMU Block
Explore the FMU Block
Change Block Input, Output, and Parameter Structures
Timing Considerations
Troubleshooting FMUs
Export a Model as a Tool-Coupling FMU
Include Tunable Parameters for Tool-Coupling FMU
Use the Exported Tool-Coupling FMU
Co-Simulation Execution and Numerical Compensation
Execution Timing
Numerical Compensation
Run Co-Simulation Components on Multiple Cores
Using the MultithreadedSim Parameter
Configuring S-Function Blocks to Run Single or Multithreaded
Co-Simulation on Multiple Threads Limitations and Guidelines
Simulink Community and Connection Partner Program
Design Considerations for C/C++ Code Generation
When to Generate Code from MATLAB Algorithms
When Not to Generate Code from MATLAB Algorithms
Which Code Generation Feature to Use
Prerequisites for C/C++ Code Generation from MATLAB
MATLAB Code Design Considerations for Code Generation
See Also
Differences Between Generated Code and MATLAB Code
Functions that have Multiple Possible Outputs
Writing to ans Variable
Logical Short-Circuiting
Loop Index Overflow
Index of an Unentered for Loop
Character Size
Order of Evaluation in Expressions
Name Resolution While Constructing Function Handles
Termination Behavior
Size of Variable-Size N-D Arrays
Size of Empty Arrays
Size of Empty Array That Results from Deleting Elements of an Array
Binary Element-Wise Operations with Single and Double Operands
Floating-Point Numerical Results
NaN and Infinity
Negative Zero
Code Generation Target
MATLAB Class Property Initialization
MATLAB Classes in Nested Property Assignments That Have Set Methods
MATLAB Handle Class Destructors
Variable-Size Data
Complex Numbers
Converting Strings with Consecutive Unary Operators to double
MATLAB Language Features Supported for C/C++ Code Generation
MATLAB Features That Code Generation Supports
MATLAB Language Features That Code Generation Does Not Support
Functions, Classes, and System Objects Supported for Code Generation
Functions and Objects Supported for C/C++ Code Generation
System Objects Supported for Code Generation
Code Generation for System Objects
Defining MATLAB Variables for C/C++ Code Generation
Variables Definition for Code Generation
Best Practices for Defining Variables for C/C++ Code Generation
Define Variables By Assignment Before Using Them
Use Caution When Reassigning Variables
Use Type Cast Operators in Variable Definitions
Define Matrices Before Assigning Indexed Variables
Eliminate Redundant Copies of Variables in Generated Code
When Redundant Copies Occur
How to Eliminate Redundant Copies by Defining Uninitialized Variables
Defining Uninitialized Variables
Reassignment of Variable Properties
Reuse the Same Variable with Different Properties
When You Can Reuse the Same Variable with Different Properties
When You Cannot Reuse Variables
Limitations of Variable Reuse
Supported Variable Types
Defining Data for Code Generation
Data Definition for Code Generation
Code Generation for Complex Data
Restrictions When Defining Complex Variables
Code Generation for Complex Data with Zero-Valued Imaginary Parts
Results of Expressions That Have Complex Operands
Results of Complex Multiplication with Nonfinite Values
Encoding of Characters in Code Generation
Array Size Restrictions for Code Generation
Code Generation for Constants in Structures and Arrays
Code Generation for Strings
Limitations
Differences Between Generated Code and MATLAB Code
Code Generation for Sparse Matrices
Code Generation Guidelines
Code Generation Limitations
Specify Array Layout in Functions and Classes
Specify Array Layout in a Function
Query Array Layout of a Function
Specify Array Layout in a Class
Code Design for Row-Major Array Layout
Linear Indexing Uses Column-Major Array Layout
Code Generation for Variable-Size Data
Code Generation for Variable-Size Arrays
Memory Allocation for Variable-Size Arrays
Enabling and Disabling Support for Variable-Size Arrays
Variable-Size Arrays in a MATLAB Function Report
Specify Upper Bounds for Variable-Size Arrays
Specify Upper Bounds for MATLAB Function Block Inputs and Outputs
Specify Upper Bounds for Local Variables
Define Variable-Size Data for Code Generation
Use a Matrix Constructor with Nonconstant Dimensions
Assign Multiple Sizes to the Same Variable
Define Variable-Size Data Explicitly by Using coder.varsize
Diagnose and Fix Variable-Size Data Errors
Diagnosing and Fixing Size Mismatch Errors
Diagnosing and Fixing Errors in Detecting Upper Bounds
Incompatibilities with MATLAB in Variable-Size Support for Code Generation
Incompatibility with MATLAB for Scalar Expansion
Incompatibility with MATLAB in Determining Size of Variable-Size N-D Arrays
Incompatibility with MATLAB in Determining Size of Empty Arrays
Incompatibility with MATLAB in Determining Class of Empty Arrays
Incompatibility with MATLAB in Matrix-Matrix Indexing
Incompatibility with MATLAB in Vector-Vector Indexing
Incompatibility with MATLAB in Matrix Indexing Operations for Code Generation
Incompatibility with MATLAB in Concatenating Variable-Size Matrices
Differences When Curly-Brace Indexing of Variable-Size Cell Array Inside Concatenation Returns No Elements
Variable-Sizing Restrictions for Code Generation of Toolbox Functions
Common Restrictions
Toolbox Functions with Restrictions for Variable-Size Data
Code Generation for MATLAB Structures
Structure Definition for Code Generation
Structure Operations Allowed for Code Generation
Define Scalar Structures for Code Generation
Restrictions When Defining Scalar Structures by Assignment
Adding Fields in Consistent Order on Each Control Flow Path
Restriction on Adding New Fields After First Use
Define Arrays of Structures for Code Generation
Ensuring Consistency of Fields
Using repmat to Define an Array of Structures with Consistent Field Properties
Defining an Array of Structures by Using struct
Defining an Array of Structures Using Concatenation
Index Substructures and Fields
Assign Values to Structures and Fields
Pass Large Structures as Input Parameters
Code Generation for Cell Arrays
Code Generation for Cell Arrays
Homogeneous vs. Heterogeneous Cell Arrays
Controlling Whether a Cell Array Is Homogeneous or Heterogeneous
Cell Arrays in Reports
Control Whether a Cell Array Is Variable-Size
Cell Array Limitations for Code Generation
Cell Array Element Assignment
Variable-Size Cell Arrays
Definition of Variable-Size Cell Array by Using cell
Cell Array Indexing
Growing a Cell Array by Using {end + 1}
Cell Array Contents
Passing Cell Arrays to External C/C++ Functions
Use in MATLAB Function Block
Code Generation for Categorical Arrays
Code Generation for Categorical Arrays
Define Categorical Arrays for Code Generation
Allowed Operations on Categorical Arrays
MATLAB Toolbox Functions That Support Categorical Arrays
Define Categorical Array Inputs
Define Categorical Array Inputs at the Command Line
Categorical Array Limitations for Code Generation
Code Generation for Datetime Arrays
Code Generation for Datetime Arrays
Define Datetime Arrays for Code Generation
Allowed Operations on Datetime Arrays
MATLAB Toolbox Functions That Support Datetime Arrays
Define Datetime Array Inputs
Define Datetime Array Inputs at the Command Line
Datetime Array Limitations for Code Generation
Code Generation for Duration Arrays
Code Generation for Duration Arrays
Define Duration Arrays for Code Generation
Allowed Operations on Duration Arrays
MATLAB Toolbox Functions That Support Duration Arrays
Define Duration Array Inputs
Define Duration Array Inputs at the Command Line
Duration Array Limitations for Code Generation
Code Generation for Tables
Code Generation for Tables
Define Tables for Code Generation
Allowed Operations on Tables
MATLAB Toolbox Functions That Support Tables
Define Table Inputs
Define Table Inputs at the Command Line
Table Limitations for Code Generation
Code Generation for Timetables
Code Generation for Timetables
Define Timetables for Code Generation
Allowed Operations on Timetables
MATLAB Toolbox Functions That Support Timetables
Define Timetable Inputs
Define Timetable Inputs at the Command Line
Timetable Limitations for Code Generation
Code Generation for MATLAB Classes
MATLAB Classes Definition for Code Generation
Language Limitations
Code Generation Features Not Compatible with Classes
Defining Class Properties for Code Generation
Calls to Base Class Constructor
Inheritance from Built-In MATLAB Classes Not Supported
Classes That Support Code Generation
Generate Code for MATLAB Value Classes
Generate Code for MATLAB Handle Classes and System Objects
Code Generation for Handle Class Destructors
Guidelines and Restrictions
Behavioral Differences of Objects in Generated Code and in MATLAB
Class Does Not Have Property
Solution
Passing By Reference Not Supported for Some Properties
Handle Object Limitations for Code Generation
A Variable Outside a Loop Cannot Refer to a Handle Object Created Inside a Loop
A Handle Object That a Persistent Variable Refers To Must Be a Singleton Object
References to Handle Objects Can Appear Undefined
System Objects in MATLAB Code Generation
Usage Rules and Limitations for System Objects for Generating Code
System Objects in codegen
System Objects in the MATLAB Function Block
System Objects in the MATLAB System Block
System Objects and MATLAB Compiler Software
Code Generation for Function Handles
Function Handle Limitations for Code Generation
Defining Functions for Code Generation
Code Generation for Variable Length Argument Lists
Code Generation for Anonymous Functions
Anonymous Function Limitations for Code Generation
Code Generation for Nested Functions
Nested Function Limitations for Code Generation
Calling Functions for Code Generation
Resolution of Function Calls for Code Generation
Key Points About Resolving Function Calls
Compile Path Search Order
When to Use the Code Generation Path
Resolution of File Types on Code Generation Path
Compilation Directive %#codegen
Extrinsic Functions
Declaring MATLAB Functions as Extrinsic Functions
Calling MATLAB Functions Using feval
Extrinsic Declaration for Nonstatic Methods
Resolution of Extrinsic Functions During Simulation
Working with mxArrays
Restrictions on Extrinsic Functions for Code Generation
Limit on Function Arguments
Code Generation for Recursive Functions
Compile-Time Recursion
Run-Time Recursion
Disallow Recursion
Disable Run-Time Recursion
Recursive Function Limitations for Code Generation
Force Code Generator to Use Run-Time Recursion
Treat the Input to the Recursive Function as a Nonconstant
Make the Input to the Recursive Function Variable-Size
Assign Output Variable Before the Recursive Call
Avoid Duplicate Functions in Generated Code
Issue
Cause
Solution
Improve Run-Time Performance of MATLAB Function Block
Avoid Data Copies of Function Inputs in Generated Code
Inline Code
Unroll for-Loops
Force Loop Unrolling by Using coder.unroll
Generate Reusable Code
LAPACK Calls for Linear Algebra in a MATLAB Function Block
BLAS Calls for Matrix Operations in a MATLAB Function Block
FFTW calls for fast Fourier transform functions in a MATLAB Function Block
Troubleshooting MATLAB Code in MATLAB Function Blocks
Compile-Time Recursion Limit Reached
Issue
Cause
Solutions
Force Run-Time Recursion
Increase the Compile-Time Recursion Limit
Output Variable Must Be Assigned Before Run-Time Recursive Call
Issue
Cause
Solution
Unable to Determine That Every Element of Cell Array Is Assigned
Issue
Cause
Solution
Nonconstant Index into varargin or varargout in a for-Loop
Issue
Cause
Solution
Unknown Output Type for coder.ceval
Issue
Cause
Solution
Managing Data
Working with Data
About Data Types in Simulink
About Data Types
Data Typing Guidelines
Data Type Propagation
Data Types Supported by Simulink
Block Support for Data and Signal Types
Control Signal Data Types
Entering Valid Data Type Values
Use the Model Data Editor for Batch Editing
Share a Data Type Between Separate Algorithms, Data Paths, Models, and Bus Elements
Reuse Custom C Data Types for Signal Data
Determine Data Type of Signal That Uses Inherited Setting
Data Types Remain double Despite Changing Settings
Validate a Floating-Point Embedded Model
Apply a Data Type Override to Floating-Point Data Types
Validate a Single-Precision Model
Blocks That Support Single Precision
Fixed-Point Numbers
Binary Point Interpretation
Signed Fixed-Point Numbers
Benefits of Using Fixed-Point Hardware
Scaling, Precision, and Range
Scaling
Precision
Range
Fixed-Point Data in MATLAB and Simulink
Fixed-Point Data in Simulink
Fixed-Point Data in MATLAB
Scaled Doubles
Share Fixed-Point Models
Control Fixed-Point Instrumentation and Data Type Override
Control Instrumentation Settings
Control Data Type Override
Instrumentation Settings and Data Type Override for a Model Reference Hierarchy
Specify Fixed-Point Data Types
Overriding Fixed-Point Specifications
Specify Data Types Using Data Type Assistant
Specifying a Fixed-Point Data Type
Specify an Enumerated Data Type
Specify a Bus Object Data Type
Data Types for Bus Signals
Simulink Strings
Simulink Strings and Stateflow
String Constants
Simulink Strings and Null Characters
String Data Type
Strings in Bus Objects
Strings and Generated Code
String Data Type Conversions
Display and Extract Coordinate Data
Find Patterns in Strings
Extract a String
Get Text Following a Keyword
Change Existing Models to Use Strings
Parse NMEA GPS Text Message
Simulink String Limitations
Data Objects
Data Class Naming Conventions
Use Data Objects in Simulink Models
Data Object Properties
Create Data Objects from Built-In Data Class Package Simulink
Create Data Objects from Another Data Class Package
Create Data Objects Directly from Dialog Boxes
Create Data Objects for a Model Using Data Object Wizard
Create Data Objects from External Data Source Programmatically
Data Object Methods
Handle Versus Value Classes
Compare Data Objects
Resolve Conflicts in Configuration of Signal Objects for Code Generation
Create Persistent Data Objects
Simulink.Parameter Property Dialog Box
Simulink.DualScaledParameter Property Dialog Box
Main Attributes Tab
Calibration Attributes Tab
Simulink.AliasType Property Dialog Box
Simulink.NumericType Property Dialog Box
Use Simulink.Signal Objects to Specify and Control Signal Attributes
Using Signal Objects to Assign or Validate Signal Attributes
Validation
Multiple Signal Objects
Signal Specification Block: An Alternative to Simulink.Signal
Bus Support
Property Dialog Box
Define Data Classes
Determine Where to Store Variables and Objects for Simulink Models
Types of Data
Store Data for Your Design
Storage Locations
Create, Edit, and Manage Workspace Variables
Tools for Managing Variables
Edit Variable Value or Property From Block Parameter
Modify Structure and Array Variables Interactively
Ramifications of Modifying or Deleting a Variable
Analyze Variable Usage in a Model
Rename a Variable Throughout a Model
Interact With Variables Programmatically
Edit and Manage Workspace Variables by Using Model Explorer
Finding Variables That Are Used by a Model or Block
Finding Blocks That Use a Specific Variable
Finding Unused Workspace Variables
Editing Workspace Variables
Rename Variables
Compare Duplicate Workspace Variables
Export Workspace Variables
Importing Workspace Variables
Model Workspaces
Model Workspace Differences from MATLAB Workspace
Troubleshooting Memory Issues
Manipulate Model Workspace Programmatically
Specify Source for Data in Model Workspace
Data source
MAT-File and MATLAB File Source Controls
MATLAB Code Source Controls
Change Model Workspace Data
Change Workspace Data Whose Source Is the Model File
Change Workspace Data Whose Source Is a MAT-File or MATLAB File
Changing Workspace Data Whose Source Is MATLAB Code
Use MATLAB Commands to Change Workspace Data
Create Model Mask
Symbol Resolution
Symbols
Symbol Resolution Process
Numeric Values with Symbols
Other Values with Symbols
Limit Signal Resolution
Explicit and Implicit Symbol Resolution
Configure Data Properties by Using the Model Data Editor
Configure Distant Data Items
Select Multiple Data Items from Block Diagram
Interact with a Model That Uses Workspace Variables
Find and Organize Data by Filtering, Sorting, and Grouping
Inspect Individual Data Item
Navigate from Model Data Editor to Block Diagram
Columns in the Data Table
Two Entries Per Cell in the Data Table
Model Data Editor Limitations
Upgrade Level-1 Data Classes
Associating User Data with Blocks
Support Limitations for Simulink Software Features
Supported and Unsupported Simulink Blocks
Support Limitations for Stateflow Software Features
ml Namespace Operator, ml Function, ml Expressions
C or C++ Operators
C Math Functions
Atomic Subcharts That Call Exported Graphical Functions Outside a Subchart
Atomic Subchart Input and Output Mapping
Recursion and Cyclic Behavior
Custom C/C++ Code
Machine-Parented Data
Textual Functions with Literal String Arguments
Custom State Attributes in Discrete FIR Filter block
Open Model Data Editor
Build the Model and Inspect the Generated Code
Enumerations and Modeling
Simulink Enumerations
Simulink Constructs that Support Enumerations
Simulink Enumeration Limitations
Use Enumerated Data in Simulink Models
Define Simulink Enumerations
Simulate with Enumerations
Specify Enumerations as Data Types
Get Information About Enumerated Data Types
Enumeration Value Display
Instantiate Enumerations
Enumerated Values in Computation
Create Data to Use as Simulation Input
Create and Edit Signal Data
Differences Between the Root Inport Mapper Signal Editor and Other Signal Editors
Table Editing Data Support
Mouse, Keyboard, and Touchscreen Shortcuts
Change Signal Names and Hierarchy Orders
Create Signals with the Same Properties
Add and Edit Multidimensional Signals
Work with Data in Signals
Draw a Ramp Using Snap to Grid for Accuracy
Save and Send Changes to the Root Inport Mapper Tool
Use Scenarios and Insert Signals in Signal Editor
Use Scenarios to Group and Organize Inputs
Link in Signal Data from Signal Builder Block and Simulink Design Verifier Environment
Insert Signals
Add Signals to Scenarios
Work with Basic Signal Data
Create Signals and Signal Data
Work with Basic Signal Data with a Tabular Editor
Create Signals with MATLAB Expressions and Variables
Replace Signal Data with MATLAB Expressions
Create Freehand Signal Data Using Mouse or Multi-Touch Gestures
Import Custom File Type
Create Custom File Type for Import to Signal Editor
Define New FileType Object for Use in Simulink
Define FileType Object
Export Signals to Custom Registered File Types
Load Simulation Input Data
Provide Signal Data for Simulation
Identify Model Signal Data Requirements
Signal Data Storage for Loading
Load Input Signal Data
Log Output Signal Data
Load Big Data for Simulations
Stream Individual Signals Using SimulationDatastore Objects
Stream an Entire Dataset Using a DatasetRef Object
Load Individual Signals from a DatasetRef Object
Stream Data from a MAT-File as Input for a Parallel Simulation
Overview of Signal Loading Techniques
Source Blocks
Root-Level Input Ports
From File Block
From Spreadsheet Block
From Workspace Block
Signal Editor Block
Comparison of Signal Loading Techniques
Techniques
Impact of Loading Techniques on Block Diagrams
Comparison of Techniques
Load Data Logged In Another Simulation
Load Logged Data
Configure Logging to Meet Loading Requirements
Load Data to Model a Continuous Plant
Use Simulation Data to Model a Continuous Plant
Load Data to Test a Discrete Algorithm
Load Data for an Input Test Case
Guidelines for Importing a Test Case
Example of Test Case Data
Use From Workspace Block for Test Case
Use Signal Editor Block for Test Case
Load Data to Root-Level Input Ports
Specify Input Data
Forms of Input Data
Time Values for the Input Parameter
Data Loading
Loading Dataset Data to Root-Level Inputs
Loading MATLAB Timeseries Data to Root-Level Inputs
Loading MATLAB Timetable Data to Root-Level Inputs
Loading Data Structures to Root-Level Inputs
Loading Data Arrays to Root-Level Inputs
Loading MATLAB Time Expressions to Root Inports
Load Bus Data to Root-Level Input Ports
Imported Bus Data Requirements
Import Bus Data to a Top-Level Inport
Get Information About Bus Objects
Create Structures of Timeseries Objects from Buses
Import Array of Buses Data
Load Input Data for a Bus Using In Bus Element Blocks
Load Signal Data That Uses Units
Loading Bus Signals That Have Units
Load Data Using the From File Block
Data Loading
Sample Time
Simulation Time Hits Without Corresponding Time Data
Duplicate Timestamps
Detect Zero Crossings
Create Data for a From File Block
Load Data Using the From Workspace Block
Specify the Workspace Data
Use Data from a To File Block
Load Dataset Data
Specifying Variable-Size Signals
Store Data for Model Linked to Data Dictionary
Sample Time
Interpolate Missing Data Values
Specify Output After Final Data
Detect Zero Crossings
Load State Information
Import Initial States
Initialize a State
Initialize States in Referenced Models
Load Simulation Inputs Using the Root Inport Mapper
Map Data Using Root Inport Mapper Tool
The Model
Create Signal Data
Import and Visualize Workspace Signal Data
Map the Data to Inports
Save the Mapping and Data
Simulate the Model
Map Root Inport Signal Data
Open the Root Inport Mapper Tool
Command-Line Interface
Import and Mapping Workflow
Choose a Map Mode
Create Signal Data for Root Inport Mapping
Choose a Source for Data to Import and Map
Choose a Naming Convention for Signals and Buses
Choose a Base Workspace and MAT-File Format
Bus Signal Data for Root Inport Mapping
Create Signal Data in a MAT-File for Root Inport Mapping
Supported Microsoft Excel File Formats
Import Signal Data for Root Inport Mapping
Import Signal Data
Import Bus Data
Import Signal Data from Other Sources
Import Data from Signal Editor
Import Test Vectors from Simulink Design Verifier Environment
View and Inspect Signal Data
Map Signal Data to Root Input Ports
Select Map Mode
Set Options for Mapping
Select Data to Map
Map Data
Understand Mapping Results
Converting Harness-Driven Models to Use Harness-Free External Inputs
Alternative Workflows to Load Mapping Data
Preview Signal Data
Generate MATLAB Scripts for Simulation with Scenarios
Create and Use Custom Map Modes
Create Custom Mapping File Function
Root Inport Mapping Scenarios
Open Scenarios
Save Scenarios
Open Existing Scenarios
Work with Multiple Scenarios
Load Data with Interchangeable Scenarios
Load Data with Interchangeable Scenarios Using Signal Editor Block
Explore the Signal Editor Block
Replace Signal Builder Block with Signal Editor Block
Get Number of Scenarios and Signals
Importing and Exporting Simulation Data
Export Simulation Data
Simulation Data
Approaches for Exporting Signal Data
Enable Simulation Data Export
View Logged Data Using Simulation Data Inspector
Memory Performance
Data Format for Logged Simulation Data
Data Format for Block-Based Logged Data
Data Format for Model-Based Logged Data
Signal Logging Format
Logged Data Store Format
Time, State, and Output Data Format
Dataset Conversion for Logged Data
Why Convert to Dataset Format?
Results of Conversion
Dataset Conversion Limitations
Convert Logged Data to Dataset Format
Convert Workspace Data to Dataset
Convert Structure Without Time to Dataset
Programmatically Access Logged Dataset Format Data
Log Signal Data That Uses Units
Limit Amount of Exported Data
Decimation
Limit Data Points
Logging Intervals
Work with Big Data for Simulations
Big Data Workflow
Log Data to Persistent Storage
When to Log to Persistent Storage
Log to Persistent Storage
Enable Logging to Persistent Storage Programmatically
How Simulation Data Is Stored
Save Logged Data from Successive Simulations
Analyze Big Data from a Simulation
Create DatasetRef Objects to Access Logged Datasets
Use SimulationDatastore Objects to Access Signal Data
Create Timetables for MATLAB Analysis
Create Tall Timetables
Access Persistent Storage Metadata
Access Error Information
Samples to Export for Variable-Step Solvers
Output Options
Refine Output
Produce Additional Output
Produce Specified Output Only
Export Signal Data Using Signal Logging
Signal Logging
Signal Logging Workflow
Signal Logging in Rapid Accelerator Mode
Signal Logging Limitations
Configure a Signal for Logging
Mark a Signal for Logging
Specify Signal-Level Logging Name
Limit Data Logged
Set Sample Time for a Logged Signal
View the Signal Logging Configuration
Approaches for Viewing the Signal Logging Configuration
View Signal Logging Configuration Using the Simulink Editor
View Logging Configuration Using the Signal Logging Selector
View Signal Logging Configuration Using the Model Explorer
Programmatically Find Signals Configured for Logging
Enable Signal Logging for a Model
Enable and Disable Logging at the Model Level
Specify Format for Dataset Signal Elements
Specify a Name for Signal Logging Data
Override Signal Logging Settings
Benefits of Overriding Signal Logging Settings
Two Interfaces for Overriding Signal Logging Settings
Scope of Signal Logging Setting Overrides
Override Signal Logging Settings with Signal Logging Selector
Override Signal Logging Settings from MATLAB
View and Access Signal Logging Data
Signal Logging Object
Access Data Programmatically
Handling Spaces and Newlines in Logged Names
Access Logged Signal Data in ModelDataLogs Format
Log Signals in For Each Subsystems
Log Signal in Nested For Each Subsystem
Log Bus Signals in For Each Subsystem
State Information
Simulation State Information
Types of State Information
Format for State Information Saved Without Operating Point
State Information for Referenced Models
Save State Information
Save State Information for Each Simulation Step
Save Partial Final State Information
Examine State Information Saved Without the Operating Point
Save Final State Information with Operating Point
Working with Data Stores
Data Store Basics
When to Use a Data Store
Local and Global Data Stores
Data Store Diagnostics
Specify Initial Value for Data Store
Model Global Data by Creating Data Stores
Data Store Examples
Create and Apply Data Stores
Data Stores with Data Store Memory Blocks
Data Stores with Signal Objects
Access Data Stores with Simulink Blocks
Order Data Store Access
Data Stores with Buses and Arrays of Buses
Accessing Specific Bus and Matrix Elements
Rename Data Stores
Customized Data Store Access Functions in Generated Code
Log Data Stores
Logging Local and Global Data Store Values
Supported Data Types, Dimensions, and Complexity for Logging Data Stores
Data Store Logging Limitations
Logging Data Stores Created with a Data Store Memory Block
Logging Icon for the Data Store Memory Block
Logging Data Stores Created with a Simulink.Signal Object
Accessing Data Store Logging Data
Simulink Data Dictionary
What Is a Data Dictionary?
Dictionary Capabilities
Sections of a Dictionary
Dictionary Usage for Models Created with Different Versions of Simulink
Manage and Edit Entries in a Dictionary
Dictionary Referencing
Import and Export File Formats
Allow Access to Base Workspace
Migrate Models to Use Simulink Data Dictionary
Migrate Single Model to Use Dictionary
Migrate Model Reference Hierarchy to Use Dictionary
Considerations before Migrating to Data Dictionary
Continue to Use Shared Data in the Base Workspace
Migrate Complicated Model Hierarchy with Shared Data
Enumerations in Data Dictionary
Migrate Enumerated Types into Data Dictionary
Manipulate Enumerations in Data Dictionary
Remove Enumerated Types from Data Dictionary
Import and Export Dictionary Data
Import Data to Dictionary from File
Export Design Data from Dictionary
View and Revert Changes to Dictionary Data
View and Revert Changes to Dictionary Entries
View and Revert Changes to Entire Dictionary
Partition Dictionary Data Using Referenced Dictionaries
Partition Data for Model Reference Hierarchy Using Data Dictionaries
Create a Dictionary for Each Component
Strategies to Discover Shared Data
Store Data in Dictionary Programmatically
Add Entry to Design Data Section of Data Dictionary
Rename Data Dictionary Entry
Increment Value of Data Dictionary Entry
Data Dictionary Management
Dictionary Section Management
Dictionary Entry Manipulation
Transition to Using Data Dictionary
Programmatically Migrate Single Model to Use Dictionary
Import Directly From External File to Dictionary
Programmatically Partition Data Dictionary
Make Changes to Configuration Set Stored in Dictionary
Managing Signals
Working with Signals
Signal Basics
Signal Line Styles
Signal Properties
Store Design Attributes of Signals and States
Test Signals
Signal Types
Control Signals
Composite Signals
Virtual and Nonvirtual Signals
Investigate Signal Values
Initialize Signal Values
View Signal Values
Display Signal Values in Model Diagrams
Signal Data Types
Complex Signals
Exporting Signal Data
Signal Label Propagation
Blocks That Support Signal Label Propagation
How Simulink Propagates Signal Labels
Display Propagated Signal Labels
Special Cases of Signal Propagation
Determine Signal Dimensions
Simulink Blocks that Support Multidimensional Signals
Determine the Output Dimensions of Source Blocks
Determine the Output Dimensions of Nonsource Blocks
Signal and Parameter Dimension Rules
Scalar Expansion of Inputs and Parameters
Highlight Signal Sources and Destinations
Highlight Signal Source
Highlight Signal Destination
Choose the Path of a Trace
Trace a Signal To and From Subsystems
Show All Possible Paths of a Trace
Display Port Values Along a Trace
Remove Highlighting
Resolve Incomplete Highlighting to Library Blocks
Limitations
Specify Signal Ranges
Blocks That Allow Signal Range Specification
Work with Signal Ranges in Blocks
Troubleshoot Signal Range Errors
Unexpected Errors or Warnings for Data with Greater Precision or Range than double
Initialize Signals and Discrete States
Using Block Parameters to Initialize Signals and Discrete States
Use Signal Objects to Initialize Signals and Discrete States
Using Signal Objects to Tune Initial Values
Initialization Behavior Summary for Signal Objects
Configure Signals as Test Points
What Is a Test Point?
Displaying Test Point Indicators
Display Signal Attributes
Ports & Signals Menu
Port Data Types
Design Ranges
Signal Dimensions
Signal to Object Resolution Indicator
Wide Nonscalar Lines
Signal Groups
About Signal Groups
Using the Signal Builder Block with Fast Restart
Editing Signal Groups
Editing Signals
Creating Signal Group Sets Manually
Importing Signal Group Sets
Importing Data with Custom Formats
Editing Waveforms
Signal Builder Time Range
Exporting Signal Group Data
Simulating with Signal Groups
Simulation from Signal Builder Block
Using Composite Signals
Types of Composite Signals
Virtual Bus
Nonvirtual Bus
Concatenated Signal
Mux Signal
Group Signal Lines into Virtual Buses
Group Signal Lines Within a Component
Connect Multiple Output Signals to a Port
Combine Multiple Subsystem Ports into One Port
Modify Bus Hierarchy
Resolve Circular Dependencies in Buses
Create Nonvirtual Buses
Create Nonvirtual Buses with Bus Creator Blocks
Create Nonvirtual Bus Output for Referenced Models
Convert Virtual Bus to Nonvirtual Bus
Simplify Subsystem and Model Interfaces with Buses
Simplify Bus Interfaces in Subsystems
Combine Multiple Subsystem Ports into One Port
Display Bus Information
Display Bus Hierarchy
Display Value of Bus Elements
Programmatically Get Bus Hierarchy and Virtuality
Bus-Capable Blocks
Replace Values of Bus Elements
Update a Bus Element
Identify Automatic Bus Conversions
Bus-to-Vector Conversions
Virtual and Nonvirtual Bus Conversions
Modify Sample Times for Nonvirtual Buses
Specify Bus Properties with Simulink.Bus Objects
Bus Object Workflow
Determine Whether to Use Simulink.Bus Objects
Determine How to Manage Simulink.Bus Objects
Create and Specify Simulink.Bus Objects
Save Simulink.Bus Objects
Map Simulink.Bus Objects to Models
Create Bus Objects Programmatically
Create Bus Objects from Arrays
Create Bus Objects from Blocks
Create Bus Objects from MATLAB Data
Create Bus Objects from External C Code
Customize Bus Object Import and Export
Required Background Knowledge
Write a Bus Object Export Function
Write a Bus Object Import Function
Register Customizations
Change Customizations
Nonvirtual Buses at Model Interfaces
Model Reference Requirements for Nonvirtual Buses
Nonvirtual Buses with Root-Level Inport Blocks
Nonvirtual Buses with Root-Level Outport Blocks
Rate Transitions for Nonvirtual Buses
Specify Initial Conditions for Bus Signals
Blocks That Support Bus Signal Initialization
Set Diagnostics to Support Bus Initialization
Create Initial Condition Structures
Control Data Types of Structure Fields
Create Full Structures for Initialization
Create Partial Structures for Initialization
Initialize Bus Signals Using Block Parameters
Combine Buses into an Array of Buses
What Is an Array of Buses?
Benefits of an Array of Buses
Define an Array of Buses
Group Constant Signals into an Array of Buses
Use Arrays of Buses in Models
Array of Buses Requirements and Limitations
Signal Line Style
Work with Arrays of Buses
Set Up Model for Arrays of Buses
Perform Iterative Processing
Assign Values into an Array of Buses
Select Bus Elements from an Array of Buses
Import Array of Buses Data
Log Arrays of Buses
Initialize Arrays of Buses
Code Generation
Convert Models to Use Arrays of Buses
General Conversion Approach
Repeat an Algorithm Using a For Each Subsystem
Explore Example Model
Reduce Signal Line Density with Buses
Repeat an Algorithm
Organize Parameters into Arrays of Structures
Inspect the Converted Model
Examples of Working with For Each Subsystems
Temperature Control System Communicating with Messages
Share and Reuse Bus-Routing Blocks
Generate Code for Nonvirtual Buses
Control Data Types of Initial Condition Structure Fields
Limitations for Virtual Buses Crossing Model Reference Boundaries
Code Generation for Arrays of Buses
Inspect Generated Code for Nonvirtual Buses
Trace Connections Using Interface Display
How Interface Display Works
Trace Connections in a Subsystem
Working with Variable-Size Signals
Variable-Size Signal Basics
How Variable-Size Signals Propagate
Determine Whether Signal Line Has Variable Size
Empty Signals
Simulink Block Support for Variable-Size Signals
Variable-Size Signal Limitations
Inspect Variable-Size Signals on Simulink Models
Variable-Size Signal Generation and Operations
Variable-Size Signal Length Adaptation
Mode-Dependent Variable-Size Signals
S-Functions Using Variable-Size Signals
Customizing Simulink Environment and Printed Models
Customizing the Simulink User Interface
Access Frequently Used Features and Commands in Simulink
Search for Simulink Toolstrip Actions
Rerun Favorite Commands for Simulink
Add Items to Model Editor Menus
Code for Adding Menu Items
Define Menu Items
Register Menu Customizations
Callback Info Object
Debugging Custom Menu Callbacks
Menu Tags
Disable and Hide Model Editor Items
Example: Disable the New Model Command in the Simulink Toolstrip
Create a Filter Function
Register a Filter Function
Disable and Hide Dialog Box Controls
About Disabling and Hiding Controls
Disable a Button on a Dialog Box
Write Control Customization Callback Functions
Dialog Box Methods
Widget IDs
Register Control Customization Callback Functions
Customize Library Browser Appearance
Reorder Libraries
Disable and Hide Libraries
Expand or Collapse Library in Browser Tree
Improve Quick Block Insert Results
Registering Customizations
About Registering Customizations in Simulink
Reading and Refreshing the Customization File
Frames for Printed Models
Print Frames
What Are Print Frames?
PrintFrame Editor
Single Use or Multiple Use Print Frames
Text and Variable Content
Create a Print Frame
Add Rows and Cells to Print Frames
Add and Remove Rows
Add and Remove Cells
Resize Rows and Cells
Add Content to Print Frame Cells
Types of Content
Add Content to Cells
Block Diagram
Variables
Text
Format Content in Cells
Print Using Print Frames
Running Models on Target Hardware
About Run on Target Hardware Feature
Simulink Supported Hardware
Block Produces Zeros or Does Nothing in Simulation
Running Simulations in Fast Restart
How Fast Restart Improves Iterative Simulations
Limitations
Get Started with Fast Restart
Prepare a Model to Use Fast Restart
Fast Restart Methodology
Model Component Testing
Component Verification
Component Verification
Workflow for Component Verification
Test a Component in Isolation
Test a Model Block Included in a Larger Model
Run Polyspace Analysis on Generated Code by Using Packaged Options Files
Generate and Package Polyspace Options Files
Run Polyspace Analysis by Using the Packaged Options Files
Analyze Code Generated as Standalone Code in a Distributed Workflow
Simulation Testing Using Model Verification Blocks
Construct Simulation Tests by Using the Verification Manager
Use Model Verification Block to Check for Out-of-Bounds Signal
View Model Verification Blocks in Verification Manager
Manage Verification Blocks and Requirement Links
Enable and Disable Individual Model Verification Blocks
Enable and Disable Model Verification Blocks by Subsystem
Linear System Modeling Blocks in Simulink Control Design
Simulink® User's Guide R2020b
How to Contact MathWorks Latest news: Sales and services: User community: Technical support: Phone: www.mathworks.com www.mathworks.com/sales_and_services www.mathworks.com/matlabcentral www.mathworks.com/support/contact_us 508-647-7000 The MathWorks, Inc. 1 Apple Hill Drive Natick, MA 01760-2098 Simulink® User's Guide © COPYRIGHT 1990–2020 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, for, or through the federal government of the United States. By accepting delivery of the Program or Documentation, the government hereby agrees that this software or documentation qualifies as commercial computer software or commercial computer software documentation as such terms are used or defined in FAR 12.212, DFARS Part 227.72, and DFARS 252.227-7014. Accordingly, the terms and conditions of this Agreement and only those rights specified in this Agreement, shall pertain to and govern the use, modification, reproduction, release, performance, display, and disclosure of the Program and Documentation by the federal government (or other entity acquiring for or through the federal government) and shall supersede any conflicting contractual terms or conditions. If this License fails to meet the government's needs or is inconsistent in any respect with federal procurement law, the government agrees to return the Program and Documentation, unused, to The MathWorks, Inc. Trademarks MATLAB and Simulink are registered trademarks of The MathWorks, Inc. See www.mathworks.com/trademarks for a list of additional trademarks. Other product or brand names may be trademarks or registered trademarks of their respective holders. Patents MathWorks products are protected by one or more U.S. patents. Please see www.mathworks.com/patents for more information.
Revision History November 1990 December 1996 January 1999 November 2000 July 2002 April 2003 April 2004 June 2004 October 2004 March 2005 September 2005 March 2006 March 2006 September 2006 March 2007 September 2007 March 2008 October 2008 March 2009 September 2009 March 2010 September 2010 April 2011 September 2011 March 2012 September 2012 March 2013 September 2013 March 2014 October 2014 March 2015 September 2015 October 2015 March 2016 September 2016 March 2017 September 2017 March 2018 September 2018 March 2019 September 2019 March 2020 September 2020 First printing Second printing Third printing Fourth printing Fifth printing Online only Online only Sixth printing Seventh printing Online only Eighth printing Online only Ninth printing Online only Online only Online only Online only Online only Online only Online only Online only Online only Online only Online only Online only Online only Online only Online only Online only Online only Online only Online only Online only Online only Online only Online only Online only Online only Online only Online only Online only Online only Online only New for Simulink 1 Revised for Simulink 2 Revised for Simulink 3 (Release 11) Revised for Simulink 4 (Release 12) Revised for Simulink 5 (Release 13) Revised for Simulink 5.1 (Release 13SP1) Revised for Simulink 5.1.1 (Release 13SP1+) Revised for Simulink 5.0 (Release 14) Revised for Simulink 6.1 (Release 14SP1) Revised for Simulink 6.2 (Release 14SP2) Revised for Simulink 6.3 (Release 14SP3) Revised for Simulink 6.4 (Release 2006a) Revised for Simulink 6.4 (Release 2006a) Revised for Simulink 6.5 (Release 2006b) Revised for Simulink 6.6 (Release 2007a) Revised for Simulink 7.0 (Release 2007b) Revised for Simulink 7.1 (Release 2008a) Revised for Simulink 7.2 (Release 2008b) Revised for Simulink 7.3 (Release 2009a) Revised for Simulink 7.4 (Release 2009b) Revised for Simulink 7.5 (Release 2010a) Revised for Simulink 7.6 (Release 2010b) Revised for Simulink 7.7 (Release 2011a) Revised for Simulink 7.8 (Release 2011b) Revised for Simulink 7.9 (Release 2012a) Revised for Simulink 8.0 (Release 2012b) Revised for Simulink 8.1 (Release 2013a) Revised for Simulink 8.2 (Release 2013b) Revised for Simulink 8.3 (Release 2014a) Revised for Simulink 8.4 (Release 2014b) Revised for Simulink 8.5 (Release 2015a) Revised for Simulink 8.6 (Release 2015b) Rereleased for Simulink 8.5.1 (Release 2015aSP1) Revised for Simulink 8.7 (Release 2016a) Revised for Simulink 8.8 (Release 2016b) Revised for Simulink 8.9 (Release 2017a) Revised for Simulink 9.0 (Release 2017b) Revised for Simulink 9.1 (Release 2018a) Revised for Simulink 9.2 (Release 2018b) Revised for Simulink 9.3 (Release 2019a) Revised for Simulink 10.0 (Release 2019b) Revised for Simulink 10.1 (Release 2020a) Revised for Simulink 10.2 (Release 2020b)
Contents Simulink Basics Introduction to Simulink 1 Programmatic Modeling Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Load a Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Create a Model and Specify Parameter Settings . . . . . . . . . . . . . . . . Programmatically Load Variables When Opening a Model . . . . . . . . . Programmatically Add and Connect Blocks . . . . . . . . . . . . . . . . . . . . Name a Signal Programmatically . . . . . . . . . . . . . . . . . . . . . . . . . . . Arrange Model Layouts Automatically . . . . . . . . . . . . . . . . . . . . . . . . Open the Same Model in Multiple Windows . . . . . . . . . . . . . . . . . . . Locate Diagram Elements Using Highlighting . . . . . . . . . . . . . . . . . . Specify Colors Programmatically . . . . . . . . . . . . . . . . . . . . . . . . . . . Simulink Identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Build and Edit a Model Interactively . . . . . . . . . . . . . . . . . . . . . . . . . . Create a Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Use Customized Settings When Creating New Models . . . . . . . . . . . Open a Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Load Variables When Opening a Model . . . . . . . . . . . . . . . . . . . . . . Open a Model with Different Character Encoding . . . . . . . . . . . . . . Simulink Model File Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Add Blocks and Set Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Add Blocks to the Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Align and Connect Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Set Block Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Extend the Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Add More Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Branch a Connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Organize Your Model Into Components . . . . . . . . . . . . . . . . . . . . . . Simulate the Model and View Results . . . . . . . . . . . . . . . . . . . . . . . . Edit and Simulate the Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Save the Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . How to Tell If a Model Needs Saving . . . . . . . . . . . . . . . . . . . . . . . . Save a Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . What Happens When You Save a Model? . . . . . . . . . . . . . . . . . . . . . 1-2 1-2 1-2 1-3 1-3 1-5 1-5 1-5 1-6 1-6 1-7 1-8 1-8 1-9 1-10 1-11 1-11 1-12 1-13 1-13 1-13 1-14 1-16 1-16 1-16 1-19 1-22 1-24 1-27 1-27 1-27 1-28 v
Save Models in the SLX File Format . . . . . . . . . . . . . . . . . . . . . . . . Save Models with Different Character Encodings . . . . . . . . . . . . . . Export a Model to a Previous Simulink Version . . . . . . . . . . . . . . . . Save from One Earlier Simulink Version to Another . . . . . . . . . . . . Preview Content of Model Components . . . . . . . . . . . . . . . . . . . . . . . Bookmark Parts of Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . What Are Viewmarks? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Create a Viewmark . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Open and Navigate Viewmarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . Manage Viewmarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Refresh a Viewmark . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Update Diagram and Run Simulation . . . . . . . . . . . . . . . . . . . . . . . . Updating the Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Simulation Updates the Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . Update Diagram While Editing . . . . . . . . . . . . . . . . . . . . . . . . . . . . Simulate a Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Print Model Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Print Interactively or Programmatically . . . . . . . . . . . . . . . . . . . . . Printing Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Canvas Color . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Basic Printing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Print the vdp Model Using Default Settings . . . . . . . . . . . . . . . . . . Print a Subsystem Hierarchy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Select the Systems to Print . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Print Current System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Print Subsystems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Print a Model Referencing Hierarchy . . . . . . . . . . . . . . . . . . . . . . . Specify the Page Layout and Print Job . . . . . . . . . . . . . . . . . . . . . . . . Page and Print Job Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Set Paper Size and Orientation Without Printing . . . . . . . . . . . . . . . Tiled Printing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Print Multiple Pages for Large Models . . . . . . . . . . . . . . . . . . . . . . . Add a Log of Printed Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Add a Sample Time Legend . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Print from the MATLAB Command Line . . . . . . . . . . . . . . . . . . . . . . Printing Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Print Systems with Multiline Names or Names with Spaces . . . . . . Set Paper Orientation and Type . . . . . . . . . . . . . . . . . . . . . . . . . . . Position and Size a System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Use Tiled Printing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Print to a PDF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-28 1-30 1-31 1-31 1-33 1-35 1-35 1-36 1-36 1-37 1-37 1-38 1-38 1-38 1-38 1-39 1-40 1-40 1-40 1-40 1-42 1-42 1-43 1-45 1-45 1-45 1-46 1-47 1-47 1-47 1-48 1-49 1-50 1-51 1-52 1-52 1-54 1-54 1-54 1-55 1-57 vi Contents
Print Model Reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Model Report Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Print Models to Image File Formats . . . . . . . . . . . . . . . . . . . . . . . . . Copy Model Views to Third-Party Applications . . . . . . . . . . . . . . . . Keyboard Shortcuts and Mouse Actions for Simulink Modeling . . . Perform File and Clipboard Operations . . . . . . . . . . . . . . . . . . . . . . Zoom, Scroll, and Change Current Window . . . . . . . . . . . . . . . . . . . Navigate Model Hierarchy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Modify Block Diagram Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . Select Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Modify Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Name Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Modify Block Diagram Appearance . . . . . . . . . . . . . . . . . . . . . . . . . Perform Actions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Update, Simulate, and Generate Code for Models . . . . . . . . . . . . . . Debug Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-58 1-58 1-60 1-60 1-61 1-61 1-61 1-62 1-62 1-63 1-63 1-64 1-65 1-65 1-66 1-66 2 Simulation Stepping How Simulation Stepper Helps With Model Analysis . . . . . . . . . . . . . How Stepping Through a Simulation Works . . . . . . . . . . . . . . . . . . . . Simulation Snapshots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . How Simulation Stepper Uses Snapshots . . . . . . . . . . . . . . . . . . . . . How Simulation Stepper Differs from Simulink Debugger . . . . . . . . . Use Simulation Stepper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Simulation Stepper Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Simulation Stepper Pause Status . . . . . . . . . . . . . . . . . . . . . . . . . . . Tune Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Referenced Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Simulation Stepper and Interval Logging . . . . . . . . . . . . . . . . . . . . . Simulation Stepper and Stateflow Debugger . . . . . . . . . . . . . . . . . . . Simulation Stepper Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Model Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Step Through a Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Step Forward and Back . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Set Conditional Breakpoints for Stepping a Simulation . . . . . . . . . Add and Edit Conditional Breakpoints . . . . . . . . . . . . . . . . . . . . . . . Observe Conditional Breakpoint Values . . . . . . . . . . . . . . . . . . . . . . Simulation Pacing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Use Simulation Pacing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Use Simulation Pacing with Dashboard Blocks . . . . . . . . . . . . . . . . 2-2 2-3 2-3 2-3 2-5 2-7 2-7 2-7 2-8 2-8 2-8 2-8 2-10 2-10 2-10 2-10 2-12 2-12 2-14 2-14 2-15 2-17 2-17 2-18 vii
Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-19 3 How Simulink Works Simulation Phases in Dynamic Systems . . . . . . . . . . . . . . . . . . . . . . . Model Compilation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Link Phase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Simulation Loop Phase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Compare Solvers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fixed-Step Versus Variable-Step Solvers . . . . . . . . . . . . . . . . . . . . . . Continuous Versus Discrete Solvers . . . . . . . . . . . . . . . . . . . . . . . . . Explicit Versus Implicit Continuous Solvers . . . . . . . . . . . . . . . . . . . . One-Step Versus Multistep Continuous Solvers . . . . . . . . . . . . . . . . . Single-Order Versus Variable-Order Continuous Solvers . . . . . . . . . . Zero-Crossing Detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Demonstrating Effects of Excessive Zero-Crossing Detection . . . . . Preventing Excessive Zero Crossings . . . . . . . . . . . . . . . . . . . . . . . How the Simulator Can Miss Zero-Crossing Events . . . . . . . . . . . . . Zero-Crossing Detection in Blocks . . . . . . . . . . . . . . . . . . . . . . . . . Zero-Crossing Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Signal Threshold for Adaptive Zero-Crossing Detection . . . . . . . . . . Algebraic Loop Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Mathematical Interpretation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Physical Interpretation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Artificial Algebraic Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . How the Algebraic Loop Solver Works . . . . . . . . . . . . . . . . . . . . . . Implications of Algebraic Loops in a Model . . . . . . . . . . . . . . . . . . . Identify Algebraic Loops in Your Model . . . . . . . . . . . . . . . . . . . . . . . Highlight Algebraic Loops in the Model . . . . . . . . . . . . . . . . . . . . . Use the Algebraic Loop Diagnostic . . . . . . . . . . . . . . . . . . . . . . . . . Remove Algebraic Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduce a Delay to Remove Algebraic Loops . . . . . . . . . . . . . . . . Solve Algebraic Loops Manually . . . . . . . . . . . . . . . . . . . . . . . . . . . How Simulink Eliminates Artificial Algebraic Loops . . . . . . . . . . . . Eliminate Artificial Algebraic Loops Caused by Atomic Subsystems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Bundled Signals That Create Artificial Algebraic Loops . . . . . . . . . . Model and Block Parameters to Diagnose and Eliminate Artificial Algebraic Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Block Reduction and Artificial Algebraic Loops . . . . . . . . . . . . . . . . When Simulink Cannot Eliminate Artificial Algebraic Loops . . . . . . Modeling Considerations with Algebraic Loops . . . . . . . . . . . . . . . . Managing Large Models with Artificial Algebraic Loops . . . . . . . . . Model Blocks and Direct Feedthrough . . . . . . . . . . . . . . . . . . . . . . 3-2 3-2 3-2 3-3 3-6 3-6 3-7 3-8 3-8 3-9 3-10 3-10 3-18 3-19 3-22 3-25 3-25 3-27 3-27 3-28 3-29 3-30 3-31 3-33 3-34 3-34 3-36 3-36 3-38 3-38 3-43 3-44 3-47 3-47 3-49 3-52 3-52 3-52 viii Contents
分享到:
收藏