singleLED = load('hdrCalGamma_1x1')
g = 2.6337 %mean(singleLEDGamma(:,1))
maxl = max(singleLED.XYZ(:,2));

inputs=singleLED.inputs


% for(ii=[1:size(inputs,1)])
%     predict_intensity(ii,:) = (inputs(ii,1)./max(inputs(:,1))).^g.*inputs(ii,2)./max(inputs(:,2))*maxl;
% end

predict_intensity = (inputs(:,1)./max(inputs(:,1))).^g.*inputs(:,2)./max(inputs(:,2))*maxl;
plotgamma(inputs(:,1), inputs(:,2),predict_intensity);

sqe =(singleLED.XYZ(:,2)./maxl - predict_intensity./maxl).^2;
plotgamma(inputs(:,1), inputs(:,2),sqe);

dif=abs(singleLED.XYZ(:,2)./maxl - predict_intensity./maxl);
plotgamma(inputs(:,1), inputs(:,2),dif);

difv=abs(singleLED.XYZ(:,2) - predict_intensity);
plotgamma(inputs(:,1), inputs(:,2),dif);

% %[x y] = meshgrid(inputs(:,1),inputs(:,2));
% figure
% surf(inputs(:,1), inputs(:,2), sqe);
% xlabel('LCD input value');
% ylabel('LED input value');
% zlabel('Squared error');

