diff --git a/classes/misc/Coefficient.m b/classes/misc/Coefficient.m index 35aed65e80952b9daeaa7e9baac43c6d6edffbaf..219bca89f335199a1d25633b8622f4105ac6cb97 100644 --- a/classes/misc/Coefficient.m +++ b/classes/misc/Coefficient.m @@ -131,7 +131,7 @@ classdef Coefficient coefficients(1:6) = obj.staticInterpolant(alphaTot, mach, psi, altitude, airbakes); % Get coeffs in limited range - if n > 1 % If necessary, perform rotation on different frame + if n > 0 % If necessary, perform rotation on different frame R = [cos(deltaPhi), -sin(deltaPhi); sin(deltaPhi), cos(deltaPhi)]; diff --git a/functions/odeFunctions/ballistic.m b/functions/odeFunctions/ballistic.m index d08b3069d7274836e0f686c19963919facaec233..fed5600a547105015d3835c998120ef8accf7f44 100644 --- a/functions/odeFunctions/ballistic.m +++ b/functions/odeFunctions/ballistic.m @@ -134,7 +134,7 @@ end if not(abs(ur) < 1e-9 || velsNorm < 1e-9) alpha = atan(wr/ur); beta = atan(vr/ur); % beta = asin(vr/V_norm) is the classical notation, Datcom uses this one though. - % alpha_tot = atan(sqrt(wr^2 + vr^2)/ur); % datcom 97' definition + alphaTot = atan(sqrt(wr^2 + vr^2)/ur); % datcom 97' definition else alpha = 0; beta = 0; @@ -144,14 +144,17 @@ alphaOut = alpha; betaOut = beta; %% INTERPOLATE AERODYNAMIC COEFFICIENTS: - -if abs(alpha) > rocket.coefficients.state.alphas(end)*pi/180 || ... - abs(beta) > rocket.coefficients.state.betas(end)*pi/180 - coeffsValues = rocket.coefficientsHighAOA.get(alpha, mach, beta, absoluteAltitude, extension, xcg); +if rocket.coefficients.type == CoeffType.AlphaBeta + if abs(alpha) > rocket.coefficients.state.alphas(end)*pi/180 || abs(beta) > rocket.coefficients.state.betas(end)*pi/180 + coeffsValues = rocket.coefficientsHighAOA.get(alpha, mach, beta, absoluteAltitude, extension, xcg); + end +elseif abs(alphaTot) > rocket.coefficients.state.alphas(end)*pi/180 + coeffsValues = rocket.coefficientsHighAOA.get(alpha, mach, beta, absoluteAltitude, extension, xcg); else coeffsValues = rocket.coefficients.get(alpha, mach, beta, absoluteAltitude, extension, xcg); end + % Retrieve Coefficients CA = coeffsValues(1); CY = coeffsValues(2); CN = coeffsValues(3); Cl = coeffsValues(4); Cm = coeffsValues(5); Cn = coeffsValues(6);