MATLAB: How to plot intensity profile of an image

Image Processing Toolboximprofileintensity profile

I want to plot the intensity profile of this image. I tried using improfile but I don't really know how it works. Can anyone help?

Best Answer

Like this?
I = imread('Capture.PNG');
x = [0 size(I,2)];
y = [size(I,1)/2 size(I,1)/2];
c = improfile(I,x,y);
figure
subplot(2,1,1)
imshow(I)
hold on
plot(x,y,'r')
subplot(2,1,2)
plot(c(:,1,1),'r')
hold on
plot(c(:,1,2),'g')
plot(c(:,1,3),'b')