m=800; n=736;
X=imread('Pumpkin.jpg')
Y=X;
figure;
subplot(2,3,1);
imshow(Y)
title('Pumpkin.jpg');
subplot(2,3,2);
histogram(Y);
title('Histogram');

rgbImage = Y
redChannel = rgbImage(:, :, 1);
greenChannel = rgbImage(:, :, 2);
blueChannel = rgbImage(:, :, 3);
z = zeros(size(rgbImage), class(rgbImage));
redImage = z; redImage(:,:,1) = redChannel;
greenImage = z; greenImage(:,:,2) = greenChannel;
blueImage = z; blueImage(:,:,3) = blueChannel;
subplot(2,2,1); image(rgbImage);
subplot(2,2,2); image(redImage);
subplot(2,2,3); image(greenImage);
subplot(2,2,4); image(blueImage);

fprintf("R's mean: %.2f, median: %d, mode: %d\n", mean(redChannel(:)), median(redChannel(:)), mode(redChannel(:)));