Main Content

创建 MATLAB S-Function

使用 2 级 MATLAB® S-Function 创建自定义模块

MATLAB S-Function API 使用户能够使用 MATLAB 语言创建自定义模块,这些模块能够处理多个输入和输出端口以及 Simulink® 模型生成的信号,包括任何数据类型的矩阵和帧信号。

模块

S-Function在模型中包含 S-Function

方法

全部展开

setupSpecify the number of inputs, outputs, states, parameters, and other characteristics of the MATLAB S-function
OutputsCompute the signals that this MATLAB S-function block emits
Terminate执行仿真终止时所需的所有操作
CheckParametersCheck the validity of a MATLAB S-Function's parameters
DerivativesCompute a MATLAB S-Function's derivatives
DisableRespond to disabling of an enabled system containing this MATLAB S-Function block
EnableRespond to enabling of an enabled system containing this MATLAB S-Function block
GetOperatingPointReturn operating point for MATLAB S-function as MATLAB data structure
InitializeConditionsInitialize the state vectors of this MATLAB S-function
PostPropagationSetupSpecify the sizes of the work vectors and create the run-time parameters required by this MATLAB S-function
ProcessParametersProcess the MATLAB S-function's parameters
ProjectionPerturb the solver's solution of a system's states to better satisfy time-invariant solution relationships
SetAllowConstantSampleTimeSpecify sample time behavior and tunability for S-function blocks with port-based sample times
SetInputPortComplexSignalSet the numeric types (real, complex, or inherited) of the signals accepted by an input port
SetInputPortDataTypeSet the data types of the signals accepted by an input port
SetInputPortDimensionsSet the dimensions of the signals accepted by an input port
SetInputPortDimensionsModePropagate the dimensions mode
SetInputPortSampleTimeSet the sample time of an input port that inherits its sample time from the port to which it is connected
SetOutputPortComplexSignalSet the numeric types (real, complex, or inherited) of the signals accepted by an output port
SetOutputPortDataTypeSet the data type of the signals emitted by an output port
SetOutputPortDimensionsSet the dimensions of the signals accepted by an output port
SetOutputPortSampleTimeSet the sample time of an output port that inherits its sample time from the port to which it is connected
SetOperatingPointRestore operating point of MATLAB S-function
SimStatusChangeRespond to a pause or resumption of the simulation of the model that contains this MATLAB S-function
StartInitialize the state vectors of this MATLAB S-function
UpdateUpdate a block's states
WriteRTWGenerate code generation data for the MATLAB S-function

Simulink.MSFcnRunTimeBlock获取有关 2 级 MATLAB S-Function 模块的运行时信息
Simulink.RunTimeBlock允许 2 级 MATLAB S-Function 和其他 MATLAB 程序在仿真运行时获取有关模块的信息
Simulink.BlockDataProvide runtime information about block-related data, such as block parameters
Simulink.BlockPortDataDescribe block input or output port
Simulink.BlockCompDworkDataProvide post-compilation information about block DWork vector
Simulink.BlockCompInputPortDataProvide post-compilation information about block input port
Simulink.BlockCompOutputPortDataProvide post-compilation information about block output port
Simulink.BlockPreCompInputPortDataProvide precompilation information about block input port
Simulink.BlockPreCompOutputPortDataProvide precompilation information about block output port

主题