I am trying to simulate Brownian motion where the initial position of the particles are generated by random number generators. I need to freeze the particles when it reaches a particular position, how can i do it? kindly help
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hari
le 17 Déc 2013
Réponse apportée : Walter Roberson
le 17 Déc 2013
I am trying to simulate Brownian motion where the initial position of the particles are generated by random number generators. I need to freeze the particles when it reaches a particular position, how can i do it? kindly help
0 commentaires
Réponse acceptée
Walter Roberson
le 17 Déc 2013
How not? Just stop updating those particles once you have detected they have reached the position.
You might want to do something like create a logical vector StillActive, initialized to all true. When the particle is in position, mark it false. Only do calculations on entries that are still true.
Positions(StillActive) = Positions(StillActive) + randn(sum(StillActive),1);
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Particle & Nuclear Physics dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!