Why do my results of the sensitivity analysis performed in the SimBiology GUI differ from those from the command line in SimBiology 4.3 (R2013a)?

1 view (last 30 days)
If I calculate the sensitivity in the SimBiology GUI the result differs from the result of
% set the outputs
set(csObj.SensitivityAnalysisOptions, 'Outputs',[s1 s2 s3]);
% set the inputs
set(csObj.SensitivityAnalysisOptions,'Inputs', [k1 k2 k3]);
% Set Normalization
set(csObj.SensitivityAnalysisOptions,'Normalization','Full');
% Enable Sensitivity
set(csObj.SolverOptions, 'SensitivityAnalysis',true);
% accelerate
sbioaccelerate(m);
% Simulate
simDataObj = sbiosimulate(m);
% Get the data
[T, R, snames, ifacs] = getsensmatrix(simDataObj);

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 15 May 2013
The results between the GUI based calculation and your calculation in the command line differ because of a difference in the algorithm. Your command line version calculates the sum of sensitivity across time while in the GUI version the area under the curve is used. Thus if you replace your sum with the area under the curve the results will be the same.
A little more background information:
The Solver computes the sensitivity of each output with respect to each input at all the time points that it steps through. So In the raw form sensitivity is a 3 dimensional matrix(time x n_Output x n_Input). This is the Matrix that GETSENSMATRIX returns. If you want to create a time plot (time against sensitivity) you can use it as is. But if you want to create a bar chart to answer the question, to which input factor is an output most sensitive to, then you need to sum up the trajectory in some fashion to come up with one number for each output/input pair. We do this by numerically integrating the sensitivity trajectory in time:
[t, R, states, inputs] = getsensmatrix(tobj, x, y);
[~, in, out] = size(R);
result = zeros(in, out);
for i = 1:in
for j = 1:out
index = ~isnan(R(:,i,j)) & ~isinf(R(:,i,j));
result(i,j) = trapz(t(index), abs(R(index,i,j)));
end
end

More Answers (0)

Categories

Find more on Perform Sensitivity Analysis in Help Center and File Exchange

Products


Release

R2013a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!