Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
Emilio Martines wrote: > Hello, I am looking for a routine to generate random 3-component vectors > sampled from a 3-dimensional normal distribution (with non-zero covariances of > course...). I think that I know how to write it, but being rather lazy I hope > that someone out there has already done it... Thanks in advance. All you need to do is generate each component from independent normal distributions. -- Ewan Macpherson <emacpher@umich.edu> Central Systems Laboratory Kresge Hearing Research Institute http://www-personal.umich.edu/~emacpher
I sent by mistake my reply just to Ewan Macpherson, instead of the whole newsgroup. However, since it might be of interest to other people, I post it here together with his reply. >>> >>> All you need to do is generate each component from >>> independent normal distributions. >>> >> >> Hmmm... I might be wrong, but I think that this is true only if the >> covariance matrix (the 3X3 matrix made up of variances and >> covariances) is diagonal. In the other cases, I should find the >> basis where it is diagonal, sample from independent normal >> distributions, and then go back to the original basis. Just some >> linear algebra. > > Yes indeed. I misread the part of your message where you > specified NON-zero covariances. Oops! > cheers, > -- > Ewan Macpherson <emacpher@umich.edu> > Central Systems Laboratory > Kresge Hearing Research Institute > http://www-personal.umich.edu/~emacpher So, thanks Ewan for your attempt. Of course, my original request is still valid. Greetings to everyone. Emilio