% ***********************************************************************
% d50.m
% ***********************************************************************
%
% Data description:
% Relative spectral power distribution of a D50 illuminant
%
% Prepared by: T. Francis Chen on April 2015
%
% ***********************************************************************
%
% Original data source:
%     R. W. G. Hunt. Measuring Colour, 2nd ed.
%     Ellis Horwood Limited, Chichester, 1991.
%
% ***********************************************************************
data = [ ...
  300.0	0.019
	305.0	1.035
	310.0	2.051
	315.0	4.914
	320.0	7.778
	325.0	11.263
	330.0	14.748
	335.0	16.348
	340.0	17.948
	345.0	19.479
	350.0	21.010
	355.0	22.476
	360.0	23.942
	365.0	25.451
	370.0	26.961
	375.0	25.724
	380.0	24.488
	385.0	27.179
	390.0	29.871
	395.0	39.589
	400.0	49.308
	405.0	52.910
	410.0	56.513
	415.0	58.273
	420.0	60.034
	425.0	58.926
	430.0	57.818
	435.0	66.321
	440.0	74.825
	445.0	81.036
	450.0	87.247
	455.0	88.930
	460.0	90.612
	465.0	90.990
	470.0	91.368
	475.0	93.238
	480.0	95.109
	485.0	93.536
	490.0	91.963
	495.0	93.843
	500.0	95.724
	505.0	96.169
	510.0	96.613
	515.0	96.871
	520.0	97.129
	525.0	99.614
	530.0	102.099
	535.0	101.427
	540.0	100.755
	545.0	101.536
	550.0	102.317
	555.0	101.159
	560.0	100.000
	565.0	98.868
	570.0	97.735
	575.0	98.327
	580.0	98.918
	585.0	96.208
	590.0	93.499
	595.0	95.593
	600.0	97.688
	605.0	98.478
	610.0	99.269
	615.0	99.155
	620.0	99.042
	625.0	97.382
	630.0	95.722
	635.0	97.290
	640.0	98.857
	645.0	97.262
	650.0	95.667
	655.0	96.929
	660.0	98.190
	665.0	100.597
	670.0	103.003
	675.0	101.068
	680.0	99.133
	685.0	93.257
	690.0	87.381
	695.0	89.492
	700.0	91.604
	705.0	92.246
	710.0	92.889
	715.0	84.872
	720.0	76.854
	725.0	81.683
	730.0	86.511
	735.0	89.546
	740.0	92.580
	745.0	85.405
	750.0	78.230
	755.0	67.961
	760.0	57.692
	765.0	70.307
	770.0	82.923
	775.0	80.599
	780.0	78.274];

fid=fopen('d50.txt','wb');
for i=1:length(data)
    fprintf(fid,'%d  %3.4f \n',data(i,1),data(i,2));
end
fclose(fid);

plot(data(:,1), data(:,2), 'b', 'linewidth',1.5);
title('D50','FontSize',14);
set(gca,'FontSize',14);
ylabel('relative spectral power distribution','fontsize',14);
xlabel('wavelength (nm)','fontsize',14);
axis([300 780 0 120]);
set(gcf,'PaperUnits','inches','PaperPosition',[0 0 6 5]);
grid on;

pause;
print -dpng d50.png -r100
close;
