imhist() expects its inputs to be single-channel images. You could either take the histogram of some overall brightness metric:
i=imread('sources/table.jpg');
figure
subplot(1,2,1)
imshow(i)
subplot(1,2,2)
imhist(rgb2gray(i)) % this is luma
or you could set up everything and do histograms for each channel
i=imread('sources/table.jpg');
figure
subplot(3,2,[1 3 5])
imshow(i)
for c=1:3
subplot(3,2,c*2)
imhist(i(:,:,c))
end

