Montecarlo method for particle simulation
8 次查看(过去 30 天)
显示 更早的评论
Hi all,
I have to simulate a number of particle with a initial random velocity along z axis emitted by a point source and distributed inside a solid angle passing through a pinhole. I would like to "kill" particles that cannot pass through the pinhole becuase of the angular spread and mantain those that can pass.
Is there any example I can use to write this simulation?
0 个评论
采纳的回答
Image Analyst
2012-2-8
It's really not that hard. Have a for loop over a bunch of particles. For each particle, set its velocity (speed and angle) vector using the rand() function. Then use an "if" statement to decide whether the particle passed through or not and count those that do. It's like 7-10 lines or so.
0 个评论
更多回答(3 个)
Francesco
2012-2-9
1 个评论
Image Analyst
2012-2-9
You need to figure out what the distance is from the start, and where that particular particle would hit laterally the blocking screen/aperture plane, and decide if that location is within the pinhole locations or not.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Particle & Nuclear Physics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!