hist_dke_yp

PURPOSE ^

HIST Plot histograms.

SYNOPSIS ^

function [no,xo] = hist_dke_yp(y,x,xlabelmode,ylabelmode,titlemode,xlimmode,ylimmode,colormode,linemode,widthmode)

DESCRIPTION ^

HIST    Plot histograms.
    HIST(Y) plots a histogram with 10 equally spaced bins between
    the minimum and maximum values in Y, showing the distribution
    of the elements in vector Y.
    HIST(Y,N), where N is a scalar, uses N bins.
    HIST(Y,X), where X is a vector, draws a histogram using the
    bins specified in X.
    [N,X] = HIST(...) does not draw a graph, but returns vectors
    X and N such that BAR(X,N) is the histogram.

    See also BAR.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [no,xo] = hist_dke_yp(y,x,xlabelmode,ylabelmode,titlemode,xlimmode,ylimmode,colormode,linemode,widthmode)
0002 %HIST    Plot histograms.
0003 %    HIST(Y) plots a histogram with 10 equally spaced bins between
0004 %    the minimum and maximum values in Y, showing the distribution
0005 %    of the elements in vector Y.
0006 %    HIST(Y,N), where N is a scalar, uses N bins.
0007 %    HIST(Y,X), where X is a vector, draws a histogram using the
0008 %    bins specified in X.
0009 %    [N,X] = HIST(...) does not draw a graph, but returns vectors
0010 %    X and N such that BAR(X,N) is the histogram.
0011 %
0012 %    See also BAR.
0013 
0014 %    J.N. Little 2-06-86
0015 %    Revised 10-29-87, 12-29-88 LS
0016 %    Revised 8-13-91 by cmt, 2-3-92 by ls.
0017 %    Copyright (c) 1984-94 by The MathWorks, Inc.
0018 %
0019 %modified by Y.PEYSSON CEA-DRFC <yves.peysson@cea.fr>
0020 %
0021 %
0022 if nargin == 0
0023     error('Requires one or two input arguments.')
0024 end
0025 if nargin == 1
0026     x = 10;
0027 end
0028 if min(size(y))==1, y = y(:); end
0029 if isstr(x) | isstr(y)
0030     error('Input arguments must be numeric.')
0031 end
0032 [m,n] = size(y);
0033 if max(size(x)) == 1
0034 return;%  ***************************************not yet corrected
0035         miny = min(min(y));
0036         maxy = max(max(y));
0037         binwidth = (maxy - miny) ./ x;
0038         xx = miny + binwidth*[0:x];
0039         xx(length(xx)) = maxy;
0040         x = xx(1:length(xx)-1) + binwidth/2;
0041 else
0042     xx = x(:)';
0043     xx0 = xx;
0044         miny = min(min(y));
0045         maxy = max(max(y));
0046         binwidth = [diff(xx) 0];
0047 %        xx = [xx(1)-binwidth(1)/2 xx+binwidth/2];
0048         xx(1) = miny;
0049         xx(length(xx)) = maxy;
0050 end
0051 nbin = max(size(xx));
0052 nn = zeros(nbin,n);
0053 for i=2:nbin
0054     nn(i,:) = sum(y <= xx(i));
0055 end
0056 nn = nn(2:nbin,:) - nn(1:nbin-1,:);
0057 if nargout == 0
0058     stairs_dke_yp(xx0,[nn',nn(length(nn))],xlabelmode,ylabelmode,titlemode,xlimmode,ylimmode,colormode,linemode,widthmode,0);
0059 else
0060     if min(size(y))==1, % Return row vectors if possible.
0061             no = nn';
0062             xo = x;
0063       else
0064             no = nn;
0065             xo = x';
0066       end
0067 end

Community support and wiki are available on Redmine. Last update: 18-Apr-2019.