"I have a problem with Bar() function"
No, you have a problem with ZEROS() function. In particular you have only specified ZEROS(10) which creates a 10x10 matrix. You then fill the first 10 of those 100 elements (i.e. the first column) with some random numbers... but 90% of your data are zero, i.e. all remaining columns are zeros. You can read the BAR() documentation yourself to know what it does with a matrix input: in short you told it to plot 10 bars in each bin, but 9 of those bars are zero... BAR is showing you exactly what you told it to plot.
What you should have done is preallocated with e.g. ZEROS(1,10) to give a vector.
Two important steps when debugging your own code:
- look at the data. Do not rely on what you have in your head (your computer does not care about what you think/believe it is doing), you have to actually check the data yourself.
- read the documentation for every operator you use.