load hdrGamutR
hdrR_XYZ=XYZ

load hdrGamutG
hdrG_XYZ=XYZ

load hdrGamutB
hdrB_XYZ=XYZ

hdrR_xy=hdrR_XYZ(:,1:2)./repmat(sum(hdrR_XYZ,2),1,2)
hdrG_xy=hdrG_XYZ(:,1:2)./repmat(sum(hdrG_XYZ,2),1,2)
hdrB_xy=hdrB_XYZ(:,1:2)./repmat(sum(hdrB_XYZ,2),1,2)


figure
plotSpectrumLocus;  % Read this routine
axis equal, axis square
grid on, xlabel('x-chromaticity'), ylabel('y-chromaticity')
title('Spectrum Locus (gamut of visible light)');
hold on

% Overlay the xy coordinates of the three monitor phosphors on
% top of the graph

plot(hdrR_xy(:,1),hdrR_xy(:,2),'ro'); hold on;
plot(hdrG_xy(:,1),hdrG_xy(:,2),'go'); hold on;
plot(hdrB_xy(:,1),hdrB_xy(:,2),'bo'); hold on;

plot(xyMonitor(1,1),xyMonitor(2,1),'rx');
plot(xyMonitor(1,2),xyMonitor(2,2),'gx');
plot(xyMonitor(1,3),xyMonitor(2,3),'bx');


legend('o HDR display','x CRT of tutorial');

hdrR_xy =

    0.6270    0.3563
    0.6273    0.3570
    0.6268    0.3566
    0.6272    0.3568
    0.6273    0.3571


hdrG_xy =

    0.3243    0.5797
    0.3222    0.5757
    0.3233    0.5777
    0.3239    0.5806
    0.3236    0.5815


hdrB_xy =

    0.1353    0.1067
    0.1340    0.1079
    0.1342    0.1066
    0.1359    0.1071
    0.1355    0.1077