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