Matlab program for reaction diffusion system

Click For Summary
SUMMARY

The discussion focuses on modeling a reaction-diffusion system using MATLAB, specifically with a setup of 4 particles on a lattice of 15 sites. The user has implemented a random walk for the particles but is struggling with detecting when two particles occupy the same lattice point for annihilation. The proposed solution includes creating a class to represent particles, which would encapsulate their identity and movement methods, along with a method to check for collisions on the lattice.

PREREQUISITES
  • Familiarity with MATLAB programming
  • Understanding of random walk algorithms
  • Basic knowledge of object-oriented programming concepts
  • Concept of lattice structures in computational modeling
NEXT STEPS
  • Implement MATLAB classes to represent particles and their behaviors
  • Research collision detection algorithms for particles on a lattice
  • Explore advanced random walk techniques in MATLAB
  • Study reaction-diffusion systems in computational physics
USEFUL FOR

Researchers, computational physicists, and MATLAB programmers interested in modeling particle interactions and reaction-diffusion systems.

yaboidjaf
Messages
5
Reaction score
0
I'm trying to model a reaction-diffusion system on MATLAB and am struggling.
I'm starting off with 4 particles on a lattice with 15 sites for ease, will take it to a larger scale when I've got the simple version down. the idea is to get randomly walking particles to eventually meet each other and annihiilate.

here's my program

%% getting annihilation to work for 4 particles on 15 lattice sites
clear all
array = round(15*rand(1,4)) % 2 particle system on 10 lattice sites
jump = rand(1,4) % generate 2 random numbers, one for each particle
for x = 1:4
if jump(x) <= 0.5 %if the corresponding number is less than 0.5, the particle moves left, else right.
array(x) = array(x) - 1;
else
array(x) = array(x) + 1;
end
end

so i have the particles all conducting random walks (not sure if it's the best way), but I'm not sure how to go about identifying whether two particles are on the same lattice point and how to go about getting them to annihilate. i have a feeling the way my walks are set up it would be difficult to do so.
 
Physics news on Phys.org
It might be easier to create a class that will represent the particles. The class can have a particle-identity and walk method. Another method could be used to test if particles are on the same site.
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
8K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 41 ·
2
Replies
41
Views
10K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 6 ·
Replies
6
Views
6K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 0 ·
Replies
0
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
5
Views
5K