diff --git a/utils/comparefrequencies.m b/utils/comparefrequencies.m index f67219768f650fcaa8d72b74e9a28ac1523dde35..fe17571fcf5835f9107dac4e6881845c5cbc7eb6 100644 --- a/utils/comparefrequencies.m +++ b/utils/comparefrequencies.m @@ -9,6 +9,8 @@ function [allRelDiff, meanDiff, stdDiff] = comparefrequencies(ResData) % MIT License %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + set(0, 'defaulttextinterpreter', 'latex'); + allRelDiff = zeros(size(ResData)); for i = 1:size(ResData, 1) @@ -29,16 +31,55 @@ function [allRelDiff, meanDiff, stdDiff] = comparefrequencies(ResData) stdDiff = mean(std(allRelDiff)); figure('Name', 'Frequency differences'); + setcolormap(); + map = uliegecolors; + hold on; - plot(allFreqF, allFreqA, 'ok', 'MarkerFaceColor', 'k'); + for i = 1:2 + h = scatter(allFreqF(i, :), allFreqA(i, :), 'filled'); + set(h, {'markerfacecolor'}, num2cell(map(1, :), 2)); + end + xlim([1.5, 3.5]); ylim(xlim); - plot(xlim, xlim, '--'); - + h = plot(xlim, xlim, '--', 'linewidth', 1.1); + set(h, {'color'}, num2cell(map(2, :), 2)); hold off; - grid on; - xlabel('f_{aft} [Hz]'); - ylabel('f_{front} [Hz]'); + setgca(); + xlabel('$\freq_\text{front}$ [Hz]'); + ylabel('$\freq_\text{aft}$ [Hz]'); + + figdir = 'figures/results/'; + filename = 'freq_diff.tex'; + save2tikz([figdir, filename], '\normalsize'); + +end + +function setgca(varargin) + + xticks([1.5:0.5:3.5]); + yticks([1.5:0.5:3.5]); + + set(gca, ... + 'Box', 'off', ... + 'TickDir', 'out', ... + 'TickLength', [.02 .02], ... + 'XMinorTick', 'off', ... + 'YMinorTick', 'off', ... + 'YGrid', 'off', ... + 'XGrid', 'off', ... + 'XColor', 'k', ... + 'YColor', 'k', ... + 'GridLineStyle', ':', ... + 'GridColor', 'k', ... + 'GridAlpha', 0.25, ... + 'LineWidth', 1, ... + 'FontName', 'Helvetica', ... + 'Fontsize', 14); + + if nargin > 0 + set(gca, varargin{:}); + end end diff --git a/utils/plotwindonoff.m b/utils/plotwindonoff.m index 7ce280a4566da3f97594418bfeb9a39fe6bb340e..a69e88dbd0698911fa9f202fbd5f53a70772012b 100644 --- a/utils/plotwindonoff.m +++ b/utils/plotwindonoff.m @@ -73,6 +73,7 @@ function plotwindonoff(ResData) figure; ax1 = subplot(3, 1, 1); + setcolormap(); hold on; plot(meanPeakAngle, meanPeakFon); @@ -82,6 +83,7 @@ function plotwindonoff(ResData) 'XLabel', []); ax2 = subplot(3, 1, 2); + setcolormap(); hold on; plot(meanPeakAngle, meanPeakFoff); % plot(meanPeakAngle(round(end / 5)), meanPeakFoff(round(end / 5)), 'or'); @@ -89,6 +91,7 @@ function plotwindonoff(ResData) 'XLabel', []); ax3 = subplot(3, 1, 3); + setcolormap(); hold on; plot(meanPeakAngle, meanDiff); % plot(meanPeakAngle(round(end / 5)), meanDiff(round(end / 5)), 'or'); diff --git a/utils/setcolormap.m b/utils/setcolormap.m new file mode 100644 index 0000000000000000000000000000000000000000..ed9bd487c6036192b4b7df78f1674ba1fd092ec3 --- /dev/null +++ b/utils/setcolormap.m @@ -0,0 +1,22 @@ +function setcolormap(map) + % SETS THE COLORMAP + % Todo + + % ---------------------------------------------------------------------------------------------- + % (c) Copyright 2022 University of Liege + % Author: Thomas Lambert <t.lambert@uliege.be> + % ULiege - Aeroelasticity and Experimental Aerodynamics + % MIT License + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + axis(); % Make sure axes exists before assigning the colormap + + ULIEGE_MAP = uliegecolors; + + if nargin == 0 + map = ULIEGE_MAP; + end + + set(gca, 'ColorOrder', map, 'nextplot', 'replacechildren'); + +end