Matlab直方图垂直轴频率乘以常数 [英] Matlab histogram vertical axis frequency multiply by constant

查看:144
本文介绍了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)

这篇关于Matlab直方图垂直轴频率乘以常数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆