diff --git a/resultsanalysis.m b/resultsanalysis.m index 496b369dc46c323c266c40fc6660a68e0331c11f..f925348f3bdfeceeff8c6b17b9f5aea30f37d2c0 100644 --- a/resultsanalysis.m +++ b/resultsanalysis.m @@ -49,7 +49,6 @@ function ResData = resultsanalysis(matFiles) ResData = calcinertia(ResData); ResData = calctrueforces(ResData); ResData = calccoeff(ResData); - % plotcf(ResData); plotclcd(ResData); @@ -100,8 +99,8 @@ function ResData = calcinertia(ResData) woIdx = woBounds(1):woBounds(2); % Calculate mean force and moments due to inertia - meanForces = mean(ResDataWO.(pos).forces(woIdx)); - meanMom = mean(ResDataWO.(pos).moments(woIdx)); + meanForces = mean(ResDataWO.(pos).forces(woIdx, :)); + meanMom = mean(ResDataWO.(pos).moments(woIdx, :)); ResData(i, j).AllPhases.(pos).inertiaF = meanForces; ResData(i, j).AllPhases.(pos).inertiaM = meanMom; diff --git a/utils/analysis/plotcf.m b/utils/analysis/plotcf.m index d00f1fd3c37d9d906c62e6e60495ae1b43bed135..e3571c3a0df7994a893ff232d457749ea37167ca 100644 --- a/utils/analysis/plotcf.m +++ b/utils/analysis/plotcf.m @@ -109,25 +109,3 @@ function setgca() xlim([-180, 180]); grid on; end - -function bool = isinteresting(ResData, interestingPlots) - % ISINTERESTING Return true if a result is listed in the interestingPlots array - - % No need to plot when cF = 0 - if ResData.Testcase.airspeed == 0 - bool = false; - return - end - - % If no interestingPlots defined, always plot all - if isempty(interestingPlots) - bool = true; - return - end - - ResParam = [ResData.Testcase.dx, ... - ResData.Testcase.freq, ... - ResData.Testcase.airspeed]; - bool = any(ismember(interestingPlots, ResParam, 'rows')); - -end diff --git a/utils/analysis/plotclcd.m b/utils/analysis/plotclcd.m index c0f1b65bcf1baa80ac7c9d2c1d6fd4557358d5f5..0b893ce4d5c6b859c87246e5746e6c0535992854 100644 --- a/utils/analysis/plotclcd.m +++ b/utils/analysis/plotclcd.m @@ -15,9 +15,33 @@ function plotclcd(ResData) % Plot airspeeds in different colors % for i = 1: size(ResData,1) - for i = 2 + OFFSET_STEPS = 20; + + INTERESTING_PLOTS = [ + 0.03, 2, 7.7 + 0.03, 3, 2.5 + 0.03, 3, 4.6 + 0.03, 3.5, 2.5 + 0.03, 3.5, 4.6 + 0.03, 3.5, 7.7 + + 0.05, 1.25, 4.6 + 0.05, 2, 7.7 + 0.05, 3, 7.7 + 0.05, 3.5, 2.5 + 0.05, 3.5, 7.7 + + 0.10, 2.5, 4.6 + 0.10, 2.5, 7.7 + 0.10, 3.5, 2.5 + 0.10, 3.5, 4.6 + 0.10, 3.5, 7.7 + ]; + + for i = 1:size(ResData, 1) for j = 1:size(ResData, 2) - if ResData(i, j).Testcase.airspeed ~= 0 % No need to plot when cF = 0 + + if isinteresting(ResData(i, j), INTERESTING_PLOTS) expParam = sprintf('d = %0.2f, f = %0.2f, V = %0.1f', ... ResData(i, j).Testcase.dx, ... ResData(i, j).Testcase.freq, ... diff --git a/utils/calccoeff.m b/utils/calccoeff.m index 75cfef0066f2ed5a33cd9cee629864f4b89d9d27..cde4ea8171a9d7108898805dee61bccfbcd055be 100644 --- a/utils/calccoeff.m +++ b/utils/calccoeff.m @@ -15,11 +15,12 @@ function [ResData] = calccoeff(ResData) for i = 1:size(ResData, 1) for j = 1:size(ResData, 2) + dens = airdensity(ResData(i, j).Testcase.temp + C_TO_K, ... + ResData(i, j).Testcase.press); + speed = ResData(i, j).Testcase.airspeed; + for iPos = {'Front', 'Aft'} pos = string(iPos); - dens = airdensity(ResData(i, j).Testcase.temp + C_TO_K, ... - ResData(i, j).Testcase.press); - speed = ResData(i, j).Testcase.airspeed; for iPart = 1:size(ResData(i, j).AllPhases(1).(pos).meanF, 1) @@ -27,9 +28,8 @@ function [ResData] = calccoeff(ResData) dens, speed, CHORD, SPAN, 'force'); coeffM = forcetocoeff(ResData(i, j).AllPhases(1).(pos).meanM(iPart, :), ... dens, speed, CHORD, SPAN, 'moment'); - ResData(i, j).AllPhases(1).(pos).cF(iPart, :) = coeffF; - ResData(i, j).AllPhases(1).(pos).cF(iPart, :) = coeffM; + ResData(i, j).AllPhases(1).(pos).cM(iPart, :) = coeffM; end end end diff --git a/utils/calctrueforces.m b/utils/calctrueforces.m index 35c966765baf660dabcd3cc5377f66244851470c..ced4147600e561cba348947448e8caef61303ce3 100644 --- a/utils/calctrueforces.m +++ b/utils/calctrueforces.m @@ -26,6 +26,7 @@ function [ResData] = calctrueforces(ResData) inF = 0; inM = 0; end + % Raw force meanFraw = mean(ResData(i, j).(pos).forces(indexes(iPart, :), :)); meanMraw = mean(ResData(i, j).(pos).moments(indexes(iPart, :), :)); diff --git a/utils/isinteresting.m b/utils/isinteresting.m new file mode 100644 index 0000000000000000000000000000000000000000..8d80b2cbfeab480f6544c71f1ff258f3151f863f --- /dev/null +++ b/utils/isinteresting.m @@ -0,0 +1,29 @@ +function bool = isinteresting(ResData, interestingPlots) + % ISINTERESTING Return true if a result is listed in the interestingPlots array + % Todo + + % ---------------------------------------------------------------------------------------------- + % (c) Copyright 2022 University of Liege + % Author: Thomas Lambert <t.lambert@uliege.be> + % ULiege - Aeroelasticity and Experimental Aerodynamics + % MIT License + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + % No need to plot when cF = 0 + if ResData.Testcase.airspeed == 0 + bool = false; + return + end + + % If no interestingPlots defined, always plot all + if isempty(interestingPlots) + bool = true; + return + end + + ResParam = [ResData.Testcase.dx, ... + ResData.Testcase.freq, ... + ResData.Testcase.airspeed]; + bool = any(ismember(interestingPlots, ResParam, 'rows')); + +end