MATLAB: How to make a gray-scale image with a continuously changing intensity pattern

image displayMATLAB

Hi. I am trying to figure out how to make a gray-scale image with a continuously changing intensity pattern. For example, if I run the code below, I get a staircase-like discrete pattern along the horizontal direction because of the limited number of colormap values (?). I wonder if I can make it displayed more smoothly.
x = [1:10000]; figure(1), imagesc(x), colormap gray
Thank you!

Best Answer

I used your suggestion, is this better?
x = [1:10000]; figure(1), imagesc(x), colormap gray
set(gcf,'colormap',repmat(linspace(0,1,250)',1,3))