% create metamers

spd1 = macbeth(8,:);

% coneResponse to spd1
cone_signals = cones*spd1';

load phosphors %phosphors
monitor_to_cones=cones*phosphors';

cones_to_monitor=inv(monitor_to_cones);

%% We apply this transformation to the desired cone responses and
%% obtain the necessary monitor intensities for rendering the image.

monitor_signals=cones_to_monitor*cone_signals;

% calculate the monitor spectra for this signal

spd2 = monitor_signals' * phosphors;

figure;
plot(spectrum,spd1,'r');
hold on 
plot(spectrum,spd2,'g')


metamers = [spd1 ; spd2];
cones * metamers'
ciergb10 * metamers'
ciexyz * metamers'
