% determine avg of line 100 I = imread('cameraman.bmp'); I100 = I(100,:); x = 1 : 256; subplot(1,2,1), imshow(I), title('Original image') subplot(1,2,2), plot(x, I100), xlabel('position'), ylabel('intensity'), title('Line 100') grid on