[英]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.