% ***********************************************************************
% IlluminantA.m
% ***********************************************************************
%
% Data description:
% Relative spectral power distribution of a standard illuminant A
%
% 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.930483
                  301, 0.967643
                  302, 1.005970
                  303, 1.045490
                  304, 1.086230
                  305, 1.128210
                  306, 1.171470
                  307, 1.216020
                  308, 1.261880
                  309, 1.309100
                  310, 1.357690
                  311, 1.407680
                  312, 1.459100
                  313, 1.511980
                  314, 1.566330
                  315, 1.622190
                  316, 1.679590
                  317, 1.738550
                  318, 1.799100
                  319, 1.861270
                  320, 1.925080
                  321, 1.990570
                  322, 2.057760
                  323, 2.126670
                  324, 2.197340
                  325, 2.269800
                  326, 2.344060
                  327, 2.420170
                  328, 2.498140
                  329, 2.578010
                  330, 2.659810
                  331, 2.743550
                  332, 2.829280
                  333, 2.917010
                  334, 3.006780
                  335, 3.098610
                  336, 3.192530
                  337, 3.288570
                  338, 3.386760
                  339, 3.487120
                  340, 3.589680
                  341, 3.694470
                  342, 3.801520
                  343, 3.910850
                  344, 4.022500
                  345, 4.136480
                  346, 4.252820
                  347, 4.371560
                  348, 4.492720
                  349, 4.616310
                  350, 4.742380
                  351, 4.870950
                  352, 5.002040
                  353, 5.135680
                  354, 5.271890
                  355, 5.410700
                  356, 5.552130
                  357, 5.696220
                  358, 5.842980
                  359, 5.992440
                  360, 6.144620
                  361, 6.299550
                  362, 6.457240
                  363, 6.617740
                  364, 6.781050
                  365, 6.947200
                  366, 7.116210
                  367, 7.288110
                  368, 7.462920
                  369, 7.640660
                  370, 7.821350
                  371, 8.005010
                  372, 8.191670
                  373, 8.381340
                  374, 8.574040
                  375, 8.769800
                  376, 8.968640
                  377, 9.170560
                  378, 9.375610
                  379, 9.583780
                  380, 9.795100
                  381, 10.009600
                  382, 10.227300
                  383, 10.448100
                  384, 10.672200
                  385, 10.899600
                  386, 11.130200
                  387, 11.364000
                  388, 11.601200
                  389, 11.841600
                  390, 12.085300
                  391, 12.332400
                  392, 12.582800
                  393, 12.836600
                  394, 13.093800
                  395, 13.354300
                  396, 13.618200
                  397, 13.885500
                  398, 14.156300
                  399, 14.430400
                  400, 14.708000
                  401, 14.989100
                  402, 15.273600
                  403, 15.561600
                  404, 15.853000
                  405, 16.148000
                  406, 16.446400
                  407, 16.748400
                  408, 17.053800
                  409, 17.362800
                  410, 17.675300
                  411, 17.991300
                  412, 18.310800
                  413, 18.633900
                  414, 18.960500
                  415, 19.290700
                  416, 19.624400
                  417, 19.961700
                  418, 20.302600
                  419, 20.647000
                  420, 20.995000
                  421, 21.346500
                  422, 21.701600
                  423, 22.060300
                  424, 22.422500
                  425, 22.788300
                  426, 23.157700
                  427, 23.530700
                  428, 23.907200
                  429, 24.287300
                  430, 24.670900
                  431, 25.058100
                  432, 25.448900
                  433, 25.843200
                  434, 26.241100
                  435, 26.642500
                  436, 27.047500
                  437, 27.456000
                  438, 27.868100
                  439, 28.283600
                  440, 28.702700
                  441, 29.125300
                  442, 29.551500
                  443, 29.981100
                  444, 30.414200
                  445, 30.850800
                  446, 31.290900
                  447, 31.734500
                  448, 32.181500
                  449, 32.632000
                  450, 33.085900
                  451, 33.543200
                  452, 34.004000
                  453, 34.468200
                  454, 34.935800
                  455, 35.406800
                  456, 35.881100
                  457, 36.358800
                  458, 36.839900
                  459, 37.324300
                  460, 37.812100
                  461, 38.303100
                  462, 38.797500
                  463, 39.295100
                  464, 39.796000
                  465, 40.300200
                  466, 40.807600
                  467, 41.318200
                  468, 41.832000
                  469, 42.349100
                  470, 42.869300
                  471, 43.392600
                  472, 43.919200
                  473, 44.448800
                  474, 44.981600
                  475, 45.517400
                  476, 46.056300
                  477, 46.598300
                  478, 47.143300
                  479, 47.691300
                  480, 48.242300
                  481, 48.796300
                  482, 49.353300
                  483, 49.913200
                  484, 50.476000
                  485, 51.041800
                  486, 51.610400
                  487, 52.181800
                  488, 52.756100
                  489, 53.333200
                  490, 53.913200
                  491, 54.495800
                  492, 55.081300
                  493, 55.669400
                  494, 56.260300
                  495, 56.853900
                  496, 57.450100
                  497, 58.048900
                  498, 58.650400
                  499, 59.254500
                  500, 59.861100
                  501, 60.470300
                  502, 61.082000
                  503, 61.696200
                  504, 62.312800
                  505, 62.932000
                  506, 63.553500
                  507, 64.177500
                  508, 64.803800
                  509, 65.432500
                  510, 66.063500
                  511, 66.696800
                  512, 67.332400
                  513, 67.970200
                  514, 68.610200
                  515, 69.252500
                  516, 69.896900
                  517, 70.543500
                  518, 71.192200
                  519, 71.843000
                  520, 72.495900
                  521, 73.150800
                  522, 73.807700
                  523, 74.466600
                  524, 75.127500
                  525, 75.790300
                  526, 76.455100
                  527, 77.121700
                  528, 77.790200
                  529, 78.460500
                  530, 79.132600
                  531, 79.806500
                  532, 80.482100
                  533, 81.159500
                  534, 81.838600
                  535, 82.519300
                  536, 83.201700
                  537, 83.885600
                  538, 84.571200
                  539, 85.258400
                  540, 85.947000
                  541, 86.637200
                  542, 87.328800
                  543, 88.021900
                  544, 88.716500
                  545, 89.412400
                  546, 90.109700
                  547, 90.808300
                  548, 91.508200
                  549, 92.209500
                  550, 92.912000
                  551, 93.615700
                  552, 94.320600
                  553, 95.026700
                  554, 95.733900
                  555, 96.442300
                  556, 97.151800
                  557, 97.862300
                  558, 98.573900
                  559, 99.286400
                  560, 100.000000
                  561, 100.715000
                  562, 101.430000
                  563, 102.146000
                  564, 102.864000
                  565, 103.582000
                  566, 104.301000
                  567, 105.020000
                  568, 105.741000
                  569, 106.462000
                  570, 107.184000
                  571, 107.906000
                  572, 108.630000
                  573, 109.354000
                  574, 110.078000
                  575, 110.803000
                  576, 111.529000
                  577, 112.255000
                  578, 112.982000
                  579, 113.709000
                  580, 114.436000
                  581, 115.164000
                  582, 115.893000
                  583, 116.622000
                  584, 117.351000
                  585, 118.080000
                  586, 118.810000
                  587, 119.540000
                  588, 120.270000
                  589, 121.001000
                  590, 121.731000
                  591, 122.462000
                  592, 123.193000
                  593, 123.924000
                  594, 124.655000
                  595, 125.386000
                  596, 126.118000
                  597, 126.849000
                  598, 127.580000
                  599, 128.312000
                  600, 129.043000
                  601, 129.774000
                  602, 130.505000
                  603, 131.236000
                  604, 131.966000
                  605, 132.697000
                  606, 133.427000
                  607, 134.157000
                  608, 134.887000
                  609, 135.617000
                  610, 136.346000
                  611, 137.075000
                  612, 137.804000
                  613, 138.532000
                  614, 139.260000
                  615, 139.988000
                  616, 140.715000
                  617, 141.441000
                  618, 142.167000
                  619, 142.893000
                  620, 143.618000
                  621, 144.343000
                  622, 145.067000
                  623, 145.790000
                  624, 146.513000
                  625, 147.235000
                  626, 147.957000
                  627, 148.678000
                  628, 149.398000
                  629, 150.117000
                  630, 150.836000
                  631, 151.554000
                  632, 152.271000
                  633, 152.988000
                  634, 153.704000
                  635, 154.418000
                  636, 155.132000
                  637, 155.845000
                  638, 156.558000
                  639, 157.269000
                  640, 157.979000
                  641, 158.689000
                  642, 159.397000
                  643, 160.104000
                  644, 160.811000
                  645, 161.516000
                  646, 162.221000
                  647, 162.924000
                  648, 163.626000
                  649, 164.327000
                  650, 165.028000
                  651, 165.726000
                  652, 166.424000
                  653, 167.121000
                  654, 167.816000
                  655, 168.510000
                  656, 169.203000
                  657, 169.895000
                  658, 170.586000
                  659, 171.275000
                  660, 171.963000
                  661, 172.650000
                  662, 173.335000
                  663, 174.019000
                  664, 174.702000
                  665, 175.383000
                  666, 176.063000
                  667, 176.741000
                  668, 177.419000
                  669, 178.094000
                  670, 178.769000
                  671, 179.441000
                  672, 180.113000
                  673, 180.783000
                  674, 181.451000
                  675, 182.118000
                  676, 182.783000
                  677, 183.447000
                  678, 184.109000
                  679, 184.770000
                  680, 185.429000
                  681, 186.087000
                  682, 186.743000
                  683, 187.397000
                  684, 188.050000
                  685, 188.701000
                  686, 189.350000
                  687, 189.998000
                  688, 190.644000
                  689, 191.288000
                  690, 191.931000
                  691, 192.572000
                  692, 193.211000
                  693, 193.849000
                  694, 194.484000
                  695, 195.118000
                  696, 195.750000
                  697, 196.381000
                  698, 197.009000
                  699, 197.636000
                  700, 198.261000
                  701, 198.884000
                  702, 199.506000
                  703, 200.125000
                  704, 200.743000
                  705, 201.359000
                  706, 201.972000
                  707, 202.584000
                  708, 203.195000
                  709, 203.803000
                  710, 204.409000
                  711, 205.013000
                  712, 205.616000
                  713, 206.216000
                  714, 206.815000
                  715, 207.411000
                  716, 208.006000
                  717, 208.599000
                  718, 209.189000
                  719, 209.778000
                  720, 210.365000
                  721, 210.949000
                  722, 211.532000
                  723, 212.112000
                  724, 212.691000
                  725, 213.268000
                  726, 213.842000
                  727, 214.415000
                  728, 214.985000
                  729, 215.553000
                  730, 216.120000
                  731, 216.684000
                  732, 217.246000
                  733, 217.806000
                  734, 218.364000
                  735, 218.920000
                  736, 219.473000
                  737, 220.025000
                  738, 220.574000
                  739, 221.122000
                  740, 221.667000
                  741, 222.210000
                  742, 222.751000
                  743, 223.290000
                  744, 223.826000
                  745, 224.361000
                  746, 224.893000
                  747, 225.423000
                  748, 225.951000
                  749, 226.477000
                  750, 227.000000
                  751, 227.522000
                  752, 228.041000
                  753, 228.558000
                  754, 229.073000
                  755, 229.585000
                  756, 230.096000
                  757, 230.604000
                  758, 231.110000
                  759, 231.614000
                  760, 232.115000
                  761, 232.615000
                  762, 233.112000
                  763, 233.606000
                  764, 234.099000
                  765, 234.589000
                  766, 235.078000
                  767, 235.564000
                  768, 236.047000
                  769, 236.529000
                  770, 237.008000
                  771, 237.485000
                  772, 237.959000
                  773, 238.432000
                  774, 238.902000
                  775, 239.370000
                  776, 239.836000
                  777, 240.299000
                  778, 240.760000
                  779, 241.219000
                  780, 241.675000
                  781, 242.130000
                  782, 242.582000
                  783, 243.031000
                  784, 243.479000
                  785, 243.924000
                  786, 244.367000
                  787, 244.808000
                  788, 245.246000
                  789, 245.682000
                  790, 246.116000
                  791, 246.548000
                  792, 246.977000
                  793, 247.404000
                  794, 247.829000
                  795, 248.251000
                  796, 248.671000
                  797, 249.089000
                  798, 249.505000
                  799, 249.918000
                  800, 250.329000
                  801, 250.738000
                  802, 251.144000
                  803, 251.548000
                  804, 251.950000
                  805, 252.350000
                  806, 252.747000
                  807, 253.142000
                  808, 253.535000
                  809, 253.925000
                  810, 254.314000
                  811, 254.700000
                  812, 255.083000
                  813, 255.465000
                  814, 255.844000
                  815, 256.221000
                  816, 256.595000
                  817, 256.968000
                  818, 257.338000
                  819, 257.706000
                  820, 258.071000
                  821, 258.434000
                  822, 258.795000
                  823, 259.154000
                  824, 259.511000
                  825, 259.865000
                  826, 260.217000
                  827, 260.567000
                  828, 260.914000
                  829, 261.259000
                  830, 261.602000];

fid=fopen('a.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('A','FontSize',14);
set(gca,'FontSize',14);
ylabel('relative spectral power distribution','fontsize',14);
xlabel('wavelength (nm)','fontsize',14);
axis([300 830 0 265]);
set(gcf,'PaperUnits','inches','PaperPosition',[0 0 6 5]);
grid on;

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