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
3 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
Walter Roberson
2013 年 12 月 17 日
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 件のコメント
その他の回答 (0 件)
参考
カテゴリ
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!