histo.m

来自「toolbox of sdt implementation」· M 代码 · 共 19 行

M
19
字号
function [bin,xx] = histo(y,N)
% Bins the elements of the input vector Y into N equally spaced containers
% within the range of Y (by S. Brigrati, P. Malcovati)
%
% [bin,xx] = histo(y,N)
%
% y:			Input vector
% N:			Number of bins
%
% bin:			Vector containing the number of occurrences for each bin
% xx:			Vector containing the position of each bin

range=ceil(2*max(y)*10)/10;
dx = range/N;
for i=1:N
	x(i) = -range/2 + (i-1)*dx + dx/2;
end
[bin,xx]=hist(y,x);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?