plotempd.m

来自「一个非常实用的统计工具箱」· M 代码 · 共 49 行

M
49
字号
function  plotempd(x,method)%PLOTEMPD Plot empirical distribution.%%         plotempd(x)%         plotempd(x, method)%	  %	  The method (default 3) is%	  1. Interpolation so that F(X_(k)) == (k-0.5)/n.%	  2. Interpolation so that F(X_(k)) == k/(n+1).%	  3. The empirical distribution.%%	  If input  x  is a matrix then every column is treated%	  as a separate distribution and plotted independently.%       Copyright (c) Anders Holtsberg, 1998if nargin < 2   method = 3; endh = ishold;if size(x,1) == 1   x = x';endn = size(x,1);x = sort(x);if method == 1 | method == 2   if method == 1      p = (0.5:n-0.5)/n;   else      p = (1:n)/(n+1);   end   for i = 1:size(x,2)      plot(x(:,i),p)      hold on   endelseif method == 3   x = [x(1,:); x];   p = (0:n)/n;   for i = 1:size(x,2)      stairs(x(:,i),p)      hold on   endelse   error('Hey, argument 2 is not a method!')endif h, hold on, else hold off, end

⌨️ 快捷键说明

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