Main Content

find

Find blocks in linearization results that match specific criteria

Description

When you linearize a Simulink® model, you can create a LinearizationAdvisor object that contains diagnostic information about individual block linearizations. To find block linearizations that satisfy specific criteria, you can use the find function with custom query objects. Alternatively, you can analyze linearization diagnostics using the Linearization Advisor in the Model Linearizer. For more information on finding specific blocks in linearization results, see Find Blocks in Linearization Results Matching Specific Criteria.

result = find(advisor,query) returns the subset of block diagnostics in advisor that match the search criteria specified in query.

example

Examples

collapse all

Load Simulink model.

mdl = 'scdspeed';
load_system(mdl)

Linearize the model and obtain LinearizationAdvisor object.

opts = linearizeOptions('StoreAdvisor',true);
io(1) = linio('scdspeed/throttle (degrees)',1,'input');
io(2) = linio('scdspeed/rad//s to rpm',1,'output');
[sys,~,info] = linearize(mdl,io,opts);
advisor = info.Advisor;

Create a query object for finding blocks on the linearization path.

query = linqueryIsOnPath;

Find blocks using query object.

advOnPath = find(advisor,query)
advOnPath = 
  LinearizationAdvisor with properties:

               Model: 'scdspeed'
      OperatingPoint: [1x1 opcond.OperatingPoint]
    BlockDiagnostics: [1x26 linearize.advisor.BlockDiagnostic]
           QueryType: 'On Linearization Path'

Load the Simulink model.

mdl = 'scdspeed';
load_system(mdl)

Linearize the model and obtain the LinearizationAdvisor object.

opts = linearizeOptions('StoreAdvisor',true);
io(1) = linio('scdspeed/throttle (degrees)',1,'input');
io(2) = linio('scdspeed/rad//s to rpm',1,'output');
[sys,op,info] = linearize(mdl,io,opts);
advisor = info.Advisor;

Create compound query object for finding all blocks with one input and one output.

qSISO = linqueryHasInputs(1) & linqueryHasOutputs(1);

Find all SISO blocks using compound query object.

advSISO = find(advisor,qSISO)
advSISO = 
  LinearizationAdvisor with properties:

               Model: 'scdspeed'
      OperatingPoint: [1x1 opcond.OperatingPoint]
    BlockDiagnostics: [1x10 linearize.advisor.BlockDiagnostic]
           QueryType: '(Has 1 Inputs & Has 1 Outputs)'

Input Arguments

collapse all

Diagnostic information for block linearizations, specified as a LinearizationAdvisor object or an array of LinearizationAdvisor objects.

Search criteria, specified as one of the following query objects or a logical combination of query objects (CompoundQuery object).

Query ObjectFind Blocks That...
linqueryAdviseAre potentially problematic for linearization.
linqueryAllBlocksAre in the advisor object.
linqueryContributesToLinearizationNumerically contribute to the model linearization result.
linqueryHasDiagnosticsHave diagnostic messages regarding their linearization.
linqueryHasInputsHave a specified number of inputs.
linqueryHasOrderHave a specified number of states.
linqueryHasOutputsHave a specified number of outputs.
linqueryHasSampleTimeHave a specified sample time.
linqueryHasZeroIOPairHave at least one input/output pair that linearizes to zero.
linqueryIsBlockSubstitutedHave a custom block linearization specified.
linqueryIsBlockTypeAre of a specified type.
linqueryIsExactAre linearized using their defined exact linearization.
linqueryIsNumericallyPerturbedAre linearized using numerical perturbation.
linqueryIsOnPathAre on the linearization path.
linqueryIsZeroLinearize to zero.

To create a compound query, combine these queries using AND (&), OR (|), and NOT (~) logical operations. For example, to find all blocks on the linearization path that do not contribute to the model linearization result, use:

compundQuery = linqueryIsOnPath & ~linqueryContributesToLinearization

Output Arguments

collapse all

Diagnostic information for blocks that match the search criteria specified in query, returned as:

  • LinearizationAdvisor object if advisor is a single LinearizationAdvisor object.

  • A LinearizationAdvisor object with the same dimensions as advisor if advisor is an array.

Version History

Introduced in R2017b