## Copyright (C) 2013 Pantxo Diribarne ## ## This program is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 3 of the License, or ## (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program. If not, see . ## -*- texinfo -*- ## @deftypefn {Function File} {@var{cdfx, cdfy} =} cdfplot (@var{data}) ## Return two vectors (cdfx cdfy) to plot cumulative density function of @var{data} function for value ## @var{x}. ## This is a wrapper around various @var{data}cdf and @var{data}_cdf ## functions. See the individual functions help to learn the signification of ## the arguments after @var{x}. Supported functions and corresponding number of ## additional arguments are: ## ## @multitable @columnfractions 0.02 0.3 0.45 0.2 ## @headitem @tab function @tab alternative @tab args ## @item @tab "beta" @tab "beta" @tab 2 ## @item @tab "bino" @tab "binomial" @tab 2 ## @item @tab "cauchy" @tab @tab 2 ## @item @tab "chi2" @tab "chisquare" @tab 1 ## @item @tab "discrete" @tab @tab 2 ## @item @tab "exp" @tab "exponential" @tab 1 ## @item @tab "f" @tab @tab 2 ## @item @tab "gam" @tab "gamma" @tab 2 ## @item @tab "geo" @tab "geometric" @tab 1 ## @item @tab "gev" @tab "generalized extreme value" @tab 3 ## @item @tab "hyge" @tab "hypergeometric" @tab 3 ## @item @tab "kolmogorov_smirnov" @tab @tab 1 ## @item @tab "laplace" @tab @tab 2 ## @item @tab "logistic" @tab @tab 0 ## @item @tab "logn" @tab "lognormal" @tab 2 ## @item @tab "norm" @tab "normal" @tab 2 ## @item @tab "poiss" @tab "poisson" @tab 2 ## @item @tab "rayl" @tab "rayleigh" @tab 1 ## @item @tab "t" @tab @tab 1 ## @item @tab "unif" @tab "uniform" @tab 2 ## @item @tab "wbl" @tab "weibull" @tab 2 ## @end multitable ## ## @seealso{betacdf, binocdf, cauchy_cdf, chi2cdf, discrete_cdf, ## expcdf, fcdf, gamcdf, geocdf, gevcdf, hygecdf, ## kolmogorov_smirnov_cdf, laplace_cdf, logistic_cdf, logncdf, ## normcdf, poisscdf, raylcdf, tcdf, unifcdf, wblcdf} ## @end deftypefn function [ cdfx cdfy ] = cdfplot( data ) %CDF_FUNCTION sorted_data = sort(data); indx=1; cdfx(1) = sorted_data(1); cdfy(1) = 1;%the probability of having the number at cdfx(1) for i = 2:length(sorted_data) if sorted_data(i-1) == sorted_data(i); cdfy(indx) = cdfy(indx) + 1; else cdfy(indx+1) = cdfy(indx) + 1; cdfx(indx+1) = sorted_data(i); indx=indx+1; end end cdfy = cdfy/i; plot(cdfx, cdfy ); end