Main Content

运行单个仿真

直接从 Simulink® 编辑器运行和控制各个仿真,或者从 MATLAB® 命令提示符以编程方式运行和控制各个仿真

仿真模型可让您获得通过建模过程编译的算法的结果。您可以通过调整仿真速度、调整模型参数、停止或暂停仿真以及显示端口值来与仿真进行交互,以评估模型的设计。仿真可帮助您了解模型的设计和行为。

通过点击 Simulink 工具条中的运行按钮,或以编程方式使用 MATLAB 命令行窗口中的 simset_param 等函数或 MATLAB 脚本,以交互方式仿真模型。

有关运行并行和批量仿真的信息,请参阅运行多个仿真

模型设置

全部展开

输入使用顶层输入端口加载仿真的外部输入数据的选项
初始状态Option to specify initial model state or operating point for simulation
最终状态Option to log final state values
保存最终工作点Option to save complete model operating point when simulation is paused or stopped
来自不同版本的工作点对象Diagnostic behavior when loading initial operating point generated in different release
工作点还原接口校验和不匹配Diagnostic behavior when interface checksum does not match between initial operating point and model

工具

仿真调速选项Slow simulation to a specified ratio of simulation time to wall clock time

函数

全部展开

simSimulink 模型的运行和脚本化编程仿真
set_param设置 Simulink 参数值
get_param获取参数名称和值
slsim.allowedModelChangesDetermine changes you can make to model based on simulation status (自 R2022b 起)
initializeInitialize simulation represented by Simulation object (自 R2024a 起)
pausePause active simulation represented by Simulation object (自 R2024a 起)
resumeContinue paused simulation represented by Simulation object (自 R2024a 起)
setBlockParameterSet block parameter values for simulation using SimulationInput or Simulation object
setModelParameterSet model parameter values for simulation using SimulationInput or Simulation object
setExternalInputSpecify external input data for top-level input ports using SimulationInput or Simulation object
setInitialStateSpecify initial state for simulation using SimulationInput or Simulation object
setPostSimFcn Set MATLAB function to run after each simulation
setPreSimFcnSpecify MATLAB function to run before start of each simulation on Simulink.SimulationInput object
setVariable使用 SimulationInputSimulation 对象为仿真设置变量值
setVariantConfigurationSet variant configuration for simulation using SimulationInput object (自 R2024a 起)
getVariantConfigurationGet name of variant configuration from SimulationInput object (自 R2024a 起)
startStart simulation represented by Simulation object (自 R2024a 起)
stepAdvance simulation represented by Simulation object by specified amount (自 R2024a 起)
stopStop simulation represented by Simulation object (自 R2024a 起)
terminateTerminate simulation represented by Simulation object (自 R2024a 起)
Simulink.BlockDiagram.getInitialStateGet initial state data from block diagram
get Get operating point information for Stateflow chart, MATLAB System block, or S-function
setSet operating point information for Stateflow chart, MATLAB System block, or S-function
find查询和访问 Simulink.SimulationOutput 对象的属性
get访问 Simulink.SimulationOutput 对象中的仿真结果
getSimulationMetadataAccess simulation metadata in Simulink.SimulationOutput object
removePropertyRemove property from Simulink.SimulationOutput object
setUserDataAdd data to metadata in Simulink.SimulationOutput object
setUserStringAdd string to metadata in Simulink.SimulationOutput object
whoGet names of editable properties on Simulink.SimulationOutput object

对象

全部展开

SimulationControl simulation execution and tune variable, block parameter, and model parameter values (自 R2024a 起)
Simulink.SimulationInput创建 Simulink.SimulationInput 对象以对多个或单个仿真的模型进行更改
Simulink.op.ModelOperatingPointComplete information that represents model operating point in simulation
Simulink.SimulationOutput访问仿真输出和元数据
Simulink.SimulationMetadataAccess metadata of simulation runs

主题

运行基本仿真

分析仿真

利用快速重启执行迭代仿真