?? zhist.m
字號:
function varargout = zhist(x);%ZHIST Integer histogram% ZHIST(X) plots the histogram of the vector x; x must be all integer% vector.%% [Y,Z] = ZHIST(X) returns unique vector Y of vector X; Z is the% vector of counts of X.%% [Y,Z,H] = ZHIST(X) same as above, but also gives uniqe vector of% histogram values H.%% Example:% x = [-1 -1 -2 0 1 1 2 2 3 9 14 23 14 11 31 31 31 22 22 22]';% zhist(x)% [y,z,h] = zhist(x)%% See also HIST, UNIQUE.% Copyright 2001-2003 Kamil Anis, anisk@feld.cvut.cz% Dept. of Radioelectronics, % Faculty of Electrical Engineering% Czech Technical University in Prague% $Revision: 0.1 $ $Date: 2003/1/16 17:33:28 $% --% <additional stuff goes here>m1 = min(x);m2 = max(x);bins = [m1:m2 + 1];h = hist(x,bins);x_counts = h(find(h ~= 0))';x_unique = unique(x);h_unique = unique(h)';if nargout == 0 bar(x_unique,x_counts); set(gca,'XTick',x_unique,'YTick',h_unique);else varargout = {x_unique,x_counts,h_unique};end
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -