MATLAB File Help: prtRvMvn/prtRvMvn
prtRvMvn/prtRvMvn
  prtRvMvn  Multivariate normal random variable
 
    RV = prtRvMvn creates a prtRvMvn object with empty mean and
    covariance matrices. The mean and covariance matrices must be set
    either directly, or by calling the MLE method.
 
    RV = prtRvMvn('covarianceStructure', VALUE) enforces a covariance
    structure, which may be either 'full', 'spherical', or 'diagonal'.
    Setting this property to 'spherical' or 'diagonal' will enforce
    this structure onto the existing covariance matrix, or one
    estimated by calling the MLE method.
 
    RV = prtRvMvn(PROPERTY1, VALUE1,...) creates a prtRvMv object RV
    with properties as specified by PROPERTY/VALUE pairs.
 
    A prtRvMvn object inherits all properties from the prtRv class. In
    addition, it has the following properties:
 
    covarianceStructure - A string specifying the structure of the
                          covariance matrix to estimate or enforce. 
                          Valid values are 'full','spherical', or 
                          'diagonal'
    mu                  - The mean of the distribution, which is
                          a 1 x nDimensions vector.
    sigma               - The covariance matrix of the distribution,
                          which is a nDimensions x nDimensions 
                          matrix.
    
   A prtRvMvn object inherits all methods from the prtRv class. The MLE
   method can be used to estimate the distribution parameters from
   data.
 
   Example:
 
   dataSet    = prtDataGenUnimodal;   % Load a dataset consisting of 2
                                      % classes
   % Extract one of the classes from the dataSet
   dataSetOneClass = prtDataSetClass(dataSet.getObservationsByClass(1));
 
   RV = prtRvMvn;                       % Create a prtRvMvn object
   RV = RV.mle(dataSetOneClass.getX);   % Compute the maximum
                                        % likelihood estimate from the
                                        % data
   RV.plotPdf                           % Plot the pdf
 
   RVspec = prtRvMvn;                   % Create another prtRvMvn
                                        % object
   RVspec.mu = [1 2];                   % Specify the mean
   RVspec.sigma = [2 -1; -1 2]          % Specify the covariance
   figure;
   RVspec.plotPdf                       % Plot the pdf
   sample = RVspec.draw(1)              % Draw 1 random sample from the
                                        % Distribution
See also