Cumulative radial distribution of particle centers
Mostrar comentarios más antiguos
Hi, I have just started working with Matlab. Need some help to initiate my following task.
I want to find out the cumulative radial distribution of particle centers by drawing spheres of radius 'R'. Initially the value of radius 'R' will be zero and it will increment with a value 'delta R' in each step. In each step the program should calculate the number of particle centers falling inside the sphere and it will terminate when all the given particle centers covered. In the end I want the code to plot a graph between 'reduced radial distance from centers vs Included particles'
I have particle centers in 3D and also their radius as they are itself considered as spheres. The starting point for the sphere of radius 'R' is the geometric center of the system which I also need to calculate.
2 comentarios
Image Analyst
el 30 de Mzo. de 2016
Are the particles themselves spheres? So that you have a bunch of spheres of increasing radius? And you place each new sphere such that it does not overlap/intersect existing spheres, so that you need to keep getting/testing random locations until the new sphere would fit? And then you want to find how how many individual small spheres are in a bigger containing sphere of radius "R"?
Respuesta aceptada
Más respuestas (1)
John D'Errico
el 30 de Mzo. de 2016
0 votos
You are looking at this the wrong way. First, NEVER reinvent the wheel. Use existing, high quality code written by professionals before stepping in and writing your own, especially if you are a novice to programming. Otherwise, you will find yourself overwhelmed with the complexities of dealing with a poorly written, inefficient code.
You are looking for a histogram, or perhaps a cumulative histogram. There are tools for this already written.
Just compute the set of distances from the origin, then call the appropriate histogram tool. I honestly can't recall if there is a cumhist tool in MATLAB. I think so, but it is easily cobbled from hist itself anyway, and I won't have access to MATLAB for the next day or so. A google search for cumhist did show MATLAB code.
1 comentario
yu sh
el 30 de Mzo. de 2016
Categorías
Más información sobre Mathematics en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
