function acquisitionPlot2D( acqResults, chipsPer1ms )

%==============================================================================%
%                                                                              %
%   acquisitionPlot2D( acqResults, chipsPer1ms )                               %
%                                                                              %
%   2-D Acquisition Plot                                                       %
%   David S. De Lorenzo                                                        %
%   29 January 2008                                                            %
%                                                                              %
%==============================================================================%
%                       GPS Software Receiver in Matlab                        %
%     Copyright (c) 2003-2017 David S. De Lorenzo / 2018-2023 Trimble Inc.     %
%==============================================================================%

codePhaseVector = linspace(0, chipsPer1ms, ...
                           length(acqResults(1).resultsVector));

peakSize       = zeros(1, length(acqResults));
codePhaseIndex = zeros(1, length(acqResults));

for jj = 1:length(acqResults)
    [peakSize(jj),codePhaseIndex(jj)] = max(acqResults(jj).resultsVector);
end

figNum = figure(600 + acqResults(1).prn);
clf( figNum );
set(gcf, 'Name', sprintf('Acquisition Results --> PRN %d', acqResults(1).prn));
for jj = 1:length(acqResults)
    subplot(length(acqResults), 1, jj);
    hold('on');
    plot(codePhaseVector, acqResults(jj).resultsVector, 'b');
    plot(codePhaseVector(codePhaseIndex(jj)), peakSize(jj), 'ro');
    hold('off');
    axis([0 chipsPer1ms 0 1.2*max(peakSize)]);
    title(sprintf('Code Correlation - PRN %d at %7.1f chips and %7.1f Hz', ...
                  acqResults(jj).prn, ...
                  acqResults(jj).codePhase, ...
                  acqResults(jj).dopplerFreq));
    xlabel('Code-Phase (chips)');
    ylabel('Correlation');
    drawnow();
end

return
%===============================================================================