Effacer les filtres
Effacer les filtres

How to distribute random points according to the Epanechnikov distribution values

7 vues (au cours des 30 derniers jours)
azdoud youssef
azdoud youssef le 23 Déc 2017
Modifié(e) : Roger Stafford le 23 Déc 2017
I want to get random points according to local maxima of the Epanechnikov distribution, such that the density of points is higher at the local maxima and the density of the points decreases in the minimum value.

Réponses (1)

Roger Stafford
Roger Stafford le 23 Déc 2017
Modifié(e) : Roger Stafford le 23 Déc 2017
(Correction: I have eliminated the 1) version of the preceding answer, since it was incorrect.)
I interpret your 2D Epanechnikov distribution for random points in the following way. Both x and y coordinates of the points have independent Epanechnikov distributions with respect to a center (x0,y0). The points are restricted to a square.
x0 = 4; y0 = 6; % <-- Choose center of square
L = 14; % <-- Choose length of square sides
n = 8192; % <-- Choose number of points
x = x0+(sin(asin(2*rand(1,n)-1)/3))*L;
y = y0+(sin(asin(2*rand(1,n)-1)/3))*L;
X = x0+[-1,1,1,-1,-1]*L/2;
Y = y0+[-1,-1,1,1,-1]*L/2;
plot(X,Y,'r-',x,y,'y.')
axis equal
See https://www.mathworks.com/matlabcentral/answers/374276 for remarks about the method used to generate the Epanechnikov distribution.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by