t = 0:0.001:10; x = randn(size(t)); selection = x (t > 5 & t < 6); figure() hold on plot(t, x, 'displayname', 'measurements') plot(t(t > 5 & t < 6), selection, 'displayname', 'selection') xlabel('time [s]') ylabel('intensity') legend 'show' box 'off'