% Calculate the XYZ value of D65

load D65;
load xyz;

D65XYZ = XYZ' * D65;

D65XYZ = D65XYZ * 100/D65XYZ(2);

% Calculate the XYZ values of the blue-filtered tungsten
% illuminants

load filtered_light_spd;

for i=2:6
  tXYZ = XYZ' * filtered_light_spd(i,:)';
  tXYZ = tXYZ * 100/tXYZ(2);
  for j=1:3
    tungstenXYZ(j, i-1) = tXYZ(j);
  end
end

% calculate and plot chromaticity coordinates of D65 illumination
% and blue-filtered tungsten illumination

tungstenChr = chromaticity(tungstenXYZ);

D65Chr = chromaticity(D65XYZ);

figure;

hold on;

title('Chromaticity coordinates of D65 and blue-filtered tungsten');
plot(tungstenChr(1,:), tungstenChr(2,:), 'bo');
plot(D65Chr(1), D65Chr(2), 'ko');
