help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Distribution ...


From: Ted Harding
Subject: Re: Distribution ...
Date: Sun, 26 Mar 1995 15:46:56 +0200 (BST)

( Re Message From: Arman Ali Anwar )
> 
> 
> I need to genrate 2D normal distributions ...
> 
> I need to specify specific means and variances ...
> 
> could someone please tell me how to do this :-)
> 
> Thanks in ADVANCE :-)
> 
> please send all responses to address@hidden
> 
> Arman.
> 
Let mx, my, vx, vy and cxy be the desired means, variances, and covariance.
Let rxy = cxy/sqrt(vx*vy) be the correlation.
Let a = sqrt( abs(rxy)/(1-abs(rxy)) )), sx = sqrt(vx), sy = sqrt(vy).

    rand('normal');
    U = rand(N,1); V = rand(N,1); W = rand(N,1);
    X = mx + (U + a*W)*sx/sqrt(1+a*a);
    Y = my + (V (+/-) a*W)*sy/sqrt(1+a*a);

                  ^
                  |
( + for positive correlation, - for negative).

That's it.

Ted.                                     (address@hidden)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]