Added the option to save the Confidence Interval of the obtained loading rate for each scan point.

This commit is contained in:
Karthik 2021-07-11 06:34:51 +02:00
parent 5f97d975de
commit e17015d181

View File

@ -1,5 +1,5 @@
function [LoadingRateArray, StandardErrorArray] = doTwoParameterScan(this, FirstParameterName, FirstParameterArray, ...
SecondParameterName, SecondParameterArray, varargin)
function [LoadingRateArray, StandardErrorArray, ConfidenceIntervalArray] = doTwoParameterScan(this, FirstParameterName, FirstParameterArray, ...
SecondParameterName, SecondParameterArray, varargin)
p = inputParser;
p.KeepUnmatched = true;
@ -38,6 +38,7 @@ function [LoadingRateArray, StandardErrorArray] = doTwoParameterScan(this, First
NumberOfPointsForSecondParam = length(SecondParameterArray);
LoadingRateArray = zeros(NumberOfPointsForFirstParam, NumberOfPointsForSecondParam);
StandardErrorArray = zeros(NumberOfPointsForFirstParam, NumberOfPointsForSecondParam);
ConfidenceIntervalArray = zeros(NumberOfPointsForFirstParam, NumberOfPointsForSecondParam, 2);
for i=1:NumberOfPointsForFirstParam
eval(sprintf('OptionsStruct.%s = %d;', FirstParameterName, FirstParameterArray(i)));
@ -58,9 +59,11 @@ function [LoadingRateArray, StandardErrorArray] = doTwoParameterScan(this, First
options = Helper.convertstruct2cell(OptionsStruct);
this.setInitialConditions(options{:});
tic
[LoadingRate, StandardError] = this.runSimulation();
LoadingRateArray(i,j) = LoadingRate;
StandardErrorArray(i,j) = StandardError;
[LoadingRate, StandardError, ConfidenceInterval] = this.runSimulation();
LoadingRateArray(i, j) = LoadingRate;
StandardErrorArray(i, j) = StandardError;
ConfidenceIntervalArray(i, j, 1) = ConfidenceInterval(1);
ConfidenceIntervalArray(i, j, 2) = ConfidenceInterval(2);
end
end
@ -68,6 +71,7 @@ function [LoadingRateArray, StandardErrorArray] = doTwoParameterScan(this, First
LoadingRate = struct;
LoadingRate.Values = LoadingRateArray;
LoadingRate.Errors = StandardErrorArray;
LoadingRate.CI = ConfidenceIntervalArray;
this.Results = LoadingRate;
SaveFolder = [this.SaveDirectory filesep 'Results'];
Filename = ['TwoParameterScan_' datestr(now,'yyyymmdd_HHMM')];