getSensitivity
Sensitivity function at specified point using slLinearizer or slTuner interface
Syntax
Description
returns the sensitivity function
at the specified analysis point for the model associated with the
linsys = getSensitivity(s,pt)slLinearizer or slTuner interface,
s.
The software enforces all the permanent openings
specified for s when it calculates
linsys. If you configured either
s.Parameters, or s.OperatingPoints, or
both, getSensitivity performs multiple linearizations and
returns an array of sensitivity functions.
considers additional, temporary, openings at the point specified by
linsys = getSensitivity(s,pt,temp_opening)temp_opening. Use an opening, for example, to calculate
the sensitivity function of an inner loop, with the outer loop open.
returns a subset of the batch linearization results.
linsys = getSensitivity(___,mdl_index)mdl_index specifies the index of the linearizations of
interest, in addition to any of the input arguments in previous syntaxes.
Use this syntax for efficient linearization, when you want to obtain the sensitivity function for only a subset of the batch linearization results.
Examples
For the ex_scd_simple_fdbk model, obtain the sensitivity at the plant input, u.
Open the ex_scd_simple_fdbk model.
mdl = 'ex_scd_simple_fdbk';
open_system(mdl);

In this model:

Create an slLinearizer interface for the model.
sllin = slLinearizer(mdl);
To obtain the sensitivity at the plant input, u, add u as an analysis point to sllin.
addPoint(sllin,'u');
Obtain the sensitivity at the plant input, u.
sys = getSensitivity(sllin,'u');
tf(sys)
ans = From input "u" to output "u": s + 5 ----- s + 8 Continuous-time transfer function.
The software uses a linearization input, du, and linearization output u to compute sys.

sys is the transfer function from du to u, which is equal to
.
For the scdcascade model, obtain the inner-loop sensitivity at the output of G2, with the outer loop open.
Open the scdcascade model.
mdl = 'scdcascade';
open_system(mdl)

Create an slLinearizer interface for the model.
sllin = slLinearizer(mdl);
To calculate the sensitivity at the output of G2, use the y2 signal as the analysis point. To eliminate the effects of the outer loop, break the outer loop at y1m. Add both these points to sllin.
addPoint(sllin,{'y2','y1m'});
Obtain the sensitivity at y2 with the outer loop open.
sys = getSensitivity(sllin,'y2','y1m');
Here, 'y1m', the third input argument, specifies a temporary opening of the outer loop.
Suppose you batch linearize the scdcascade model for multiple transfer functions. For most linearizations, you vary the proportional (Kp2) and integral gain (Ki2) of the C2 controller in the 10% range. For this example, obtain the sensitivity at the output of G2, with the outer loop open, for the maximum values of Kp2 and Ki2.
Open the scdcascade model.
mdl = 'scdcascade';
open_system(mdl)

Create an slLinearizer interface for the model.
sllin = slLinearizer(mdl);
Vary the proportional (Kp2) and integral gain (Ki2) of the C2 controller in the 10% range.
Kp2_range = linspace(0.9*Kp2,1.1*Kp2,3); Ki2_range = linspace(0.9*Ki2,1.1*Ki2,5); [Kp2_grid,Ki2_grid] = ndgrid(Kp2_range,Ki2_range); params(1).Name = 'Kp2'; params(1).Value = Kp2_grid; params(2).Name = 'Ki2'; params(2).Value = Ki2_grid; sllin.Parameters = params;
To calculate the sensitivity at the output of G2, use the y2 signal as the analysis point. To eliminate the effects of the outer loop, break the outer loop at y1m. Add both these points to sllin as analysis points.
addPoint(sllin,{'y2','y1m'});
Determine the index for the maximum values of Ki2 and Kp2.
mdl_index = params(1).Value == max(Kp2_range) & params(2).Value == max(Ki2_range);
Obtain the sensitivity at the output of G2 for the specified parameter combination.
sys = getSensitivity(sllin,'y2','y1m',mdl_index);
Open Simulink® model.
mdl = 'watertank';
open_system(mdl)

Create a linearization option set, and set the StoreOffsets option.
opt = linearizeOptions('StoreOffsets',true);
Create slLinearizer interface.
sllin = slLinearizer(mdl,opt);
Add an analysis point at the tank output port.
addPoint(sllin,'watertank/Water-Tank System');
Calculate the sensitivity function at the analysis point, and obtain the corresponding linearization offsets.
[sys,info] = getSensitivity(sllin,'watertank/Water-Tank System');
View offsets.
info.Offsets
ans =
struct with fields:
dx: [2×1 double]
x: [2×1 double]
u: 1
y: 2
OutputName: {'watertank/Water-Tank System'}
InputName: {'watertank/Water-Tank System'}
StateName: {2×1 cell}
Ts: 0
Input Arguments
Interface to a Simulink model, specified as either an slLinearizer interface or an slTuner interface.
Analysis point signal name, specified as:
Character vector or string — Analysis point signal name.
To determine the signal name associated with an analysis point, type
s. The software displays the contents ofsin the MATLAB® command window, including the analysis point signal names, block names, and port numbers. Suppose that an analysis point does not have a signal name, but only a block name and port number. You can specifyptas the block name. To use a point not in the list of analysis points fors, first add the point usingaddPoint.You can specify
ptas a uniquely matching portion of the full signal name or block name. Suppose that the full signal name of an analysis point is'LoadTorque'. You can specifyptas'Torque'as long as'Torque'is not a portion of the signal name for any other analysis point ofs.For example,
pt = 'y1m'.Cell array of character vectors or string array — Specifies multiple analysis point names. For example,
pt = {'y1m','y2m'}.
To calculate linsys, the software adds a linearization input, followed by
a linearization output at pt.
Consider the following model:

Specify pt as 'u':

The software computes linsys as the transfer function from
du to u.
If you specify pt as multiple signals,
for example pt = {'u','y'}, the software adds a
linearization input, followed by a linearization output at each point.

du and dy are linearization inputs, and,
u and y are linearization outputs.
The software computes linsys as a MIMO transfer
function with a transfer function from each linearization input to each
linearization output.
Temporary opening signal name, specified as:
Character vector or string — Analysis point signal name.
temp_openingmust specify an analysis point that is in the list of analysis points fors. To determine the signal name associated with an analysis point, types. The software displays the contents ofsin the MATLAB command window, including the analysis point signal names, block names, and port numbers. Suppose that an analysis point does not have a signal name, but only a block name and port number. You can specifytemp_openingas the block name. To use a point not in the list of analysis points fors, first add the point usingaddPoint.You can specify
temp_openingas a uniquely matching portion of the full signal name or block name. Suppose that the full signal name of an analysis point is'LoadTorque'. You can specifytemp_openingas'Torque'as long as'Torque'is not a portion of the signal name for any other analysis point ofs.For example,
temp_opening = 'y1m'.Cell array of character vectors or string array — Specifies multiple analysis point names. For example,
temp_opening = {'y1m','y2m'}.
Index for linearizations of interest, specified as:
Array of logical values — Logical array index of linearizations of interest. Suppose that you vary two parameters,
par1andpar2, and want to extract the linearization for the combination ofpar1 > 0.5andpar2 <= 5. Use:params = s.Parameters; mdl_index = params(1).Value>0.5 & params(2).Value <= 5;
The expression
params(1).Value>0.5 & params(2).Value<5uses logical indexing and returns a logical array. This logical array is the same size asparams(1).Valueandparams(2).Value. Each entry contains the logical evaluation of the expression for corresponding entries inparams(1).Valueandparams(2).Value.Vector of positive integers — Linear index of linearizations of interest. Suppose that you vary two parameters,
par1andpar2, and want to extract the linearization for the combination ofpar1 > 0.5andpar2 <= 5. Use:params = s.Parameters; mdl_index = find(params(1).Value>0.5 & params(2).Value <= 5);
The expression
params(1).Value>0.5 & params(2).Value<5returns a logical array.findreturns the linear index of every true entry in the logical array
Output Arguments
Sensitivity function, returned as described in the following:
If you did not configure
s.Parametersands.OperatingPoints, the software calculateslinsysusing the default model parameter values. The software uses the model initial conditions as the linearization operating point.linsysis returned as a state-space model.If you configured
s.Parametersonly, the software computes a linearization for each parameter grid point.linsysis returned as a state-space model array of the same size as the parameter grid.If you configured
s.OperatingPointsonly, the software computes a linearization for each specified operating point.linsysis returned as a state-space model array of the same size ass.OperatingPoints.If you configured
s.Parametersand specifieds.OperatingPointsas a single operating point, the software computes a linearization for each parameter grid point. The software uses the specified operating point as the linearization operating point.linsysis returned as a state-space model array of the same size as the parameter grid.If you configured
s.Parametersand specifieds.OperatingPointsas multiple operating point objects, the software computes a linearization for each parameter grid point. The software requires thats.OperatingPointsis the same size as the parameter grid specified bys.Parameters. The software computes each linearization using corresponding operating points and parameter grid points.linsysis returned as a state-space model array of the same size as the parameter grid.If you configured
s.Parametersand specifieds.OperatingPointsas multiple simulation snapshot times, the software simulates and linearizes the model for each snapshot time and parameter grid point combination. Suppose that you specify a parameter grid of sizepandNsnapshot times.linsysis returned as a state-space model array of sizeN-by-p.
For most models, linsys is returned as an ss object or an array of
ss objects. However, if your model contains one of
the following blocks in the linearization path defined by
pt, then linsys returns the
specified type of state-space model.
| Block | linsys Type |
|---|---|
Block with a substitution specified as a
genss object or tunable model
object | genss |
Block with a substitution specified as an uncertain
model, such as uss | uss (Robust Control Toolbox) |
| Sparse Second Order block | mechss |
| Descriptor State-Space block configured to linearize to a sparse model | sparss |
Linearization information, returned as a structure with the following fields:
Linearization offsets, returned as [] if
s.Options.StoreOffsets is false.
Otherwise, Offsets is returned as one of the
following:
If
linsysis a single state-space model, thenOffsetsis a structure.If
linsysis an array of state-space models, thenOffsetsis a structure array with the same dimensions aslinsys.
Each offset structure has the following fields:
| Field | Description |
|---|---|
x | State offsets used for linearization, returned as a column vector of length
nx, where
nx is the number of states in
linsys. |
y | Output offsets used for linearization, returned as a column vector of length
ny, where
ny is the number of outputs in
linsys. |
u | Input offsets used for linearization, returned as a column vector of length
nu, where
nu is the number of inputs in
linsys. |
dx | Derivative offsets for continuous time systems or updated state values for discrete-time systems, returned as a column vector of length nx. |
StateName | State names, returned as a cell array that contains
nx elements that match the names
in linsys.StateName. |
InputName | Input names, returned as a cell array that contains
nu elements that match the names
in linsys.InputName. |
OutputName | Output names, returned as a cell array that contains
ny elements that match the names
in linsys.OutputName. |
Ts | Sample time of the linearized system, returned as a scalar that matches the sample time in
linsys.Ts. For continuous-time systems,
Ts is 0. |
If Offsets is a structure array, you can
configure an LPV System block using
the offsets. To do so, first convert them to the required format using getOffsetsForLPV. For an example, see Approximate Nonlinear Behavior Using Array of LTI Systems.
Linearization diagnostic information, returned as [] if
s.Options.StoreAdvisor is false.
Otherwise, Advisor is returned as one of the
following:
If
linsysis a single state-space model,Advisoris aLinearizationAdvisorobject.If
linsysis an array of state-space models,Advisoris an array ofLinearizationAdvisorobjects with the same dimensions aslinsys.
LinearizationAdvisor objects store linearization
diagnostic information for individual linearized blocks. For an example of
troubleshooting linearization results using a
LinearizationAdvisor object, see Troubleshoot Linearization Results at Command Line.
More About
The sensitivity function,
also referred to simply as sensitivity, measures
how sensitive a signal is to an added disturbance. Sensitivity is
a closed-loop measure. Feedback reduces the sensitivity in the frequency
band where the open-loop gain is greater than 1.
To compute the sensitivity at an analysis point, x,
the software injects a disturbance signal, dx,
at the point. Then, the software computes the transfer function from dx to x,
which is equal to the sensitivity function at x.
| Analysis Point in Simulink Model | How getSensitivity Interprets
Analysis Point | Sensitivity Function |
|---|---|---|
|
|
| Transfer function from |
For example, consider the following model where you compute
the sensitivity function at u:

Here, the software injects a disturbance signal (du)
at u. The sensitivity at u, Su,
is the transfer function from du to u.
The software calculates Su as
follows:
Here, I is an identity matrix of the same size as KG.
Similarly, to compute the sensitivity at y,
the software injects a disturbance signal (dy)
at y. The software computes the sensitivity function
as the transfer function from dy to y.
This transfer function is equal to (I+GK)-1,
where I is an identity matrix of the same size
as GK.
The software does not modify the Simulink model when it computes the sensitivity transfer function.
Analysis points, used
by the slLinearizer and slTuner interfaces,
identify locations within a model that are relevant for linear analysis
and control system tuning. You use analysis points as inputs to the
linearization commands, such as getIOTransfer, getLoopTransfer, getSensitivity, and getCompSensitivity. As inputs to the
linearization commands, analysis points can specify any open-loop
or closed-loop transfer function in a model. You can also use analysis
points to specify design requirements when tuning control systems
using commands such as systune.
Location refers to a specific block output port within a model or to a bus element in such an output port. For convenience, you can use the name of the signal that originates from this port to refer to an analysis point.
You can add analysis points to an slLinearizer or slTuner interface, s,
when you create the interface. For example:
s = slLinearizer('scdcascade',{'u1','y1'});
Alternatively, you can use the addPoint command.
To view all the analysis points of s, type s at
the command prompt to display the interface contents. For each analysis
point of s, the display includes the block name
and port number and the name of the signal that originates at this
point. You can also programmatically obtain a list of all the analysis
points using getPoints.
For more information about how you can use analysis points, see Mark Signals of Interest for Control System Analysis and Design and Mark Signals of Interest for Batch Linearization.
Permanent openings,
used by the slLinearizer and slTuner interfaces,
identify locations within a model where the software breaks the signal
flow. The software enforces these openings for linearization and tuning.
Use permanent openings to isolate a specific model component. Suppose
that you have a large-scale model capturing aircraft dynamics and
you want to perform linear analysis on the airframe only. You can
use permanent openings to exclude all other components of the model.
Another example is when you have cascaded loops within your model
and you want to analyze a specific loop.
Location refers to a specific block output port within a model. For convenience, you can use the name of the signal that originates from this port to refer to an opening.
You can add permanent openings to an slLinearizer or slTuner interface, s,
when you create the interface or by using the addOpening command. To remove a location
from the list of permanent openings, use the removeOpening command.
To view all the openings of s, type s at
the command prompt to display the interface contents. For each permanent
opening of s, the display includes the block name
and port number and the name of the signal that originates at this
location. You can also programmatically obtain a list of all the permanent
loop openings using getOpenings.
Version History
Introduced in R2013bYou can linearize and obtain a sparse model from a Simulink model that contains a Sparse Second Order or Descriptor State-Space block.
mechssmodel when you use a Sparse Second Order in your Simulink model.sparssmodel when you use a Descriptor State-Space block and select the Linearize to sparse model block parameter.
For more information, see Sparse Model Basics. For an example, see Linearize Simulink Model to a Sparse Second-Order Model Object.
You can compute operating point offsets for model inputs, outputs, states, and state derivatives when linearizing Simulink models. Thee offsets streamline the creation of linear parameter-varying (LPV) systems.
To obtain operating point offsets, first create a linearizeOptions or slTunerOptions object and set the
StoreOffsets option to true. Then,
create an slLinearizer or slTuner interface for the
model.
You can extract the offsets from the info output argument of
getSensitivity and convert them into the required format
for the LPV System block using the getOffsetsForLPV function.
See Also
slLinearizer | slTuner | addPoint | addOpening | getIOTransfer | getLoopTransfer | getCompSensitivity
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)

