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!