shist.m

来自「计量工具箱」· M 代码 · 共 27 行

M
27
字号
function shist(x,n)% PURPOSE: spline-smoothed plot of a histogram% -----------------------------------------------------% USAGE: shist(x,n)% where: x = input matrix (or vector) %        n = # of bins, [default = (1/50)*size(x)]% -----------------------------------------------------% RETURNS: nothing, just plots the histogram% -----------------------------------------------------if (nargin > 2),error('wrong # of arguments to shist');end;[sizex sizey] = size(x);if (sizex > sizey), xsize = sizex; end;if (sizey > sizex), xsize = sizey; end;if (nargin ~= 2), nbin = (1/50)*xsize; end;if (nargin ==2), nbin = n; end;[t1 t2] = hist(x,nbin);step = (abs(t2(nbin) - t2(1)))/nbin;t2i = t2(1):step:t2(nbin);t1i = interp1(t2,t1,t2i,'spline');plot(t2,t1,'o',t2i,t1i);title('Spline Smoothed Histogram');

⌨️ 快捷键说明

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