MATLAB: I want to plot a histogram with the following code, but it’s not giving me the desired output

histogram

x = [1 2 3 4 5]; y = [40.13 23.14 16 11.03 9.73]; hist(x,y) tittle('Duration of ridging anticyclones') xlabel = (('number of days')); ylabel = (('ridging Atlantic anticyvlones(%)'));

Best Answer

Do you want to take the histogram of the y values? If so, try
counts = histcounts(y);
or else maybe y is already a histogram and you simply want to plot it with bar()?
bar(x, y);