Matlab histogram vertical axis frequency multiply by constant

£可爱£侵袭症+ 提交于 2019-12-24 13:17:49

问题


The vertical axis of a histogram is the frequency. However, I want them to multiply by a constant. How do I do that with Matlab?

For example:

Tickets are sold at 4 gates: North, South, East or West and I want to plot the amount earned at each gate in a histogram to see which gate earned the most.

The price of each ticket is $10. I want the histogram output to show the amount earned instead of just number of tickets sold.


回答1:


The hist function called with no output assignment will draw the chart for you but if you call it like this

[contents, bins] = hist(data)

it won't draw the chart and will store the relevant values in the two output variables. Then you can modify the contents variable and plot them with bar to achieve wht you need

bar(bins, 10*contents)


来源:https://stackoverflow.com/questions/30779402/matlab-histogram-vertical-axis-frequency-multiply-by-constant

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!