getsensmatrix (SimData)

Get 3-D sensitivity matrix from SimData array

Syntax

[T, R, Outputs, InputFactors] = getsensmatrix(simDataObj)
[T, R, Outputs, InputFactors] = getsensmatrix(simDataObj,OutputNames,InputFactorNames)

Arguments

TT is an m-by-1 array specifying time points for the sensitivity data in R.
RR is an m-by-n-by-p array of sensitivity data with times, outputs, and input factors corresponding to its first, second, and third dimensions respectively.

R(:,i,j) is the time course for the sensitivity of state Outputs{i} to the input factor InputFactors{j}.

OutputsName of the output factors, where output factors are the names of the states for which you want to calculate sensitivity.
InputFactorsName of the input factors, where input factors are the names of the states with respect to which you want to calculate sensitivity.

Description

[T, R, Outputs, InputFactors] = getsensmatrix(simDataObj) gets time and sensitivity data from the SimData object (simDataObj).

When simDataObj contains more than one element, the output arguments are cell arrays in which each cell contains data for the corresponding element of simDataObj.

The getsensmatrix method can only return sensitivity data that is contained in the SimData object. The sensitivity data that is logged in a SimData object is set at simulation time by the configuration set used during the simulation. This is typically the model's active configuration set. For an explanation of how to set up a sensitivity calculation using the configuration set, see "Sensitivity Analysis". Note in particular that the sensitivity data R returned by getsensmatrix may be normalized, as specified at simulation time.

[T, R, Outputs, InputFactors] = getsensmatrix(simDataObj,OutputNames,InputFactorNames) gets sensitivity data for the outputs specified by OutputNames and the input factors specified by InputFactorNames.

OutputNames and InputFactorNames can both be any one of the following:

  • Empty array

  • Single name

  • Cell array of names

Pass an empty array for OutputNames or InputFactorNames to ask for sensitivity data on all output factors or input factors contained in simDataObj, respectively. You can also use qualified names such as 'CompartmentName.SpeciesName' or 'ReactionName.ParameterName' to resolve ambiguities.

Examples

This example shows how to retrieve sensitivity data from a SimData object.

  1. Set up the simulation:

    1. Import the radio decay model from SimBiology® examples.

      modelObj  = sbmlimport('radiodecay');
    2. Retrieve the configuration settings and the sensitivity analysis options from the modelObj.

      configsetObj = getconfigset(modelObj);
      sensitivityObj = get(configsetObj, 'SensitivityAnalysisOptions');
    3. Specify the species for which you want sensitivity data in the Outputs property. All model species are selected in this example. Use the sbioselect function to retrieve the species objects from the model.

      allSpeciesObj = sbioselect(modelObj, 'Type', 'species');
      set(sensitivityObj, 'Outputs', allSpeciesObj);
    4. Specify species and parameters with respect to which you want to calculate the sensitivities in the Inputs property.

      speciesObj = sbioselect(modelObj,'Type', 'species', 'Name', 'z');
      parameterObj = sbioselect(modelObj, 'Type', 'parameter', 'Name', 'c');
      set(configsetObj.SensitivityAnalysisOptions,'Inputs', [speciesObj, parameterObj]);
      
    5. Enable SensitivityAnalysis.

      set(configsetObj.SolverOptions, 'SensitivityAnalysis', true)
      get(configsetObj.SolverOptions, 'SensitivityAnalysis')
      
      ans =
      
        1
    6. Simulate and return the results in a SimData object.

      simDataObj = sbiosimulate(modelObj)
  2. Extract and plot sensitivity data from the SimData object.

    1. Use getsensmatrix to retrieve sensitivity data.

      [t R outs ifacs] = getsensmatrix(simDataObj);
    2. Plot sensitivity values.

      plot(t, R(:,:,2));
      legend(outs);
      title(['Sensitivities of species relative to ' ifacs{2}]);
      

See Also

display, get, getdata, resample, selectbyname

MATLAB® function struct

Was this topic helpful?