MATLAB: How can i plot

plotting

I have on matrix such as A=[ 2.8866 2.5708 2.9381 2.6234 2.7873 2.8535 3.5818 4.1817 3.6535 4.6312 4.2028 4.4109 3.6008 4.4279 3.8003 3.7995 4.3140 4.4061 5.2382 4.5073 4.2002 3.9283 3.1146 3.0891]. A is one matrix 24*1.each element of matrix is value of losses for each hour a day.for example for hour between 0 ,1 losses is 2.8866 for hour between 1 ,2 the losses is 2.5708. how can i plot losses for 24 hours?
thanks

Best Answer

Try this:
A=[2.8866 2.5708 2.9381 2.6234 2.7873 2.8535 3.5818 4.1817 3.6535 4.6312 4.2028 4.4109 3.6008 4.4279 3.8003 3.7995 4.3140 4.4061 5.2382 4.5073 4.2002 3.9283 3.1146 3.0891];
Hours = 0.5:23.5;
figure
stairs(Hours, A)
axis([0.5 23.5 0 6])
set(gca, 'XTick',Hours, 'XTickLabel',(0:23))
grid
xlabel('Hours')
ylabel('Loss')