Home > wafo > wstats > wfrechinv.m

wfrechinv

PURPOSE ^

Inverse of the Frechet distribution function

SYNOPSIS ^

x = wfrechinv(F,a,c)

DESCRIPTION ^

 WFRECHINV Inverse of the Frechet distribution function
 
  CALL:  x = wfrechinv(F,a,c)
 
         x = inverse cdf for the Frechet distribution evaluated at F
      a, c = parameters
 
  The Frechet distribution is defined by its cdf
 
   F(x;a,c) = exp(-(x/a)^(-c)), x>=0, a,c>0
 
  Example:
    F = linspace(0,1,100);
    x = wweibinv(F,10,5);
    plot(F,x)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

001 function x = wfrechinv(F,a,c)
002 %WFRECHINV Inverse of the Frechet distribution function
003 %
004 % CALL:  x = wfrechinv(F,a,c)
005 %
006 %        x = inverse cdf for the Frechet distribution evaluated at F
007 %     a, c = parameters
008 %
009 % The Frechet distribution is defined by its cdf
010 %
011 %  F(x;a,c) = exp(-(x/a)^(-c)), x>=0, a,c>0
012 %
013 % Example:
014 %   F = linspace(0,1,100);
015 %   x = wweibinv(F,10,5);
016 %   plot(F,x)
017 
018 % Reference: 
019 
020 
021 % Tested on: Matlab 5.3
022 % History: 
023 % Added PJ 10-May-2001
024 
025 error(nargchk(3,3,nargin))
026 
027 [errorcode, F, a, c] = comnsize(F,a, c);
028 if (errorcode > 0)
029   error ('F, a and c must be of common size or scalar');
030 end
031 
032 x=zeros(size(F));
033 
034 ok = ((c > 0)  & (a > 0));
035   
036 k = find ((F == 1) & ok);
037 if any (k),
038   tmp=inf;
039   x(k) = tmp(ones (size(k)));
040 end
041   
042 k1 = find ((F > 0) & (F < 1) & ok);
043 if any (k1),
044   x(k1)=(-log(F(k1))).^(-1./c(k1)).*a(k1);
045 end
046 
047 k2 = find(F<0 | F>1 | ~ok);
048 if any(k2),
049   tmp=NaN;
050   x(k2)=tmp(ones(size(k2)));
051 end
052

Mathematical Statistics
Centre for Mathematical Sciences
Lund University with Lund Institute of Technology

Comments or corrections to the WAFO group


Generated on Thu 06-Oct-2005 02:21:16 for WAFO by m2html © 2003