Home > atmlab > randomize > randmvar_add_uniform.m

randmvar_add_uniform

PURPOSE ^

RANDMVAR_ADD_UNIFORM Random multivariate data with uniform distribution

SYNOPSIS ^

function [P,C] = randmvar_add_uniform(P,C,Xlims,Cm)

DESCRIPTION ^

 RANDMVAR_ADD_UNIFORM   Random multivariate data with uniform distribution

   Prepares input to *randmvar* to include data with uniform distribution.
   The statistical properties are set by lower and upper limit for data
   range, and the covariance matrix for the data variables to be included.

   Zero correlation to already included variables is assumed.

 FORMAT   [P,C] = randmvar_add_uniform( P, C, Xlims, Cm )
        
 OUT   P       Description of probability distribution function. See 
               *randmvar* for format description.
       C       Correlation matrix. 
 IN    P       Description of probability distribution function for already 
               added variables.
       C       Correlation matrix for already added variables. 
       Xlims   Lower and upper limit for each vector element. Given as a
               matrix with 2 columns.
       C       Correlation matrix for variables to be added.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

randmvar_add_uniform.m

SOURCE CODE ^

0001 % RANDMVAR_ADD_UNIFORM   Random multivariate data with uniform distribution
0002 %
0003 %   Prepares input to *randmvar* to include data with uniform distribution.
0004 %   The statistical properties are set by lower and upper limit for data
0005 %   range, and the covariance matrix for the data variables to be included.
0006 %
0007 %   Zero correlation to already included variables is assumed.
0008 %
0009 % FORMAT   [P,C] = randmvar_add_uniform( P, C, Xlims, Cm )
0010 %
0011 % OUT   P       Description of probability distribution function. See
0012 %               *randmvar* for format description.
0013 %       C       Correlation matrix.
0014 % IN    P       Description of probability distribution function for already
0015 %               added variables.
0016 %       C       Correlation matrix for already added variables.
0017 %       Xlims   Lower and upper limit for each vector element. Given as a
0018 %               matrix with 2 columns.
0019 %       C       Correlation matrix for variables to be added.
0020 
0021 % 2005-05-21   Created by Patrick Eriksson.
0022 
0023 
0024 function [P,C] = randmvar_add_uniform(P,C,Xlims,Cm)
0025 
0026 
0027 %= Check input
0028 %
0029 rqre_nargin( 4, nargin );
0030 %
0031 if ndims(C) > 2  |  size(C,1) ~= size(C,1) 
0032   error('Input argument *C* must be a square matrix.');
0033 end
0034 %
0035 if length(P) ~= size(C,1)
0036   error('Mismatch in size between *P* and *C*.');
0037 end
0038 %
0039 if ndims(Xlims) ~= 2  |  size(Xlims,2) ~= 2
0040   error('Input argument *Xlims* must be a matrix with two columns.');
0041 end
0042 %
0043 if ndims(Cm) > 2  |  size(Cm,1) ~= size(Cm,1) 
0044   error('Input argument *Cm* must be a square matrix.');
0045 end
0046 %
0047 if size(Xlims,1) ~= size(Cm,1) 
0048   error('Mismatch in size between *Xlims* and *Cm*.');
0049 end
0050 
0051 
0052 np = length( P );
0053 nx = size( Xlims, 1 );
0054 
0055 P{np+nx} = [];
0056 
0057 for i = 1 : nx
0058   %
0059   P{np+i}.cdf     = [ Xlims(i,:)', [0;1] ];
0060   P{np+i}.imethod = 'linear';  
0061   %
0062 end
0063 
0064 C = covmat_append( C, Cm );
0065 
0066

Generated on Mon 15-Sep-2014 13:31:28 by m2html © 2005