Matlab直方图垂直轴频率乘以常数
直方图的垂直轴是频率.但是,我希望它们乘以一个常数.如何使用Matlab做到这一点?
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?
例如:
门票在北,南,东或西4个登机口出售,我想在直方图中绘制每个登机口的收益额,以查看哪个登机口赚钱最多.
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.
每张票的价格为10美元.我希望直方图输出显示的是所赚取的金额,而不是仅显示已售出的门票数量.
The price of each ticket is $10. I want the histogram output to show the amount earned instead of just number of tickets sold.
没有输出分配的hist
函数将为您绘制图表,但如果您这样调用它
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)
它不会绘制图表,而是将相关值存储在两个输出变量中.然后,您可以修改contents
变量,并用bar
对其进行绘图,以实现所需的
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)