matlab画频率分布直方图


Generate 10,000 random numbers and create a histogram. The histogramfunction automatically chooses 
an appropriate number of bins to cover the range of values in x and show the shape of the
underlying distribution.
x = randn(10000,1);
h = histogram(x)

randn(100001)产生10 000个均值0,标准差1的正态分布随机数。


 


 

另一个例子:

clc
clear
close all

imgColor = imread('one_section_bianjihou.jpg');
imgGray = rgb2gray(imgColor);

%% imhist
figure('name', 'imhist'),
imhist(imgGray);

%% histogram
figure('name', 'histogram auto'),
% histogram函数自动计算NumBins值
hist2 = histogram(imgGray);
% Find the bin counts
binCounts = hist2.Values;
% Get bin number
binNum = hist2.NumBins;

%% histogram 指定NumBins值
% Specify number of histogram bins
figure('name', 'histogram256'),
hist256 = histogram(imgGray, 256); % 等同于 imhist(imgGray)

 

 



 

https://www.cnblogs.com/gxcdream/p/7710729.html


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM