Home > wafo > wstats > dist2dpdf2.m

dist2dpdf2

PURPOSE ^

Joint 2D PDF computed as f(x1|X2=x2)*f(x2)

SYNOPSIS ^

y = dist2dpdf2(v1,h1,phat)

DESCRIPTION ^

 DIST2DPDF2 Joint 2D PDF computed as f(x1|X2=x2)*f(x2) 
  
   CALL:  f = dist2dpdf2(x1,x2,phat);  
  
       f  = PDF struct with the following fields: 
            f = PDF evaluated at meshgrid(x1,x2) 
         x = {x1,x2} (i.e., cellarray containing x1 and x2) 
   x1,x2  = vectors of evaluation points 
     phat = structure array containing 
             x    = cellarray of distribution parameters 
             dist = cellarray of strings defining the distributions of  
                    X2 and X1 given X2, respectively. Options are: 
                    'tgumbel', 'gumbel', 'lognormal','rayleigh','weibull', 
                    and 'gamma'. 
   
   DIST2DPDF2 evaluates f{x1|X2=x2 }*f{x2}.  
    The parameter(s) of the unconditional distribution of X2, 
    f{x2}, must be in in phat.x{2}. The parameters of the conditional 
    distribution of X1 given X2 must be in phat.x{1}. The first column 
    in phat.x{1} contains the X2 values the parameters in column 2 and 3 are 
    conditioned on.   
  
  Example: 2D Rayleigh 
     x1=linspace(0,10)'; 
     phat.x={[x1,2*ones(size(x1))] 2 }; 
     phat.dist={'rayl','rayl'}; 
     f = dist2dpdf2(x1,x1,phat);  
     pdfplot(f); 
  
  See also  dist2dfit, dist2dpdf

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

001 function y = dist2dpdf2(v1,h1,phat) 
002 %DIST2DPDF2 Joint 2D PDF computed as f(x1|X2=x2)*f(x2) 
003 % 
004 %  CALL:  f = dist2dpdf2(x1,x2,phat);  
005 % 
006 %      f  = PDF struct with the following fields: 
007 %           f = PDF evaluated at meshgrid(x1,x2) 
008 %        x = {x1,x2} (i.e., cellarray containing x1 and x2) 
009 %  x1,x2  = vectors of evaluation points 
010 %    phat = structure array containing 
011 %            x    = cellarray of distribution parameters 
012 %            dist = cellarray of strings defining the distributions of  
013 %                   X2 and X1 given X2, respectively. Options are: 
014 %                   'tgumbel', 'gumbel', 'lognormal','rayleigh','weibull', 
015 %                   and 'gamma'. 
016 %  
017 %  DIST2DPDF2 evaluates f{x1|X2=x2 }*f{x2}.  
018 %   The parameter(s) of the unconditional distribution of X2, 
019 %   f{x2}, must be in in phat.x{2}. The parameters of the conditional 
020 %   distribution of X1 given X2 must be in phat.x{1}. The first column 
021 %   in phat.x{1} contains the X2 values the parameters in column 2 and 3 are 
022 %   conditioned on.   
023 % 
024 % Example: 2D Rayleigh 
025 %    x1=linspace(0,10)'; 
026 %    phat.x={[x1,2*ones(size(x1))] 2 }; 
027 %    phat.dist={'rayl','rayl'}; 
028 %    f = dist2dpdf2(x1,x1,phat);  
029 %    pdfplot(f); 
030 % 
031 % See also  dist2dfit, dist2dpdf  
032  
033 %tested on: matlab 5.2 
034 % history: 
035 %  Per A. Brodtkorb 28.10.98 
036  
037 error(nargchk(3,3,nargin)) 
038  
039 y=createpdf(2); 
040 [X1 X2]=meshgrid(v1,h1); 
041 y.f=  dist2dpdf(X1,X2,phat); 
042 y.x{1}=v1(:); 
043 y.x{2}=h1(:); 
044 %contour(v1,h1,y.f) 
045 %y.f(isinf(y.f)|isnan(y.f))=0; 
046 try 
047   [y.cl y.pl]=qlevels(y.f); 
048 catch 
049   y.cl=[]; 
050   y.pl=[]; 
051 end 
052 y.phat=phat; 
053  
054  
055

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