diff --git a/sensitivityAnalysis/src/postprocess/postprocessAscent.m b/sensitivityAnalysis/src/postprocess/postprocessAscent.m index 53eade5f05ff64acf8361e8ff1d8c6784c1ff248..581fd8fbfad2dca4968c9122be7a0597c0250093 100644 --- a/sensitivityAnalysis/src/postprocess/postprocessAscent.m +++ b/sensitivityAnalysis/src/postprocess/postprocessAscent.m @@ -94,11 +94,13 @@ end %% defining variables N = settings.sensitivity.n; +nMach = length(rocket.coefficients.state.machs); apoPoint = zeros(4, N); % apogee coordinates. (1) x: north [m]; (2): y: east [m]; (3) z: altitude [m]; (4) downrange [m] times = zeros(2, N); % (1): time to exit the launchpat [s]; (2): time to reach the apogee [s] vrApo = zeros(1, N); % velocity relative to the wind at apogee [m/s] alphaTot = zeros(2, N); % (1): alpha total @launchpad exit, (2): alpha total @apogee [deg] +alphaTotMach = zeros(nMach-1, N); % max alpha total wrt mach until cutoff vExit = zeros(2, N); % velocity at launchpad exit [m/s] (1) Inertial (2) relative to the wind SM = zeros(3, N); % stability margin (1): MIN, (2):MAX, (3): @launchpad exit accMax = zeros(1, N); % max acceleration [m/s^2] @@ -163,6 +165,7 @@ for i = 1:N % checking where the missile is undocked from the hook of the launch pad iApogee = sim.state.iEvent; iExit = find(-sim.state.Y(3, :) > rampAltitude, 1, "first"); + iCutoff = find(sim.state.time >= rocket.cutoffTime, 1, "first"); %iExit = iExit(end)+1; % apogee point @@ -178,6 +181,23 @@ for i = 1:N alphaTot(:,i) = [getAlphaPhi(sim.interp.alpha(iExit), sim.interp.beta(iExit)); ... getAlphaPhi(sim.interp.alpha(end), sim.interp.beta(end))]; + % alpha total distribution wrt mach until cutoff + + % Perform max search on mach regime + machMax = sim.interp.mach(iCutoff); + machMin = sim.interp.mach(iExit); + for j = 1:nMach-1 + m1 = clip(rocket.coefficients.state.machs(j), machMin, machMax); + m2 = clip(rocket.coefficients.state.machs(j+1), machMin, machMax); + + iMachMin = find(sim.interp.mach(iExit:iCutoff) >= m1, 1, "first") + iExit; + iMachMax = find(sim.interp.mach(iExit:iCutoff) >= m2, 1, "first") + iExit; + + if iMachMin == iMachMax, iMachMax = iMachMax + 1; end + + alphaTotMach(j,i) = max(getAlphaPhi(sim.interp.alpha(iMachMin:iMachMax), sim.interp.beta(iMachMin:iMachMax))); + end + % max acceleration accMax(i) = max(vecnorm(sim.accelerations.body)); @@ -279,6 +299,7 @@ postp.apoPoint.value = apoPoint; postp.times.value = times; postp.vrApo.value = vrApo; postp.alphaTot.value = alphaTot.*180/pi; +postp.alphaTotMach.value = alphaTotMach.*180/pi; postp.vExit.value = vExit; postp.SM.value = SM; postp.accMax.value = accMax; @@ -317,6 +338,7 @@ postp.apoPoint.udm = 'm'; postp.times.udm = 's'; postp.vrApo.udm = 'm/s'; postp.alphaTot.udm = 'deg'; +postp.alphaTotMach.udm = 'deg'; postp.vExit.udm = 'm/s'; postp.SM.udm = '-'; postp.accMax.udm = 'm/s^2';