Skip to content
Snippets Groups Projects
Commit f20e46f9 authored by Marco Luigi Gaibotti's avatar Marco Luigi Gaibotti
Browse files

[stability-bugs][automatrices] Improved xcg selection

parent 29631aa6
Branches
Tags
1 merge request!16Stability bugs
......@@ -37,17 +37,24 @@ end
%% CHOICE OF NUMBER OF XCG
timeXcgTotal = rocket.motor.time;
xcgTotal = rocket.xCg;
nXcg = autoMatSettings.vars.Nxcg;
if nXcg == 1
chosenXcg = xcgTotal(1);
else
% Decisional figure
h = figure('Name', 'XCG DECISION', 'NumberTitle', 'off');
plot(timeXcgTotal, xcgTotal); grid on; hold on
title('Weighted XCG'); xlabel('Time [s]'); ylabel('XCG [m]');
chosenXcg = xcgTotal(floor(linspace(1, length(xcgTotal), autoMatSettings.vars.Nxcg))); % xcg where to create the matrices
xcgTime = timeXcgTotal(floor(linspace(1, length(timeXcgTotal), autoMatSettings.vars.Nxcg))); % times where we create the matrices
xcgTime = linspace(timeXcgTotal(1), timeXcgTotal(end), nXcg); % times where we create the matrices
chosenXcg = interp1(timeXcgTotal, xcgTotal, xcgTime); % xcg where to create the matrices
plot(xcgTime, chosenXcg, 'ro', 'MarkerFaceColor', 'r', 'MarkerSize', 4);
plot(xcgTime, chosenXcg, 'b--');
legend('Xcg variation', 'Xcg wanted', 'Linear interpolation');
hold off
end
% Questlog
answer = questdlg({strcat("In the figure you can see the red dot where the xcg variation will be discretized."),...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment