randvec (Control Design and Simulation Module, MathScript Function)
Member of the cdutil class.
Syntax
vectorX = randvec(covXX)
vectorX = randvec(meanX, covXX)
[vectorX, vectorY] = randvec(covXX, covYY, covXY)
[vectorX, vectorY] = randvec(meanX, covXX, covYY, covXY)
[vectorX, vectorY] = randvec(meanX, meanY, covXX, covYY, covXY)
Description
Generates one or more random vectors with specified mean, auto-covariance, and cross-covariance information.
Inputs
Name | Description |
covXX | Specifies the auto-covariance of the vectorX vector. covXX is a real matrix and must be symmetric and positive semi-definite. |
meanX | Specifies the mean of the vectorX vector. meanX is a real vector and determines the length of vectorX and the dimensions of covXX. The default value of meanX is 0. |
covYY | Specifies the auto-covariance of the vectorY vector. covYY is a real matrix and must be symmetric and positive semi-definite. |
meanY | Specifies the mean of the vectorY vector. meanY is a real vector and determines the length of vectorY and the dimensions of covYY. The default value of meanY is 0. |
covXY | Specifies the cross-covariance between the vectorX and vectorY vectors. covXY is a real matrix. If n is the length of meanX and m is the length of meanY, covXY must be an n x m matrix. |
Outputs
Name | Description |
vectorX | Returns a random vector with mean meanX, auto-covariance covXX, and cross-covariance covXY with the vectorY vector. |
vectorY | Returns a random vector with mean meanY, auto-covariance covYY, and cross-covariance covXY with the vectorX vector. |
Examples
eig_xy = abs(randn(1,7));diag_xy = diag(eig_xy);
U_xy = rand(7,7);
overall_cov = U_xy*diag_xy*U_xy';
covXX = overall_cov(1:4,1:4);
covYY = overall_cov(5:7,5:7);
covXY = overall_cov(1:4,5:7);
[vectorX, vectorY] = randvec(covXX, covYY, covXY);