x = imread('cheetah.jpg');
x = double(x);
r = x(:,:,1);g = x(:,:,2);b = x(:,:,3);
Xgray = 0.2126*r + 0.7152*g + 0.0722*b;

figure(1); imagesc(Xgray); 
colormap(gray);
axis square;