You can specify a substitute linearization
for a block or subsystem in your Simulink model
using a custom function on the MATLAB path.
Your custom linearization function must have one BlockData
input
argument, which is a structure that the software creates and passes
to the function. BlockData
has the following fields:
Field | Description |
---|
BlockName | Name of the block for which you are specifying a custom linearization. |
Parameters | Block parameter values, specified as a structure array with Name and Value fields. Parameters contains
the names and values of the parameters you specify in the blocksub.Value.ParameterNames and blocksub.Value.ParameterValues fields. |
Inputs |
Input signals to the block for which you are defining a linearization,
specified as a structure array with one structure for each block input.
Each structure in Inputs has the following
fields:
Field | Description |
---|
BlockName | Full block path of the block whose output connects to
the corresponding block input. | PortIndex | Output port of the block specified by
BlockName that connects to the
corresponding block input. | Values | Value of the signal specified by
BlockName and
PortIndex . If this signal is a
vector signal, then Values is a
vector with the same dimension. |
|
ny | Number of output channels of the block linearization. |
nu | Number of input channels of the block linearization. |
BlockLinearization | Current default linearization of the block, specified as a
state-space model. You can specify a block linearization that depends
on the default linearization using BlockLinearization . |
Your custom function must return a model with nu
inputs
and ny
outputs. This model must be one of the following:
Linear model in the form of a D-matrix
Control System Toolbox LTI model object
Uncertain state-space model or uncertain real object
(requires Robust Control Toolbox software)
For example, the following function multiplies the current default block linearization, by a
delay of Td = 0.5
seconds. The delay is represented by a Thiran filter
with sample time Ts = 0.1
. The delay and sample time are parameters
stored in BlockData
.
Save this function to a location on the MATLAB path.
To use this function as a custom linearization for a block or subsystem, specify the
blocksub.Value.Specification
and
blocksub.Value.Type
fields.
To set the delay and sample time parameter values, specify the blocksub.Value.ParameterNames
and blocksub.Value.ParameterValues
fields.