File size: 4,638 Bytes
5ab75a9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | function GenConjPlanePlot(PcFoster,ConjData)
%
% GenConjPlanePlot - This function generates the Conjunction Plane Plot.
%
% Syntax: GenConjPlanePlot(PcFoster,ConjData)
%
% Inputs:
% PcFoster - 2D probability of collision (Pc) value generated using Foster method
% (PcFosterMethod.m)
% ConjData - A vector of values produced by PcFosterMethod.m
% [Contains: semimajor & semiminor axes (conjunction ellipse),
% clock angle, HBR, miss distance, x1sig,
% and RIC sigma values, condition numbers, and approach angle]
%
% Output:
% [] - Matlab figure (FIG file)
%
% Examples/Validation Cases:
%
% Other m-files required: None (However, the inputs are obtained by using other m-files)
% Subfunctions: None
% MAT-files required: None
%
% See also: None
%
% Author: Dragan Plakalovic
% E-Mail: Dragan.Plakalovic@omitron-cos.com
% Jul 2015; Last revision: 13-Jul-2015
%
% ----------------- BEGIN CODE -----------------
% CREATE PLOT
if (isvector(PcFoster))
PcCircle = PcFoster(1);
else
PcCircle = PcFoster;
end
if (isnan(PcCircle))
fprintf('PcCircle has value of NaN. Conjunction plane plot cannot be generated.\n')
return
end
% Conjuction Data
a = ConjData(1);
b = ConjData(2);
ClockAngle = ConjData(3);
HBR = ConjData(4);
MissDist = ConjData(5);
MinHBSigmaDistance = (MissDist - HBR) / ConjData(6);
% Plot settings
AxisLblSz = 19;
TitleSz = 21;
LineWidth = 2;
FontWeight = 'Normal';
FontName = 'Calibri';
% Generate basis ellipse (parameterization)
u = (0:0.1:2*pi+0.1)';
x0 = a * cos(u);
y0 = b * sin(u);
% Rotate ellipse by clock angle
x = x0.*cosd(ClockAngle) - y0.*sind(ClockAngle);
y = x0.*sind(ClockAngle) + y0.*cosd(ClockAngle);
% Construct HBR
xHBR = HBR * cos(u) + MissDist;
yHBR = HBR * sin(u);
% Creating figure
figure('NumberTitle','off','Name','2D Conjunction Plane','Position',[500,250,840,700]);
hold on
% Plot 1, sqrt(2), and 3-sigma ellipses
plot(x,y,'Color',[1 0 0],'LineWidth',LineWidth);
plot(sqrt(2)*x, sqrt(2)*y,'Color',[1 0.8 0.2],'LineWidth',LineWidth);
plot(3*x,3*y,'Color',[0 1 0.45],'LineWidth',LineWidth);
% Plot HBR
plot(xHBR,yHBR,'b--','LineWidth',LineWidth);
hold off
% Set axes limits to ensure the plot traces don't appear on the edge of the plot area
UpperXLim = max([max(3*x) max(xHBR)]) + 0.05*(max([max(3*x) max(xHBR)] - min([min(3*x) min(xHBR)])));
LowerXLim = min([min(3*x) min(xHBR)]) - 0.05*(max([max(3*x) max(xHBR)] - min([min(3*x) min(xHBR)])));
UpperYLim = max([max(3*y) max(yHBR)]) + 0.05*(max([max(3*y) max(yHBR)] - min([min(3*y) min(yHBR)])));
LowerYLim = min([min(3*y) min(yHBR)]) - 0.05*(max([max(3*y) max(yHBR)] - min([min(3*y) min(yHBR)])));
set(gca,'XLim',[LowerXLim UpperXLim],'YLim',[LowerYLim UpperYLim]);
% Labels
LegendHBR = strcat('Hard Body Region (',num2str(HBR*1000),' m)');
title('Conjunction Plane','FontSize',TitleSz,'FontWeight',FontWeight,'FontName',FontName);
xlabel('Miss Distance Direction [km] ','FontSize',AxisLblSz,'FontWeight',FontWeight,'FontName',FontName);
ylabel('Relative Out of Plane [km]' ,'FontSize',AxisLblSz,'FontWeight',FontWeight,'FontName',FontName);
legend('One Sigma Covariance', 'SQRT Two Sigma Covariance', 'Three Sigma Covariance',LegendHBR,'Location','NorthEast');
text('Units','normalized','Position',[0.01,-0.11],'FontSize',12,'FontName',FontName,'FontWeight','Bold', ...
'String',sprintf('Pc Value : %05.2e',PcCircle));
text('Units','normalized','Position',[0.415,-0.11],'FontSize',12,'FontName',FontName,'FontWeight','Bold', ...
'String',sprintf('Sigma : %04.2f',MinHBSigmaDistance));
text('Units','normalized','Position',[0.750,-0.11],'FontSize',12,'FontName',FontName,'FontWeight','Bold', ...
'String',sprintf('Combined HBR [m] : %g',HBR*1000));
axis equal
grid on
return
% ----------------- END OF CODE ------------------
%
% Please record any changes to the software in the change history
% shown below:
%
%---------------- CHANGE HISTORY ------------------
% Developer | Date | Description
%--------------------------------------------------
% D. Plakalovic | 07-13-2015 | Initial Development
% |