MATLAB: Bar from logical matrix [0*1]

signal & image processing

Hi Guys, Can anyone help me to obtain this Fig. below from logical matrix thx

Best Answer

Try this:
fontSize = 20;
Matrix = [1, 1, 1, 0, 0, 1, 1, 0, 0, 1]
bar(Matrix, 'FaceColor', 'r');
ylim([0, 6]);
ylabel('Magn.', 'FontSize', fontSize, 'FontName', 'Times new roman', 'FontWeight', 'Bold');
xlabel('Time', 'fontSize', fontSize, 'FontName', 'Times new roman', 'FontWeight', 'Bold');
title('Matrix = [1, 1, 1, 0, 0, 1, 1, 0, 0, 1]', 'FontSize', fontSize, 'FontName', 'Times new roman', 'FontWeight', 'Bold');
If you really want to erase the 5 and the 6 from the y axis tick marks, let me know.