From f90fd63ccc2ec7355cabb8efc6e0d4d99d279e93 Mon Sep 17 00:00:00 2001
From: Mauco03 <marco.gaibotti@skywarder.eu>
Date: Tue, 22 Apr 2025 11:09:31 +0200
Subject: [PATCH 1/6] [alpha-phi] Added phi and flag to avoid generating
 highAOA coefficients

---
 autoMatricesProtub/mainAutoMatProtub.m | 39 ++++++++++++++------------
 autoMatricesProtub/src/exportVars.m    |  1 +
 2 files changed, 22 insertions(+), 18 deletions(-)

diff --git a/autoMatricesProtub/mainAutoMatProtub.m b/autoMatricesProtub/mainAutoMatProtub.m
index 07e6db7e..7c0167ec 100644
--- a/autoMatricesProtub/mainAutoMatProtub.m
+++ b/autoMatricesProtub/mainAutoMatProtub.m
@@ -3,7 +3,7 @@ arguments
     rocket = []; % Empty by default
     environment Environment = Environment.empty
     settings    Settings    = Settings.empty
-    options.saveVars    logical = true 
+    options.saveVars    logical = true
 end
 %% PATH
 currentPath = fileparts(mfilename("fullpath"));
@@ -75,18 +75,7 @@ else
 end
 
 tic
-%% COMPUTE HIGH AOA AERODYNAMIC COEFFICIENTS
-fprintf('Generating new coefficients: High AoA...\n');
-autoMatSettings.varsHighAOA.xcg = rocket.xcg(end);
-if length(autoMatSettings.varsHighAOA.alpha) > 20 || ...
-        length(autoMatSettings.varsHighAOA.mach) > 20
-    error("automatrices with Dissile and alpha/mach" + ...
-        "> 20 cases is not yet compatible");
-end
-inputHighAOA = createDissileInput(rocket, autoMatSettings.varsHighAOA);
-[coeffsTotHighAOA, finsCNHighAOA] = dissileMatcom(inputHighAOA);
-
-%% COMPUTE AERODYNAMIC COEFFICIENTS
+%% COMPUTE AND EXPORT AERODYNAMIC COEFFICIENTS
 fprintf('Generating new coefficients: Refined envelope...\n');
 autoMatSettings.vars.xcg = chosenXcg;
 if length(autoMatSettings.vars.alpha) > 20 || ...
@@ -97,15 +86,29 @@ end
 input = createDissileInput(rocket, autoMatSettings.vars);
 [coeffsTot, finsCN] = dissileMatcom(input);
 
-%% SAVE DATA
-
 coeffsOut = exportVars( ...
-    autoMatSettings.varsHighAOA, rocket, mission, coeffsTotHighAOA, finsCNHighAOA, chosenXcg, ...
-    autoMatSettings.saveFinsCN, options.saveVars, 'aeroCoefficientsHighAOA.mat');
-coeffsOutHighAOA = exportVars( ...
     autoMatSettings.vars, rocket, mission, coeffsTot, finsCN, chosenXcg, ...
     autoMatSettings.saveFinsCN, options.saveVars, 'aeroCoefficients.mat');
 
+%% COMPUTE AND EXPORT HIGH AOA AERODYNAMIC COEFFICIENTS
+coeffsOutHighAOA = [];
+if autoMatSettings.computeHighAOA
+    fprintf('Generating new coefficients: High AoA...\n');
+    autoMatSettings.varsHighAOA.xcg = rocket.xcg(end);
+    if length(autoMatSettings.varsHighAOA.alpha) > 20 || ...
+            length(autoMatSettings.varsHighAOA.mach) > 20
+        error("automatrices with Dissile and alpha/mach" + ...
+            "> 20 cases is not yet compatible");
+    end
+    inputHighAOA = createDissileInput(rocket, autoMatSettings.varsHighAOA);
+    [coeffsTotHighAOA, finsCNHighAOA] = dissileMatcom(inputHighAOA);
+    
+
+    coeffsOutHighAOA = exportVars( ...
+        autoMatSettings.varsHighAOA, rocket, mission, coeffsTotHighAOA, finsCNHighAOA, chosenXcg, ...
+        autoMatSettings.saveFinsCN, options.saveVars, 'aeroCoefficientsHighAOA.mat');
+end
+
 AMtime = toc;
 fprintf('Aerodynamics Prediction completed \n')
 fprintf('Elapsed time for aerodynamic matrices computation: %3.3f s\n', AMtime);
\ No newline at end of file
diff --git a/autoMatricesProtub/src/exportVars.m b/autoMatricesProtub/src/exportVars.m
index 9a388e39..f0f87fd6 100644
--- a/autoMatricesProtub/src/exportVars.m
+++ b/autoMatricesProtub/src/exportVars.m
@@ -17,6 +17,7 @@ end
 state.alphas = vars.alpha;
 state.altitudes = vars.alt;
 state.betas = vars.beta;
+state.phis = vars.phi;
 state.machs = vars.mach;
 state.hprot = vars.hprot;
 
-- 
GitLab


From 9d8f53fdbc275eaa9992ca7198429f9feff5d9a0 Mon Sep 17 00:00:00 2001
From: Mauco03 <marco.gaibotti@skywarder.eu>
Date: Wed, 23 Apr 2025 11:10:39 +0200
Subject: [PATCH 2/6] [coefficients][apogeeAnalysis] Fixed a bug where xcgTime
 would not be found

---
 apogeeAnalysis/src/engineCutApogee.m | 4 ++--
 apogeeAnalysis/src/standardApogee.m  | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/apogeeAnalysis/src/engineCutApogee.m b/apogeeAnalysis/src/engineCutApogee.m
index 41c24000..5efb982e 100644
--- a/apogeeAnalysis/src/engineCutApogee.m
+++ b/apogeeAnalysis/src/engineCutApogee.m
@@ -63,8 +63,8 @@ for i = 1:2 % highest and lowest apogee cases
 
         for l = 1:nCutOffTime
             rocket.motor.cutoffTime = timeEngineCutVect(l);
-            rocket.coefficients.state.xcgTime = linspace(0, rocket.motor.cutoffTime, ...
-                length(rocket.coefficients.state.xcgTime));
+            % rocket.coefficients.state.xcgTime = linspace(0, rocket.motor.cutoffTime, ...
+            %     length(rocket.coefficients.state.xcgTime));
             % Apogee
             apogee(l,k,i) = quickApogeeOnly(rocket, environment, wind, settings, wrapper);
         end
diff --git a/apogeeAnalysis/src/standardApogee.m b/apogeeAnalysis/src/standardApogee.m
index efd81950..3ff5b551 100644
--- a/apogeeAnalysis/src/standardApogee.m
+++ b/apogeeAnalysis/src/standardApogee.m
@@ -50,8 +50,8 @@ for i = 1:2 % highest and lowest apogee cases
         tempMotor.name = selectedMotors(k).MotorName;
         rocket.mass = []; % Disables any ovverrides
         rocket.motor = tempMotor;
-        rocket.coefficients.state.xcgTime = linspace(0, tempMotor.cutoffTime, ...
-            length(rocket.coefficients.state.xcgTime));
+        % rocket.coefficients.state.xcgTime = linspace(0, tempMotor.cutoffTime, ...
+        %     length(rocket.coefficients.state.xcgTime));
         rocket.motor.thrust = rocket.motor.thrust * ...
             (1 + settings.cases(i).thrustUncertSign * settings.uncert.sigma * ...
             settings.uncert.totalImpulse / selectedMotors(k).Itot);
-- 
GitLab


From f3b2f9c404de161f164b0c9c075be755adfd5c33 Mon Sep 17 00:00:00 2001
From: Mauco03 <marco.gaibotti@skywarder.eu>
Date: Thu, 24 Apr 2025 10:51:45 +0200
Subject: [PATCH 3/6] [alpha-phi][apogeeAnalysis] Removed xcgTime

---
 apogeeAnalysis/src/engineCutApogee.m | 2 --
 apogeeAnalysis/src/standardApogee.m  | 2 --
 2 files changed, 4 deletions(-)

diff --git a/apogeeAnalysis/src/engineCutApogee.m b/apogeeAnalysis/src/engineCutApogee.m
index 5efb982e..9b5ba901 100644
--- a/apogeeAnalysis/src/engineCutApogee.m
+++ b/apogeeAnalysis/src/engineCutApogee.m
@@ -63,8 +63,6 @@ for i = 1:2 % highest and lowest apogee cases
 
         for l = 1:nCutOffTime
             rocket.motor.cutoffTime = timeEngineCutVect(l);
-            % rocket.coefficients.state.xcgTime = linspace(0, rocket.motor.cutoffTime, ...
-            %     length(rocket.coefficients.state.xcgTime));
             % Apogee
             apogee(l,k,i) = quickApogeeOnly(rocket, environment, wind, settings, wrapper);
         end
diff --git a/apogeeAnalysis/src/standardApogee.m b/apogeeAnalysis/src/standardApogee.m
index 3ff5b551..6fab302d 100644
--- a/apogeeAnalysis/src/standardApogee.m
+++ b/apogeeAnalysis/src/standardApogee.m
@@ -50,8 +50,6 @@ for i = 1:2 % highest and lowest apogee cases
         tempMotor.name = selectedMotors(k).MotorName;
         rocket.mass = []; % Disables any ovverrides
         rocket.motor = tempMotor;
-        % rocket.coefficients.state.xcgTime = linspace(0, tempMotor.cutoffTime, ...
-        %     length(rocket.coefficients.state.xcgTime));
         rocket.motor.thrust = rocket.motor.thrust * ...
             (1 + settings.cases(i).thrustUncertSign * settings.uncert.sigma * ...
             settings.uncert.totalImpulse / selectedMotors(k).Itot);
-- 
GitLab


From 6d5984ea10befbc2fa1a08817a5167579c9f93e3 Mon Sep 17 00:00:00 2001
From: Mauco03 <marco.gaibotti@skywarder.eu>
Date: Sat, 26 Apr 2025 22:10:42 +0200
Subject: [PATCH 4/6] [alpha-phi] Finished alpha-phi tests

---
 utils/tests/alphaPhi/coeffs.mat      |  3 ++
 utils/tests/alphaPhi/coeffsPhi.mat   |  3 ++
 utils/tests/alphaPhi/computeCoeffs.m | 20 +++++++++
 utils/tests/alphaPhi/testAlphaPhi.m  | 54 ++++++++++++++++++++++++
 utils/tests/alphaPhi/testRotation.m  | 61 ++++++++++++++++++++++++++++
 5 files changed, 141 insertions(+)
 create mode 100644 utils/tests/alphaPhi/coeffs.mat
 create mode 100644 utils/tests/alphaPhi/coeffsPhi.mat
 create mode 100644 utils/tests/alphaPhi/computeCoeffs.m
 create mode 100644 utils/tests/alphaPhi/testAlphaPhi.m
 create mode 100644 utils/tests/alphaPhi/testRotation.m

diff --git a/utils/tests/alphaPhi/coeffs.mat b/utils/tests/alphaPhi/coeffs.mat
new file mode 100644
index 00000000..d7c6d523
--- /dev/null
+++ b/utils/tests/alphaPhi/coeffs.mat
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:3e106d1b2e75105acddf1ef9290b13cb469c4332e25492b33f1e9ef75bf991aa
+size 472473
diff --git a/utils/tests/alphaPhi/coeffsPhi.mat b/utils/tests/alphaPhi/coeffsPhi.mat
new file mode 100644
index 00000000..6bc5c935
--- /dev/null
+++ b/utils/tests/alphaPhi/coeffsPhi.mat
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:39d9a040d0569838c0d1f0e7a0b0683a527e6a7de4b1c6469f7c5a211e7fa7f3
+size 203464
diff --git a/utils/tests/alphaPhi/computeCoeffs.m b/utils/tests/alphaPhi/computeCoeffs.m
new file mode 100644
index 00000000..4ee579ec
--- /dev/null
+++ b/utils/tests/alphaPhi/computeCoeffs.m
@@ -0,0 +1,20 @@
+function [coeffsR, coeffs] = computeCoeffs(sections, alpha, mach, phi, abk, interpolant)
+angle = 360 / sections;
+n = floor(phi / angle);
+deltaPhi = n*angle;
+psi = phi - deltaPhi;
+
+coeffsR = zeros(6, 1);
+coeffsR(:, 1) = interpolant(alpha, mach, psi, abk); % Get coeffs in limited range
+coeffs(:, 1)  = interpolant(alpha, mach, phi, abk); % Get coeffs in full range
+
+R = @(phi) [
+    cos(phi), -sin(phi);
+    sin(phi), cos(phi)];
+
+Rot = R(deltaPhi * pi/180);
+
+coeffsR([2, 3]) = Rot * coeffsR([2, 3]);
+coeffsR([5, 6]) = Rot' * coeffsR([5, 6]);
+end
+
diff --git a/utils/tests/alphaPhi/testAlphaPhi.m b/utils/tests/alphaPhi/testAlphaPhi.m
new file mode 100644
index 00000000..c9ffe138
--- /dev/null
+++ b/utils/tests/alphaPhi/testAlphaPhi.m
@@ -0,0 +1,54 @@
+% Workflow: 
+%  - Converti alpha-beta in alphaTot-phi
+%  - Sia il razzo diviso in n settori: m = 360/n
+%  - Considera phi1 = phi % m
+%  - Interpola coefficientin in alphaTot-phi1
+%  - Ruota in alphaTot-phi
+% 
+%   Cosa succede alle derivate dinamiche?
+
+%% aTot-phi -> a-b conversion to get sample points
+% alpha = [-10 -5 -2.5 -1 -0.5 -0.1 0 0.1 0.5 1 2.5 5 10];
+% beta = [-10 -5 -2.5 -1 -0.5 -0.1 0 0.1 0.5 1 2.5 5 10];
+
+% considero casi allineati con assi principali (non sono particolari, data la geometria):
+% alphaTot = [0 0.1 0.5 1 2.5 5 10];
+% phi = [0, 90, 180, 270]
+
+%% Coefficients creation and validation
+data = load("coeffs.mat");
+ab = data.coeffsAB;
+ap = data.coeffsAP;
+
+alpha = ab.state.alphas;
+beta = ab.state.betas;
+
+alphaT = ap.state.alphas;
+phi = ap.state.phis;
+
+coeffIdx = [1 3 5 6 9 13];
+
+% permute coefficients (to have mach after alpha phi)
+coeffsAB = permute(ab.total(coeffIdx, :, :, :, :, :), ...
+    [1, 2, 4, 3, 5, 6]); % coeffs, alpha, phi, mach, abk
+coeffsAP = permute(ap.total(coeffIdx, :, :, :, :, :), ...
+    [1, 2, 4, 3, 5, 6]);
+
+% Get sample points
+sz = size(coeffsAP, [1, 2, 4, 5, 6]);
+sz(2) = sz(2) * 4; % consider four cases (0, 90, 180, 270)
+cAB = NaN(sz);
+cAP = NaN(sz);
+
+cAB(:, 1:7, :, :) = squeeze(coeffsAB(:, 7:end, 7, :, 1, :));      % a > 0, b = 0
+cAB(:, 8:14, :, :) = squeeze(coeffsAB(:, 7, 7:end, :, 1, :));     % a = 0, b > 0
+cAB(:, 15:21, :, :) = squeeze(coeffsAB(:, 7:-1:1, 7, :, 1, :));   % a < 0, b = 0
+cAB(:, 22:28, :, :) = squeeze(coeffsAB(:, 7, 7:-1:1, :, 1, :));   % a = 0, b < 0
+
+cAP(:, 1:7, :, :) = squeeze(coeffsAP(:, :, 1, :, 1, :));      % a > 0, b = 0
+cAP(:, 8:14, :, :) = squeeze(coeffsAP(:, :, 2, :, 1, :));     % a = 0, b > 0
+cAP(:, 15:21, :, :) = squeeze(coeffsAP(:, :, 3, :, 1, :));   % a < 0, b = 0
+cAP(:, 22:28, :, :) = squeeze(coeffsAP(:, :, 4, :, 1, :));   % a = 0, b < 0
+
+error = cAB - cAP;
+errMax = max(error, [], "all");
\ No newline at end of file
diff --git a/utils/tests/alphaPhi/testRotation.m b/utils/tests/alphaPhi/testRotation.m
new file mode 100644
index 00000000..6f23ceed
--- /dev/null
+++ b/utils/tests/alphaPhi/testRotation.m
@@ -0,0 +1,61 @@
+%% rotating the frame
+% alphaTot = [0 0.1 0.5 1 2.5 5 10 20];
+% phi = [0:30:360]
+
+clear; clc; close all
+
+% Consider a generic touple (alpha-tot, phi)
+ap = load("coeffsPhi.mat").coeffsPhi;
+
+coeffIdx = [1 3 5 6 9 13];
+
+coeffsAP = squeeze(permute(ap.total(coeffIdx, :, :, :, :, :), ...
+    [2, 3, 4, 5, 6, 1]));
+
+%% Interpolate coefficients on psi
+alpha = ap.state.alphas;
+mach = ap.state.machs;
+phi = ap.state.phis;
+abk = ap.state.hprot / ap.state.hprot(end);
+interpolant = griddedInterpolant(...
+    {alpha, mach, phi, abk}, ...
+    coeffsAP, 'linear', 'nearest');
+
+%% Validate in multiple cases coefficients by n*section
+
+n = 100;
+
+mach = rand(n, 1); 
+abk = rand(n, 1);
+sections = ap.geometry.nPanel;
+
+% Generic alpha-phi
+alpha = rand(n, 1)*20; 
+phi = rand(n, 1)*360;
+err1 = nan(6, n);
+
+for i = 1:n
+    [coeffsR, coeffs] = computeCoeffs(sections, alpha(i), mach(i), phi(i), abk(i), interpolant);
+    err1(:, i) = abs(coeffs - coeffsR);
+end
+
+% Extrapolation (best near)
+mach = 1.2;
+alpha = 30;
+phi = 247;
+abk = 1.3; % This should actually never happen
+
+[coeffsR, coeffs] = computeCoeffs(sections, alpha, mach, phi, abk, interpolant);
+err2 = abs(coeffs - coeffsR);
+
+% Edge cases (phi = 120*n)
+mach = 0.3;
+alpha = 10;
+phi = [0, 120, 240, 360];
+abk = 0.5; % This should actually never happen
+err3 = nan(6, 4);
+
+for i = 1:4
+    [coeffsR, coeffs] = computeCoeffs(sections, alpha, mach, phi(i), abk, interpolant);
+    err3(:, i) = abs(coeffs - coeffsR);
+end
\ No newline at end of file
-- 
GitLab


From 9d0cd8a59f21125f21ce143c658115688d06cb17 Mon Sep 17 00:00:00 2001
From: Mauco03 <marco.gaibotti@skywarder.eu>
Date: Sat, 26 Apr 2025 22:49:21 +0200
Subject: [PATCH 5/6] [alpha-phi] Added test directly with Coeficient

---
 common                              | 2 +-
 utils/tests/alphaPhi/testRotation.m | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/common b/common
index bc61b5b9..1bc8c371 160000
--- a/common
+++ b/common
@@ -1 +1 @@
-Subproject commit bc61b5b9265bde0f30dfc53db0bf5820e3c69b04
+Subproject commit 1bc8c371f3852dab849aa6db901c8f275dfe025f
diff --git a/utils/tests/alphaPhi/testRotation.m b/utils/tests/alphaPhi/testRotation.m
index 6f23ceed..98597289 100644
--- a/utils/tests/alphaPhi/testRotation.m
+++ b/utils/tests/alphaPhi/testRotation.m
@@ -23,6 +23,8 @@ interpolant = griddedInterpolant(...
 
 %% Validate in multiple cases coefficients by n*section
 
+% uncomment * if manually outputting err from Coefficient
+
 n = 100;
 
 mach = rand(n, 1); 
@@ -32,11 +34,16 @@ sections = ap.geometry.nPanel;
 % Generic alpha-phi
 alpha = rand(n, 1)*20; 
 phi = rand(n, 1)*360;
+beta = rand(n, 1)*20 - 10;
 err1 = nan(6, n);
+altitude = rand(n, 1)*3000; 
 
 for i = 1:n
     [coeffsR, coeffs] = computeCoeffs(sections, alpha(i), mach(i), phi(i), abk(i), interpolant);
     err1(:, i) = abs(coeffs - coeffsR);
+
+    % uncomment if error calculation manually added internally
+    % [~, err1(:, i)] = ap.get(alpha(i)*pi/180, mach(i), beta(i)*pi/180, altitude(i), abk(i), 1.7);
 end
 
 % Extrapolation (best near)
@@ -46,6 +53,7 @@ phi = 247;
 abk = 1.3; % This should actually never happen
 
 [coeffsR, coeffs] = computeCoeffs(sections, alpha, mach, phi, abk, interpolant);
+
 err2 = abs(coeffs - coeffsR);
 
 % Edge cases (phi = 120*n)
-- 
GitLab


From 4725f94d9546d4c2cb4b0c36bc9eff2883ab534e Mon Sep 17 00:00:00 2001
From: Mauco03 <marco.gaibotti@skywarder.eu>
Date: Sun, 27 Apr 2025 00:32:57 +0200
Subject: [PATCH 6/6] [alpha-phi][Automatrices] Added option to override
 saveVars and computeHighAOA as argument

---
 autoMatricesProtub/autoMatProtubConfig.m |  9 +++++++--
 autoMatricesProtub/mainAutoMatProtub.m   | 17 ++++++++++-------
 common                                   |  2 +-
 3 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/autoMatricesProtub/autoMatProtubConfig.m b/autoMatricesProtub/autoMatProtubConfig.m
index 3dc509dc..84797c27 100644
--- a/autoMatricesProtub/autoMatProtubConfig.m
+++ b/autoMatricesProtub/autoMatProtubConfig.m
@@ -22,11 +22,15 @@ set(groot,'defaultAxesTickLabelInterpreter','latex');
 set(groot,'defaulttextinterpreter','latex');
 set(groot,'defaultLegendInterpreter','latex');
 
+flags.saveVars = true;
+flags.computeHighAOA = false;
+
 %% STATES
 % State values in which the aerodynamic coefficients will be computed
 vars.mach = 0.05:0.05:1;
-vars.alpha = [-22 -15 -10 -7.5 -5 -2.5 -1 -0.5 -0.1 0 0.1 0.5 1 2.5 5 7.5 10 15 22];
-vars.beta = [-13 -8 -5 -2.5 -0.1 0 0.1 2.5 5 8 13];
+vars.alpha = [0 0.1 0.5 1 2.5 5 7.5 10 15 22 35 60 90.1 115 130 170];
+vars.beta = [];
+vars.phi = [0:12:120];
 vars.alt = (0:400:4000);         % above local ground (env.z0 will be added in main)
 
 % xcg discretization
@@ -36,6 +40,7 @@ vars.Nxcg = 3;                   % Number of wanted xcgs in order to generate N
 varsHighAOA.mach = 0.05:0.05:0.7;
 varsHighAOA.alpha = [-170 -130 -115 -90.1 -60 -35 -10 -5 -1 0 1 5 10 35 60 90.1 115 130 170];
 varsHighAOA.beta  = [-170 -130 -115 -90.1 -60 -35 -10 -5 -1 0 1 5 10 35 60 90.1 115 130 170];
+varsHighAOA.phi = [];
 varsHighAOA.alt = (0:400:4000);  % above local ground (env.z0 will be added in main)
 
 %% FINS CN partial output
diff --git a/autoMatricesProtub/mainAutoMatProtub.m b/autoMatricesProtub/mainAutoMatProtub.m
index 7c0167ec..e248f56e 100644
--- a/autoMatricesProtub/mainAutoMatProtub.m
+++ b/autoMatricesProtub/mainAutoMatProtub.m
@@ -1,9 +1,10 @@
 function [coeffsOut, coeffsOutHighAOA] = mainAutoMatProtub(rocket, environment, settings, options)
 arguments
     rocket = []; % Empty by default
-    environment Environment = Environment.empty
-    settings    Settings    = Settings.empty
-    options.saveVars    logical = true
+    environment         Environment = Environment.empty
+    settings            Settings    = Settings.empty
+    options.saveVars    logical     = []
+    options.computeHighAOA          = []
 end
 %% PATH
 currentPath = fileparts(mfilename("fullpath"));
@@ -19,6 +20,8 @@ if isempty(rocket), rocket = Rocket(mission, [], "loadCoefficients", false); end
 if isempty(environment), environment = Environment(mission, rocket.motor); end
 if isempty(settings), autoMatSettings = Settings('autoMatProtub'); end
 
+Settings.read(autoMatSettings, options, 'flags');
+
 %% FINALIZE CONFIG (with data not directly editable)
 % correcting altitudes
 autoMatSettings.vars.alt = autoMatSettings.vars.alt + environment.z0;
@@ -88,11 +91,11 @@ input = createDissileInput(rocket, autoMatSettings.vars);
 
 coeffsOut = exportVars( ...
     autoMatSettings.vars, rocket, mission, coeffsTot, finsCN, chosenXcg, ...
-    autoMatSettings.saveFinsCN, options.saveVars, 'aeroCoefficients.mat');
+    autoMatSettings.saveFinsCN, autoMatSettings.flags.saveVars, 'aeroCoefficients.mat');
 
 %% COMPUTE AND EXPORT HIGH AOA AERODYNAMIC COEFFICIENTS
-coeffsOutHighAOA = [];
-if autoMatSettings.computeHighAOA
+coeffsOutHighAOA = Coefficient();
+if autoMatSettings.flags.computeHighAOA
     fprintf('Generating new coefficients: High AoA...\n');
     autoMatSettings.varsHighAOA.xcg = rocket.xcg(end);
     if length(autoMatSettings.varsHighAOA.alpha) > 20 || ...
@@ -106,7 +109,7 @@ if autoMatSettings.computeHighAOA
 
     coeffsOutHighAOA = exportVars( ...
         autoMatSettings.varsHighAOA, rocket, mission, coeffsTotHighAOA, finsCNHighAOA, chosenXcg, ...
-        autoMatSettings.saveFinsCN, options.saveVars, 'aeroCoefficientsHighAOA.mat');
+        autoMatSettings.saveFinsCN, autoMatSettings.flags.saveVars, 'aeroCoefficientsHighAOA.mat');
 end
 
 AMtime = toc;
diff --git a/common b/common
index 1bc8c371..01ad3737 160000
--- a/common
+++ b/common
@@ -1 +1 @@
-Subproject commit 1bc8c371f3852dab849aa6db901c8f275dfe025f
+Subproject commit 01ad37374e485282e37e3e35917d233f22e6bc53
-- 
GitLab