diff --git a/utils/plotwindonoff.m b/utils/plotwindonoff.m index f5ef548527f17adb60ba5fce9d16677a3588f0ae..7ce280a4566da3f97594418bfeb9a39fe6bb340e 100644 --- a/utils/plotwindonoff.m +++ b/utils/plotwindonoff.m @@ -19,7 +19,7 @@ function plotwindonoff(ResData) ]; PLOT_TIME = false; - SAVE_TIKZ_PARAM = INTERESTING_POINTS(2, :); + SAVE_TIKZ_PARAM = INTERESTING_POINTS(1:2, :); for i = 1:size(ResData, 1) for j = 1:size(ResData, 2) @@ -28,7 +28,7 @@ function plotwindonoff(ResData) expParam = sprintf('d = %0.2f, f = %0.2f, V = %0.1f', ... ResData(i, j).Testcase.dx, ... - ResData(i, j).Testcase.freq, ... + ResData(i, j).(POSITION).trueFreq, ... ResData(i, j).Testcase.airspeed); % Index of corresponding wind-off data @@ -77,15 +77,16 @@ function plotwindonoff(ResData) plot(meanPeakAngle, meanPeakFon); % plot(meanPeakAngle(round(end / 5)), meanPeakFon(round(end / 5)), 'or'); - setgca(); - set(gca, 'XTickLabel', []); + setgca('XTickLabel', [], ... + 'YLabel', [], ... + 'XLabel', []); ax2 = subplot(3, 1, 2); hold on; plot(meanPeakAngle, meanPeakFoff); % plot(meanPeakAngle(round(end / 5)), meanPeakFoff(round(end / 5)), 'or'); - setgca(); - set(gca, 'XTickLabel', []); + setgca('XTickLabel', [], ... + 'XLabel', []); ax3 = subplot(3, 1, 3); hold on; @@ -93,17 +94,20 @@ function plotwindonoff(ResData) % plot(meanPeakAngle(round(end / 5)), meanDiff(round(end / 5)), 'or'); linkaxes([ax1 ax2 ax3], 'xy'); ax1.YLim = 1.25 * ax1.YLim; - setgca(); - xlabel('Flapping angle [deg]'); + setgca('YLabel', []); if isinteresting(ResData(i, j), SAVE_TIKZ_PARAM) - save2tikz('figures/test.tex', '\small'); - else - title(ax1, ['Wind on - ', expParam]); - title(ax2, ['Wind off - ', expParam]); - title(ax3, ['Diff - ', expParam]); + figdir = 'figures/results/'; + filename = sprintf('inertia-Dx%0.2f_F%0.2f_V%0.1f.tex', ... + ResData(i, j).Testcase.dx, ... + ResData(i, j).Testcase.freq, ... + ResData(i, j).Testcase.airspeed); + save2tikz([figdir, filename], '\small'); end - + % Add titles after having saved + title(ax1, ['Wind on - ', expParam]); + title(ax2, ['Wind off - ', expParam]); + title(ax3, ['Diff - ', expParam]); end end @@ -130,7 +134,11 @@ function meanPeak = averagepeaks(signal, sampling, freq) end -function setgca() +function setgca(varargin) + + xlabel('Flapping angle [deg]'); + ylabel('\cfz [N]'); + set(gca, ... 'Box', 'off', ... 'TickDir', 'out', ... @@ -148,5 +156,8 @@ function setgca() 'FontName', 'Helvetica', ... 'Fontsize', 14); - ylabel('\cfz [N]'); + if nargin > 0 + set(gca, varargin{:}); + end + end