diff --git a/@sigmoidSensor/plotParameters.m b/@sigmoidSensor/plotParameters.m
index 757e630..65e3b54 100644
--- a/@sigmoidSensor/plotParameters.m
+++ b/@sigmoidSensor/plotParameters.m
@@ -8,8 +8,8 @@ function f = plotParameters(obj, f)
end
% Distance and tilt sample points
- d = 0:(obj.alphaDist / 1000):(2*obj.alphaDist);
- t = -90:0.1:90;
+ d = 0:(obj.alphaDist / 200):(2*obj.alphaDist);
+ t = -90:0.5:90;
% Sample membership functions
d_x = obj.distanceMembership(d);
diff --git a/resources/project/E2mMq2X73DyjKhlQAouGqrsyLgg/SdS25VyMf8RctG2tGbLEdCKGH3od.xml b/resources/project/E2mMq2X73DyjKhlQAouGqrsyLgg/SdS25VyMf8RctG2tGbLEdCKGH3od.xml
new file mode 100644
index 0000000..99772b4
--- /dev/null
+++ b/resources/project/E2mMq2X73DyjKhlQAouGqrsyLgg/SdS25VyMf8RctG2tGbLEdCKGH3od.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/resources/project/E2mMq2X73DyjKhlQAouGqrsyLgg/SdS25VyMf8RctG2tGbLEdCKGH3op.xml b/resources/project/E2mMq2X73DyjKhlQAouGqrsyLgg/SdS25VyMf8RctG2tGbLEdCKGH3op.xml
new file mode 100644
index 0000000..ff46f75
--- /dev/null
+++ b/resources/project/E2mMq2X73DyjKhlQAouGqrsyLgg/SdS25VyMf8RctG2tGbLEdCKGH3op.xml
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/test/test_sigmoidSensor.m b/test/test_sigmoidSensor.m
index 1e6dade..6aeec87 100644
--- a/test/test_sigmoidSensor.m
+++ b/test/test_sigmoidSensor.m
@@ -68,11 +68,18 @@ classdef test_sigmoidSensor < matlab.unittest.TestCase
s(1) = s(1).initialize(alphaDist(1), betaDist(1), alphaTilt(1), betaTilt(1));
s(2) = s(2).initialize(alphaDist(2), betaDist(2), alphaTilt(2), betaTilt(2));
+ set(groot, 'defaultTextInterpreter', 'latex');
+ set(groot, 'defaultAxesTickLabelInterpreter', 'latex');
+ set(groot, 'defaultLegendInterpreter', 'latex');
+ set(groot, 'defaultColorbarTickLabelInterpreter', 'latex');
+ set(groot, 'defaultAxesFontSize', 10); % = \footnotesize in a 12pt doc
+ set(groot, 'defaultTextFontSize', 10);
+
% Plot
f = s(1).plotParameters;
f = s(2).plotParameters(f);
- legend(["Sensor 1"; "Sensor 2"]);
+ % f = exportThesisFig(f, "sigmoidmodel", 3/4);
end
end
diff --git a/util/exportThesisFig.m b/util/exportThesisFig.m
new file mode 100644
index 0000000..4e1dafe
--- /dev/null
+++ b/util/exportThesisFig.m
@@ -0,0 +1,97 @@
+function f = exportThesisFig(f, name, aspect, opts)
+ % Restyle a figure for print and export it as a vector PDF sized for the
+ % thesis, so it can be included at 1:1 (\includegraphics with no width).
+ %
+ % exportThesisFig(f, "sigmoidmodel") % full width, 4:3
+ % exportThesisFig(f, "traj", 1, Width=230) % half-width subfigure
+ % exportThesisFig(f, "traj", 3/4, LineStyles=true) % distinguishable in grayscale
+ %
+ % The figure is modified in place.
+ arguments (Input)
+ f (1, 1) {mustBeA(f, "matlab.ui.Figure")};
+ name (1, 1) string;
+ aspect (1, 1) double {mustBePositive} = 3/4;
+ opts.Width (1, 1) double {mustBePositive} = 469; % points; \the\hsize
+ opts.FontSize (1, 1) double {mustBePositive} = 10; % \footnotesize in a 12pt doc
+ opts.LineWidth (1, 1) double {mustBePositive} = 2; % data lines, points
+ opts.AxesLineWidth (1, 1) double {mustBePositive} = 0.75;
+ opts.MarkerSize (1, 1) double {mustBePositive} = 4;
+ opts.Palette (:, 3) double = okabeIto(); % colorblind- and print-safe
+ opts.Recolor (1, 1) logical = true; % also override explicitly set colors
+ opts.LineStyles (1, 1) logical = false; % cycle line styles per series
+ opts.Raster (1, 1) logical = false; % for very dense plots
+ opts.OutDir (1, 1) string = matlab.project.rootProject().RootFolder;
+ end
+ arguments (Output)
+ f (1, 1) {mustBeA(f, "matlab.ui.Figure")};
+ end
+
+ styles = ["-", "--", ":", "-."];
+ nColors = size(opts.Palette, 1);
+
+ % Text
+ set(findall(f, '-property', 'Interpreter'), 'Interpreter', 'latex');
+ set(findall(f, '-property', 'TickLabelInterpreter'), 'TickLabelInterpreter', 'latex');
+ set(findall(f, '-property', 'FontSize'), 'FontSize', opts.FontSize);
+
+ % Axes: frame width, and palette for any series that pick their color automatically
+ for ax = findall(f, 'Type', 'axes')'
+ ax.LineWidth = opts.AxesLineWidth;
+ ax.ColorOrder = opts.Palette;
+ if opts.LineStyles
+ ax.LineStyleOrder = styles;
+ end
+ end
+
+ % Data series. SeriesIndex is the series' position in its axes' color
+ % order, so it keeps the palette assignment consistent with the legend.
+ series = findall(f, '-property', 'SeriesIndex');
+ for s = series'
+ k = s.SeriesIndex;
+ if ~isnumeric(k) || k < 1
+ continue; % series excluded from the color order
+ end
+ c = opts.Palette(mod(k - 1, nColors) + 1, :);
+ % Line-type series have a single Color; bars/areas have Face/EdgeColor
+ % instead, and keep their thin default outline
+ isLine = isprop(s, 'Color');
+ isScatter = isa(s, 'matlab.graphics.chart.primitive.Scatter');
+
+ if isLine || isScatter
+ s.LineWidth = opts.LineWidth;
+ end
+ if isprop(s, 'MarkerSize')
+ s.MarkerSize = opts.MarkerSize;
+ end
+ if opts.LineStyles && isLine && ~strcmp(s.LineStyle, 'none')
+ s.LineStyle = styles(mod(k - 1, numel(styles)) + 1);
+ end
+ if opts.Recolor
+ if isLine
+ s.Color = c; % line, stair, errorbar, function plots
+ end
+ if isprop(s, 'FaceColor') && ~ischar(s.FaceColor)
+ s.FaceColor = c; % bar, area, histogram (leaves 'none'/'flat' alone)
+ end
+ if isScatter && size(s.CData, 1) <= 1
+ s.CData = c; % single-color scatter (leaves colormapped ones alone)
+ end
+ end
+ end
+
+ % Page size in points so the PDF is exactly Width wide, independent of
+ % the on-screen window (which the window manager may resize)
+ w = opts.Width;
+ h = aspect * w;
+ f.PaperUnits = 'points';
+ f.PaperPositionMode = 'manual';
+ f.PaperPosition = [0, 0, w, h];
+ f.PaperSize = [w, h];
+
+ if opts.Raster
+ renderer = {'-image', '-r300'};
+ else
+ renderer = {'-vector'};
+ end
+ print(f, fullfile(opts.OutDir, name + ".pdf"), '-dpdf', renderer{:});
+end
diff --git a/util/okabeIto.m b/util/okabeIto.m
new file mode 100644
index 0000000..ada9055
--- /dev/null
+++ b/util/okabeIto.m
@@ -0,0 +1,11 @@
+function p = okabeIto()
+ % Okabe & Ito (2008) colorblind-safe palette, minus yellow (too light on
+ % white paper). Returns an N-by-3 RGB matrix, e.g. colororder(okabeIto()).
+ p = [ 0, 114, 178; % blue
+ 213, 94, 0; % vermillion
+ 0, 158, 115; % bluish green
+ 204, 121, 167; % reddish purple
+ 86, 180, 233; % sky blue
+ 230, 159, 0; % orange
+ 0, 0, 0] / 255;
+end