2021-07-04 20:24:38 +02:00
|
|
|
function plotResultForOneParameterScan(XParameter, YQuantity, varargin)
|
|
|
|
|
|
|
|
p = inputParser;
|
|
|
|
p.KeepUnmatched = true;
|
|
|
|
|
|
|
|
addRequired(p, 'ParameterArray', @isvector)
|
|
|
|
addRequired(p, 'QuantityOfInterestArray', @ismatrix)
|
|
|
|
|
|
|
|
addParameter(p, 'RescalingFactorForParameter', 1, @isscalar)
|
|
|
|
addParameter(p, 'XLabelString', 'X parameter', @ischar)
|
|
|
|
addParameter(p, 'ErrorsForYQuantity', false, @islogical)
|
|
|
|
addParameter(p, 'ErrorsArray', [], @isvector)
|
2021-07-11 06:05:24 +02:00
|
|
|
addParameter(p, 'CIForYQuantity', false, @islogical)
|
|
|
|
addParameter(p, 'CIArray', [], @ismatrix)
|
2021-07-04 20:24:38 +02:00
|
|
|
addParameter(p, 'RescalingFactorForYQuantity', 1, @isscalar)
|
2021-07-11 06:05:24 +02:00
|
|
|
addParameter(p, 'RemoveOutliers', false, @islogical)
|
2021-07-04 20:24:38 +02:00
|
|
|
addParameter(p, 'YLabelString', 'Y parameter', @ischar)
|
|
|
|
addParameter(p, 'TitleString', 'One-Parameter Scan', @ischar)
|
|
|
|
|
|
|
|
p.parse(XParameter, YQuantity, varargin{:})
|
|
|
|
|
|
|
|
XParameter = p.Results.ParameterArray;
|
|
|
|
RescalingFactorForXParameter = p.Results.RescalingFactorForParameter;
|
|
|
|
XLabelString = p.Results.XLabelString;
|
|
|
|
YQuantity = p.Results.QuantityOfInterestArray;
|
|
|
|
ErrorsForYQuantity = p.Results.ErrorsForYQuantity;
|
|
|
|
ErrorsArray = p.Results.ErrorsArray;
|
2021-07-11 06:05:24 +02:00
|
|
|
CIForYQuantity = p.Results.CIForYQuantity;
|
|
|
|
CIArray = p.Results.CIArray;
|
2021-07-04 20:24:38 +02:00
|
|
|
RescalingFactorForYQuantity = p.Results.RescalingFactorForYQuantity;
|
2021-07-11 06:05:24 +02:00
|
|
|
RemoveOutliers = p.Results.RemoveOutliers;
|
2021-07-04 20:24:38 +02:00
|
|
|
YLabelString = p.Results.YLabelString;
|
|
|
|
TitleString = p.Results.TitleString;
|
|
|
|
|
|
|
|
f_h = Helper.getFigureByTag('One-Parameter Scan');
|
|
|
|
set(groot,'CurrentFigure',f_h);
|
|
|
|
a_h = get(f_h, 'CurrentAxes');
|
|
|
|
if ~isempty(get(a_h, 'Children'))
|
|
|
|
clf(f_h);
|
|
|
|
end
|
|
|
|
f_h.Name = 'One-Parameter Scan';
|
|
|
|
f_h.Units = 'pixels';
|
|
|
|
|
|
|
|
set(0,'units','pixels');
|
|
|
|
screensize = get(0,'ScreenSize');
|
|
|
|
f_h.Position = [[screensize(3)/3.5 screensize(4)/3.5] 750 600];
|
|
|
|
|
2021-07-11 06:05:24 +02:00
|
|
|
if RemoveOutliers
|
|
|
|
[YQuantity,TF] = rmoutliers(YQuantity);
|
|
|
|
XParameter = XParameter(~TF);
|
|
|
|
ErrorsArray = ErrorsArray(~TF);
|
|
|
|
ClippedCIArray(:,1) = CIArray(~TF,1);
|
|
|
|
ClippedCIArray(:,2) = CIArray(~TF,2);
|
|
|
|
CIArray = ClippedCIArray;
|
|
|
|
end
|
|
|
|
|
2021-07-04 20:24:38 +02:00
|
|
|
RescaledXParameter = XParameter .* RescalingFactorForXParameter;
|
|
|
|
RescaledYQuantity = YQuantity .* RescalingFactorForYQuantity;
|
2021-07-11 06:05:24 +02:00
|
|
|
|
|
|
|
hold on
|
|
|
|
|
2021-07-04 20:24:38 +02:00
|
|
|
if ErrorsForYQuantity
|
|
|
|
RescaledErrorsArray = ErrorsArray .* RescalingFactorForYQuantity;
|
2021-07-11 06:05:24 +02:00
|
|
|
errorbar(RescaledXParameter, RescaledYQuantity, RescaledErrorsArray, 'o', 'Linewidth', 1.5, 'MarkerFaceColor', '#0071BB')
|
2021-07-04 20:24:38 +02:00
|
|
|
else
|
|
|
|
plot(RescaledXParameter, RescaledYQuantity, '--o', 'Linewidth', 1.5);
|
|
|
|
end
|
|
|
|
|
2021-07-11 06:05:24 +02:00
|
|
|
if CIForYQuantity
|
|
|
|
RescaledCIArray = CIArray .* RescalingFactorForYQuantity;
|
|
|
|
Plotting.plotConfidenceIntervalRegion(RescaledXParameter, RescaledCIArray(:,1), RescaledCIArray(:,2));
|
|
|
|
end
|
|
|
|
|
|
|
|
hold off
|
|
|
|
|
|
|
|
xlim([0 inf])
|
|
|
|
ylim([0 inf])
|
|
|
|
|
2021-07-04 20:24:38 +02:00
|
|
|
hXLabel = xlabel(XLabelString);
|
|
|
|
hYLabel = ylabel(YLabelString);
|
|
|
|
hTitle = sgtitle(TitleString);
|
|
|
|
|
|
|
|
set([hXLabel, hYLabel] , ...
|
|
|
|
'FontSize' , 14 );
|
|
|
|
set( hTitle , ...
|
|
|
|
'FontSize' , 18 );
|
|
|
|
|
2021-07-11 06:05:24 +02:00
|
|
|
grid on
|
2021-07-04 20:24:38 +02:00
|
|
|
Helper.bringFiguresWithTagInForeground();
|
|
|
|
end
|