View source: R/particle_functions.R
Vicsek | R Documentation |
Simulates particle movement according to the Vicsek model, where particles align their velocities with neighboring particles within a specified radius, subject to noise. The model implements both Gaussian and uniform noise options.
Vicsek(p0, v0, theta0, v_abs, n_t, T_sim, h, cut_r,
sigma_0, noise_type = "Gaussian")
p0 |
A numeric vector of initial positions for all particles, structured as (x1, y1, x2, y2, ..., xn, yn). |
v0 |
A numeric vector of initial velocities for all particles, structured similarly to p0. |
theta0 |
A numeric vector of initial angles for all particles. |
v_abs |
A numeric value specifying the absolute velocity (speed) of particles. |
n_t |
An integer specifying the number of particles. |
T_sim |
An integer specifying the number of time steps to simulate. |
h |
A numeric value specifying the time step size. |
cut_r |
A numeric value specifying the interaction radius within which particles align. |
sigma_0 |
A numeric value specifying the noise strength. |
noise_type |
A character string specifying the type of noise: either "Gaussian" (default) or "Uniform". |
Returns a list with three components:
pos |
A matrix of dimension (2*n_t) x (T_sim+1) containing particle positions at each time step. |
v |
A matrix of dimension (2*n_t) x (T_sim+1) containing particle velocities at each time step. |
theta |
A matrix of dimension n_t x (T_sim+1) containing particle angles at each time step. |
Vicsek, T., Czirok, A., Ben-Jacob, E., Cohen, I., & Shochet, O. (1995). Novel type of phase transition in a system of self-driven particles, Physical Review Letters, 75(6), 1226.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.