From: Jeff <>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Generate three correlated variables
Date: Mon, 12 Mar 2012 16:22:21 -0700 (PDT)
Lines: 21
Message-ID: <6525364.3539.1331594541033.JavaMail.geo-discussion-forums@pbij6>
References: <jjl4q3$pab$>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: 1331594964 22668 (12 Mar 2012 23:29:24 GMT)
NNTP-Posting-Date: Mon, 12 Mar 2012 23:29:24 +0000 (UTC)
Cc: Gabriela Sicilia <>
In-Reply-To: <jjl4q3$pab$>
Injection-Info:; posting-host=; posting-account=nd8I7gkAAAAk0q-yI51G_oj5pmpGOX6S
User-Agent: G2/1.0
Xref: comp.soft-sys.matlab:760730

On Tuesday, March 13, 2012 4:30:11 AM UTC+13, Gabriela Sicilia wrote:
> Hello, I need to generate three random correlated variables: corr (x1,x2 )= -0,9; corr (x1,x3)= 0.9 and corr (x2, x3) =0.

That pattern of correlations is impossible.  With the specified x1/x2 and x1/x3 correlations, the x2/x3 correlation must be negative.

>In addition, x1 and x1 are uniform (a,b) distributed and x2 is a normal (mu, sigma) distributed variable. 
As others have mentioned, there are various ways of producing correlations when some of the marginals are not normal.  At the  link below is a program that can be used to generate correlated non-normal random variables in a few different ways (described in its documentation).  Sorry this is not matlab code, but you could use it to generate the values externally and then read them into matlab.

Of course, first you must select a correlation matrix that is possible.