mu1 = [2 2]; % Mean of the 1st component
sigma1 = [2 0; 0 1]; % Covariance of the 1st component
mu2 = [-2 -1]; % Mean of the 2nd component
sigma2 = [1 0; 0 1]; % Covariance of the 2nd component
各成分から同じ個数の確率変量を生成し、2 組の確率変量を結合します。
rng('default') % For reproducibility
r1 = mvnrnd(mu1,sigma1,1000);
r2 = mvnrnd(mu2,sigma2,1000);
X = [r1; r2];