random number generator of normal distribution in 2D
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi, does some of you know if is availiable in Matlab a function that generates random numbers from the 2D normal distribution with mean parameter mu and standard deviation parameter sigma provided in the two dimensions? And also the function to get the Gaussian curve corresponding. Something equivalent to: x = normrnd(mean,sigma,npoint); y = gaussmf(x,[sigma mean]); but in 2D.
Many thanks
Camilla
0 Kommentare
Antworten (2)
Bjorn Gustavsson
am 27 Mai 2011
Maybe something like this for the 2-D random points scattered around r0 with a 2-D normal distribution with major and minor widths of sigma1 and 2 rotated phi radians.
r(1,:) = sigma1*randn([nx*ny,1]); r(2,:) = sigma2*randn([nx*ny,1]);
rotM = [cos(phi) -sin(phi);sin(phi) cos(phi)]; r = rotM*r; r0 = [x0,y0];
r(1,:) = r(1,:) + r0(1); r(2,:) = r(2,:) + r0(2);
HTH, Bjoern
0 Kommentare
Tom Lane
am 29 Mai 2011
Camilla, if you have normrnd then you must have the Statistics Toolbox. In that case check out the mvnrnd function for random number generation, and mvnpdf for the density function.
-- Tom
0 Kommentare
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!