I managed to get the plot:
square=0*z;
figure
for i=1:N
square(i)=rectangle('position',[-D_segment(i)/2,z(i),D_segment(i),dz]);
set(square(i), 'LineStyle', 'none')
set(square(i), 'FaceColor', [0 0 1])
hold on
end
axis('equal')
colorbar
colormap jet
caxis([0 0.7])
hold off
When i execute this commando, i get the correct form/shape that i want. However, now i want to let the facecolor change each timestep of the main loop. The values of the ct matrix vary between 0 and 0.6 0 should get the color blue, 0.6 must become red Any suggestions?