%plot LCD response
singleLED = load('hdrCalGamma_1x1');

lcdValues = singleLED.inputs(:,1);
ledValues = singleLED.inputs(:,2);
YValues = singleLED.XYZ(:,2);

lcdLevels = unique(lcdValues);
ledLevels = unique(ledValues);

gammaMat = zeros(length(ledLevels),length(lcdLevels))*nan;

for(ii=[1:length(ledLevels)])
    cLcdLevels = unique(lcdValues(find(ledValues==ledLevels(ii))));
    for(jj=[1:length(cLcdLevels)])
        gammaMat(ii,find(lcdLevels==cLcdLevels(jj))) = ...
            YValues(find(ledValues==ledLevels(ii) & lcdValues==cLcdLevels(jj)));
    end
end

figure;
hold on;
for(ii=[1:length(ledLevels)])
    plot(lcdLevels,gammaMat(ii,:),'b.--');
end
hold off;
grid on;
xlabel('LCD input value');
ylabel('Luminance (cd/m^2)');
legend('LED level');
title('LCD response with a single LED');

%plot LED response
figure;
hold on;
for(jj=[1:length(lcdLevels)])
    plot(ledLevels,gammaMat(:,jj),'r.--');
end
hold off;
grid on;
xlabel('LED input value');
ylabel('Luminance (cd/m^2)');
legend('LCD level');
title('LED response with a single LED');
