www.gusucode.com > stats 源码程序 matlab案例代码 > stats/ComputeEmpiricalCumulativeDistributionFunctionExample.m
%% Compute Empirical Cumulative Distribution Function % Compute the Kaplan-Meier estimate of the cumulative distribution function % (cdf) for simulated survival data. % Copyright 2015 The MathWorks, Inc. %% % Generate survival data from a Weibull distribution with parameters 3 and 1. rng default; % for reproducibility failuretime = random('wbl',3,1,15,1); %% % Compute the Kaplan-Meier estimate of the cdf for survival data. [f,x] = ecdf(failuretime); [f,x] %% % Plot the estimated cdf. figure() plot(x,f)