Calculating Senstivities with SimBiology GUI and from 'sbiosimuate' - How do I deal with NaNs and Infs
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi
I am trying to replicate the results of Sensitivity Analysis I get from Simbiology GUI in my script file. The code is written below:
% 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);
The Sensitivity matrix I get ('R') has NaNs and Infs in it, so I convert them to zero and sum across the time axis.
R(isnan(R)) = 0;
R(isinf(R)) = 0;
R = abs(R);
R1 = sum(R,1); % Sum across time
R1 = squeeze(R1); % size of R1 now is states * parameters
And compare the results with the plot obtained from GUI
[Value, Index] = sort(R1(1,:),'descend')
I see that my results are different from those in the GUI, both in terms of values of Sensitivity and order of sensitive parameter.
Can anyone help as to what I am doing wrong here in the normalization of 'R' matrix?
Thanks S N
댓글 수: 0
채택된 답변
Ingrid Tigges
2013년 3월 21일
The results between the GUI based calculation and your calculation in the command line differ because of a difference in the calculation. 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®; 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
추가 답변 (0개)
커뮤니티
더 많은 답변 보기: SimBiology Community
참고 항목
카테고리
Help Center 및 File Exchange에서 Perform Sensitivity Analysis에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!