MATLAB: How to plot histogram from two vectors

histogram

Can someone help me how can I plot a histogram when I have two vectors where one vector is the x values say x=[1 2 3 4 5] and y is the count of each x y=[5 3 2 6 1]

Best Answer

You want to use bar()
x = 1:5;
y = [5 3 2 6 1];
bar(x,y)