Two correlated random variables

15 views (last 30 days)
Charles on 1 Mar 2016
Commented: Charles on 2 Mar 2016
I want a formula to generate two random variables X and Y that are correlated with a certain rho and distributed (0, 1). The formula provided by all the sources I saw is (a few are provided below) is:
rho = 0.9; %for example
x = rand(); X = x;
y = rand();
Y = rho*X + sqrt(1-rho^2)*y;
However, the Y values generated are not distributed between 0 and 1 (however, the corelation is correct). Please see the attahced image. Does anyone have a better formula? Thanks.
Charles on 2 Mar 2016
Thank you for your time and detailed response. I think I wrongly interpreted/modelled the system. Your response helped with the understanding of my data. Thanks.

Sign in to comment.

Answers (0)


Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!