52 lines
2.6 KiB
Matlab
52 lines
2.6 KiB
Matlab
function LoadingRateArray = doTwoParameterScan(this, FirstParameterName, FirstParameterArray, ...
|
|
SecondParameterName, SecondParameterArray, varargin)
|
|
|
|
p = inputParser;
|
|
p.KeepUnmatched = true;
|
|
|
|
addRequired(p, 'ClassObject' , @isobject);
|
|
addRequired(p, 'FirstParameterName' , @ischar);
|
|
addRequired(p, 'FirstParameterArray' , @isvector);
|
|
addRequired(p, 'SecondParameterName' , @ischar);
|
|
addRequired(p, 'SecondParameterArray', @isvector);
|
|
|
|
addParameter(p, 'ChangeRelatedParameter', false, @islogical);
|
|
addParameter(p, 'Order', 1, @(x) assert(isnumeric(x) && isscalar(x) && (x > 0) && (x < 3)));
|
|
addParameter(p, 'RelatedParameterName', 'none', @ischar);
|
|
addParameter(p, 'RelatedParameterArray', length(FirstParameterArray), @isvector);
|
|
|
|
|
|
p.parse(this, FirstParameterName, FirstParameterArray, ...
|
|
SecondParameterName, SecondParameterArray, varargin{:})
|
|
|
|
FirstParameterName = p.Results.FirstParameterName;
|
|
FirstParameterArray = p.Results.FirstParameterArray;
|
|
SecondParameterName = p.Results.SecondParameterName;
|
|
SecondParameterArray = p.Results.SecondParameterArray;
|
|
ChangeRelatedParameter = p.Results.ChangeRelatedParameter;
|
|
Order = p.Results.Order;
|
|
RelatedParameterName = p.Results.RelatedParameterName;
|
|
RelatedParameterArray = p.Results.RelatedParameterArray;
|
|
|
|
NumberOfPointsForFirstParam = length(FirstParameterArray);
|
|
NumberOfPointsForSecondParam = length(SecondParameterArray);
|
|
|
|
for i=1:NumberOfPointsForFirstParam
|
|
eval(sprintf('OptionsStruct.%s = %d;', FirstParameterName, FirstParameterArray(i)));
|
|
if ChangeRelatedParameter && Order == 1
|
|
eval(sprintf('OptionsStruct.%s = %d;', RelatedParameterName, RelatedParameterArray(i)));
|
|
end
|
|
|
|
for j=1:NumberOfPointsForSecondParam
|
|
eval(sprintf('OptionsStruct.%s = %d;', SecondParameterName, SecondParameterArray(j)));
|
|
if ChangeRelatedParameter && Order == 2
|
|
eval(sprintf('OptionsStruct.%s = %d;', RelatedParameterName, RelatedParameterArray(j)));
|
|
end
|
|
options = Helper.convertstruct2cell(OptionsStruct);
|
|
this.setInitialConditions(options{:});
|
|
tic
|
|
[LoadingRate, ~] = this.runSimulation();
|
|
LoadingRateArray(i,j) = LoadingRate;
|
|
end
|
|
end
|
|
end |