how can I plot random points in a random area
10 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi everyone,
Thank you all who are already trying to help me and appologies for keep asking questions.
In this thread I want to learn from experts following:
1.How to Plot 'n' number of points randomly in one of the following 3D spaces/regions i.e. (cube/3d Rectangular/Speherical).
2.the code should randomly pick one of the spaces each timeand then plot 'n' random points uniformly in that space.
3.once plotted how can I obtain the location information of each point centrally? May be at an additional point/gateway at the origin.
I know there are many questions within one question but it is important to explain to someone who is trying to help you what exactly you wish to do. Any help for even a partial code would be appretiated.
I have already accomplished how to distribute random points on a 3d rectangular plot but the point which I am unsure about how to do the same when the dimentions of plot are to be randomly picked from a set of polar and rectangular coordinates.
0 Commenti
Risposte (1)
Ameer Hamza
il 5 Set 2020
Here is an example to plot points in spherical coordinates
n = 1000; % number of points
az = rand(1, n)*2*pi; % azimuth angle in range [0, 2*pi]
elev = rand(1, n)*2*pi - pi; % elevation angle in range [-pi, pi]
r = rand(1, n)*2; % radius in range [0, 3]
[x, y, z] = sph2cart(az, elev, r);
plot3(x, y, z, '+')
9 Commenti
Tamoor Shafique
il 9 Set 2020
You are right I have to modify the code for generating points inside a spherical boundary but switch command helped me to choose one of the three random cases
Vedere anche
Categorie
Scopri di più su Random Number Generation in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!