www.gusucode.com > stats 源码程序 matlab案例代码 > stats/GenerateMultivariateNormalRandomNumbersExample.m

    %% Generate Multivariate Normal Random Numbers
%

% Copyright 2015 The MathWorks, Inc.


%%
% Generate random numbers from a multivariate normal distribution with
% parameters |mu = [2,3]| and |sigma = [1,1.5;1.5,3]|.
mu = [2,3];
sigma = [1,1.5;1.5,3];
rng default  % For reproducibility
r = mvnrnd(mu,sigma,100);

%%
% Plot the random numbers.
figure
plot(r(:,1),r(:,2),'+')