%clear all; close all;
cnn=40; %number of points in the half color map
col_start = [1 0 0];
col_mid2  =  [0 1 0];
col_mid= [1 0 1]; %middle color on the way back
col_end = [0 0 1];

pow=1; %for the scaling inbetween the first and middle number
x = 0:1/((cnn/4)-1):1;
x=x.^pow; %scaling to go from start to end
for rgb_nm=1:3
first(1:cnn/4, rgb_nm) = interp1([0 1], [col_start(rgb_nm) col_mid(rgb_nm)], x);
end

x = 0:1/((cnn/4)-1):1;
x=1-(1-x).^pow;
for rgb_nm=1:3
second(1:cnn/4, rgb_nm) = interp1([0 1], [col_mid(rgb_nm) col_end(rgb_nm)], x);
end

x = 0:1/((cnn/4)-1):1;
x=x.^pow; %scaling to go from start to end
for rgb_nm=1:3
third(1:cnn/4, rgb_nm) = interp1([0 1], [col_end(rgb_nm) col_mid2(rgb_nm)], x);
end

x = 0:1/((cnn/4)-1):1;
x=1-(1-x).^pow;
for rgb_nm=1:3
fourth(1:cnn/4, rgb_nm) = interp1([0 1], [col_mid2(rgb_nm) col_start(rgb_nm)], x);
end



cmap=[first; second;third;fourth];
figure(1); clf;
colormap(cmap); colorbar;
