This works:
T = [0,1,0; 1,1,0; 1,0,0]; % Green - Yellow - Red
T = interp1([1:3]', T, linspace(1, 3, 5)');
m = 161;
map = zeros(m , 3);
x = [0
50
120
160
255];
map = interp1(x/255,T,linspace(0,1,255));
I = linspace(0,1,255);
imagesc(I(ones(1,10),:)')
colormap(map)