[英]How to create a histogram plot of a histogram?
您似乎没有使用所有可用信息。 请参阅下面的代码,了解如何完成您的工作:
%% Generate some data:
rng(42653042);
data = randn(300); data = (data-min(data(:)))*90+100;
data(1:4:end) = data(1:4:end)/2;
%% Plot using hist:
figure(); hist(data(:),100);
%% Return bin info using hist:
[N,X] = hist(data(:),100);
%% Plot the other function's output w/o X:
figure(); plot(N);
%% Plot the other function's output w/ X:
figure(); plot(X,N);
figure(); bar(X,N);
应该在较新版本的MATLAB中替换函数hist
:
histogram
,用于绘图时(即没有输出的hist
情况)。 histcounts
,用于计数时(即带输出的hist
的情况)。 使用“n = hist(Y,x),其中x是向量,返回长度(x)区间中Y的分布,其中心由x”指定,以指定区间中心。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.