简体   繁体   English

MatLab中的直方图

[英]Histogram in MatLab

I'm a little bit stuck on how to plot a histogram in MatLab, and typing help hist in MatLab does not make me any wiser. 我对如何在MatLab中绘制直方图有点困惑,在MatLab中输入help hist并没有让我更聪明。 So I would appreciate any help! 所以我很感激任何帮助!

Basically my problem is very simple. 基本上我的问题很简单。 I have a vector, V , with five values, where each value represent the volume of a certain layer of the Earth. 我有一个矢量V ,有五个值,其中每个值代表地球某层的体积。 I simply want to create a histogram of these data, where the x-axis in my histogram should say "Inner Core", "Outer Core", etc., while the y-axis will display the volume. 我只是想创建这些数据的直方图,我的直方图中的x轴应该说“内核”,“外核”等,而y轴将显示音量。 I've tried using the hist-command in various ways, but I can't get this to work. 我尝试过以各种方式使用hist-command,但是我无法使用它。 For instance, if I just type hist(V) , the volume-values actually show up on the x-axis, and not the y-axis. 例如,如果我只输入hist(V) ,则体积值实际显示在x轴上,而不是y轴上。

If anyone can help me how to make this simple histogram I will be very grateful! 如果有人可以帮我如何制作这个简单的直方图,我将非常感激! According to the instructions on my homework, I have to use the hist-command. 根据我的作业说明,我必须使用hist-command。

What you actually what is a bar plot. 你究竟是什么样的条形图。

bar([4,20,10,3,8])

在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM