function plotgamma(lcdValues,ledValues,YValues)

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;
subplot(4,2,1);
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)');

subplot(4,2,2);
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)');

subplot(4,2,3);
hold on;
for(ii=[1:length(ledLevels)])
    semilogy(lcdLevels,gammaMat(ii,:),'b.--');
end
hold off;
set(gca,'YScale','log','XGrid','on','YGrid','on','YMinorGrid','off','YLim',[0.1 10000]);
xlabel('LCD input value');
ylabel('Luminance (cd/m^2)');

subplot(4,2,4);
hold on;
for(jj=[1:length(lcdLevels)])
    semilogy(ledLevels,gammaMat(:,jj),'r.--');
end
hold off;
set(gca,'YScale','log','XGrid','on','YGrid','on','YMinorGrid','off','YLim',[0.1 10000]);
xlabel('LED input value');
ylabel('Luminance (cd/m^2)');

subplot(4,2,[5:8]);
[x y] = meshgrid(lcdLevels,ledLevels);
surf(x, y, gammaMat);
xlabel('LCD input value');
ylabel('LED input value');
zlabel('Luminance (cd/m^2)');
