# pcaRandVec

## PURPOSE

Generate random vectors in PCA subspace.

## SYNOPSIS

function Xr = pcaRandVec( U, mu, vars, k, n, hypershpere, show )

## DESCRIPTION

     Generate random vectors in PCA subspace.

     Used to generate random vectors from the subspace spanned by the first k
     principal components.  The points generated come from the gaussian
     distribution from within the subspace. Can optionally generate points on
     the subspace that are also on a hypershpere centered on the origin.  This
     may be useful if the original data points were all from a hypershpere --
     for example they were normalized via imNormalize.  Set the optional
     hypershpere flag to 1 to generate points only on the hypersphere.

     USAGE
      Xr = pcaRandVec( U, mu, vars, k, n, [hypershpere], [show] )

     INPUTS
      U           - returned by pca.m
      mu          - returned by pca.m
      vars        - returned by pca.m
      k           - number of principal coordinates to use
      n           - number of points to generate
      hypershpere - [0] generate points on hypersphere (see above)
      show        - [1] figure to use for display (no display if == 0)

     OUTPUTS
      Xr          - resulting randomly generated vectors

     EXAMPLE

     See also PCA IMNORMALIZE

     Piotr's Image&Video Toolbox      Version 2.0
     Copyright 2008 Piotr Dollar.  [pdollar-at-caltech.edu]
     Please email me if you find bugs, or have suggestions or questions!
     Licensed under the Lesser GPL [see external/lgpl.txt]

## CROSS-REFERENCE INFORMATION

This function calls:

- imNormalize Various ways to normalize a (multidimensional) image.
- montage2 Used to display collections of images and videos.
- fevalArrays Used to apply the same operation to a stack of array elements.

This function is called by: