problem 5

part a)

% Problem 5
function m = cmatch(cx,cy,cz, TARGET, p1,p2,p3)

function T = singleWavelength(lambda)
T = zeros(length(cx),1);
T((lambda-400)/5 + 1) = 1;
end;

t = singleWavelength(TARGET);
CIE = [cx'; cy'; cz'];
m = CIE*t

newbasis = [singleWavelength(p1) singleWavelength(p2) ...
      singleWavelength(p3)];

% CIE * newbasis * MIX = CIE * oldbasis
% therefore, MIX = pinv(CIE*newbasis)*CIE*oldbasis

m = pinv(CIE * newbasis)*CIE*t;

end

results:

>> cmatch(cx,cy,cz,500,450,550,650)
 ans =

    0.1515  <-- amount of p 450
    0.4025  <-- amount of p 550
   -0.7777  <-- amount of p 650

>> cmatch(cx,cy,cz,500,410,510,610);
ans =

    0.7958  <-- amount of p 410
    0.6762  <-- amount of p 510
   -0.0359  <-- amount of p 610

what is the significance of the negative values of light?

The negative values of light imply that subtractive matching must be done in order for the target light to be achieved. 'Subtractive' in this case means that we must add some light to the "target's side" of the match relationship. In both the above results, we would need to add considerable amount of the third primary to the target's side.

suppose you had four lights, at 410, 510, 610 and 650 nm. what condition on the four lights will guarantee that the resulting colour matches the 500nm light?

According to Grassman's laws, color matching is linear, and in a sense this means that we will be able to match any coloured light (assuming subtractive matching is allowed) as long as we have 3 primaries which are linearly independent. Linearly independence with respect to primaries means if we take a particular primary, and are unable to match it by mixing any of the other primaries in our set, then this primary is linearly independent from the others in the set. Grassman's trichromacy laws imply that if we have at least 3 linearly independent primaries, and subtractive matching is allowed, we should be able to perceptually match any colour in our space.

Reference sources: