c***u 发帖数: 4107 | 1 在matlab里面, randn只能生成标准normal(高斯)分布的随机矩阵.
但是,我现在要生成一个符合 N(0,A) 分布的高斯分布的随机矩阵.
PS:
B是一个任意的n*n的矩阵.
A=cov(B);
请问,如何生成?? | g****y 发帖数: 199 | 2 you can use mvnrnd:
Random numbers from multivariate normal distribution
Syntax
R = mvnrnd(mu,sigma)
r = mvnrnd(mu,sigma,cases)
Description
R = mvnrnd(mu,sigma)
returns an n-by-d matrix R of random vectors chosen from the multivariate
normal distribution with
mean mu, and covariance sigma. mu is
an n-by-d matrix, and mvnrnd generates
each row of R using the corresponding row of mu. sigma is
a d-by-d symmetric positive semi-definite
matrix, or a d-by-d-by-n array.
If sigma is an array, mvnrnd g
【在 c***u 的大作中提到】 : 在matlab里面, randn只能生成标准normal(高斯)分布的随机矩阵. : 但是,我现在要生成一个符合 N(0,A) 分布的高斯分布的随机矩阵. : PS: : B是一个任意的n*n的矩阵. : A=cov(B); : 请问,如何生成??
| a****e 发帖数: 16 | | s***s 发帖数: 151 | 4 may not be correct,since randn is not for multivariate distribution.
furthermore, even randn generates multivariate N(0,I), the multiplier should
be chol(A), not A, since the new covariance matrix for transformation y = M
*x+u is M'*Sigma*M, where Sigma is x's covariance matrix.
【在 a****e 的大作中提到】 : randn(size(A)).*A
| a****e 发帖数: 16 | |
|