From e17015d18143332263d9c0a2216a8c3cc2f7379f Mon Sep 17 00:00:00 2001 From: Karthik Chandrashekara Date: Sun, 11 Jul 2021 06:34:51 +0200 Subject: [PATCH] Added the option to save the Confidence Interval of the obtained loading rate for each scan point. --- .../@MOTSimulator/doTwoParameterScan.m | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/MOT Capture Process Simulation/@MOTSimulator/doTwoParameterScan.m b/MOT Capture Process Simulation/@MOTSimulator/doTwoParameterScan.m index a074cf0..a930592 100644 --- a/MOT Capture Process Simulation/@MOTSimulator/doTwoParameterScan.m +++ b/MOT Capture Process Simulation/@MOTSimulator/doTwoParameterScan.m @@ -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')];