function [w1,w2] = CIE_daylight_weights(T) % Usage: [w1,w2] = CIE_daylight_weights(T) % Caluculates weight factors for CIE daylight eigenvectors S1 and S2 % according to CIE Publication 15.2 (?) % T should be between 4000 K and 25000 K! % T may be a vector. low_T_idx = find(T < 7000); high_T_idx = find(T >= 7000); % Chromaticity coordinates x and y: x = zeros(size(T)); x(low_T_idx) = -4.6070*(10^9./T(low_T_idx).^3) + 2.9678*(10^6./T(low_T_idx).^2) + 0.09911*(10^3./T(low_T_idx)) + 0.244063; x(high_T_idx) = -2.0064*(10^9./T(high_T_idx).^3) + 1.9018*(10^6./T(high_T_idx).^2) + 0.24748*(10^3./T(high_T_idx)) + 0.237040; y = -3.000*(x.^2) + 2.870*x - 0.275; % Weights: w1 = (-1.3515 - 1.7703*x + 5.9114*y)./(0.0241+ 0.2562*x - 0.7341*y); w2 = (0.0300 - 31.4424*x + 30.0717*y)./(0.0241 + 0.2562*x - 0.7341*y);