how to produce a 2-D point distribution with normal density distribution
Afficher commentaires plus anciens
Hi: I am trying to simulate a galaxy distribution, in which all units are identical, but the local densities are different. Simply speaking, I need to produce a 2-D point distribution, say, 1000 identical points in a 10*10 square, then if I measure the local densities (for example, within a circle with radius=1), I could get a normal distribution of densities.
Maybe I did not explain it clearly, but just do not know how to do it, I can easily generate a data set with normal distribution value, but how to apply normal distribution on the position of 2-D points (move some together and take some apart) to get normal density distribution? thanks!
2 commentaires
Iman Ansari
le 30 Avr 2013
Modifié(e) : Iman Ansari
le 30 Avr 2013
See this: (mean zero and variance 1)
A=randn(1000,2);
x=A(:,1);
y=A(:,2);
plot(x,y,'Marker','.','LineStyle','none')
var(x)+1i*var(y)
mean(x)+1i*mean(y)
adameye adameye
le 1 Mai 2013
Réponses (3)
Iman Ansari
le 1 Mai 2013
With adding a number in x and y directions you can change their position, and the number multiplied changes their radius:
A=randn(3000,2);
x=A(:,1)';
y=A(:,2)';
x=[x(1:800)+3 1/2.*x(801:1800)-3 1.5.*x(1801:3000)+2];
y=[y(1:800)+4 1/2.*y(801:1800) 1.5.*y(1801:3000)-3];
plot(x,y,'Marker','.','LineStyle','none')
axis('equal')
var(x)+1i*var(y)
mean(x)+1i*mean(y)
1 commentaire
Random user
le 28 Mar 2017
Could you explain the code please? For example, if I want to make it more efficient, how would this be done in a loop? For example,
x=[x(1:800)+i-iterator 1/2.*x(801:1800)+i-iterator 1.5.*x(1801:3000)+i-iterator.....];
y=[y(1:800)+constant 1/2.*y(801:1800)+constant 1.5.*y(1801:3000)+constant.....];
If I wanted to use a loop, or any other vectorization method, how would this be done?
adameye adameye
le 1 Mai 2013
0 votes
1 commentaire
Iman Ansari
le 1 Mai 2013
Modifié(e) : Iman Ansari
le 1 Mai 2013
What do you mean from power spectrum?
adameye adameye
le 14 Mai 2013
0 votes
Catégories
En savoir plus sur Rician Distribution dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!