hist.m

来自「一种新的时频分析方法的matlab源程序。」· M 代码 · 共 48 行

M
48
字号
function h=hist(c,i,j,bins);
% COMPONENTS/HIST plots histograms of components in a Components structure
%
% Usage: (brackets indicate optional parameters)
%  h=hist(c,[i],[j],[bins]);
%
% Input:
%  c    - the Components structure to plot
%  i    - start plotting at the i-th component (from 1)
%  j    - end plotting at the j-th components (from 1)
%  bins - The number of bins to use for the histogram
%
% Output: (optional)
%  h    - handle to the figure used

% Kenneth C. Arnold (for NASA GSFC), 2004-08-06
if nargin < 2; i=[]; end
if nargin < 3; j=[]; end
if nargin < 4; bins=[]; end

if isempty(i); i=1; end
if isempty(j); j=max(size(c.d)); end
if isempty(bins); bins=10; end

if i<1 | j > max(size(c.d))
    error('hht:outOfRange', 'Plot bounds out of range.');
end

% Set plotting area
numplots = j - i + 1;
subplot(numplots, 1, 1);

for n=i:j
    subplot(numplots, 1, n-i+1);
    hist(c.d(n).c, bins);
    ylabel(['c' num2str(n)]);
end
subplot(numplots,1,1);
if i==1 & j==max(size(c.d))
    title(['Histogram of ' inputname(1)]);
else
    title(['Histogram ' num2str(i) ' through ' num2str(j) ' of ' inputname(1)]);
end
set(gcf,'NextPlot','replace');
if nargout == 1
    h=gcf;
end

⌨️ 快捷键说明

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