Verified MATLAB & Simulink Project

Lenia Simulation in MATLAB: A Self-Replicating Cellular Automaton

Lenia Simulation in MATLAB: Continuous Cellular Automaton Guide – MATLAB Simulation Video
YouTube Watch Full Simulation Free Preview
MATLAB R2020a - R2024b
Zero Convergence Errors
Simscape / SimPowerSystems
Need This Simulation?

Get in touch with our PhD MATLAB simulation team for customized code, parameters, or complete thesis models.

Talk to Simulation Expert
What we offer:
  • Custom MATLAB/Simulink solutions
  • 1-on-1 Expert consultation
  • Flexible pricing & 100% bug-free guarantee

What is Lenia Simulation in MATLAB: A Self-Replicating Cellular Automaton?

Lenia Simulation in MATLAB: A Self-Replicating Cellular Automaton is a MATLAB-based technical project and simulation model. Lenia is a continuous family of cellular automata that extends Conway's classic Game of Life into continuous space, continuous states bounded between 0 and 1, and continuous differential time. Unlike traditional discrete grid systems that rely on binary cell states and nearest-neighbor counting, Lenia calculates neighborhood influences using spatial convolutions with multi-ring circular kernels, mapped through smooth non-linear growth functions. These continuous mechanics produce organic artificial life behaviors, including self-organizing solitary wave patterns (solitons), locomotion, rotation, and self-replicating virtual organisms such as the Orbium species. In MATLAB, Lenia simulations achieve high frame rates by computing 2D spatial convolutions in the frequency domain using the Fast Fourier Transform (fft2 and ifft2) and executing parallel state updates with GPU acceleration. This project covers the mathematical derivation of Lenia dynamics, multi-ring kernel generation, Fourier-based convolution, Gaussian growth mapping, and real-time visualization of self-replicating artificial lifeforms in MATLAB.

Project Methodology

The mathematical formulation, simulation engine development, and visual rendering of Lenia in MATLAB follows a structured computational physics and artificial life workflow:

  1. Continuous Grid & Domain Definition: Initialize an N-by-N periodic 2D toroidal lattice in MATLAB (e.g., 256x256 or 512x512 resolution), where each spatial grid cell A(x, y, t) stores a continuous real-valued scalar state restricted to the interval [0, 1].
  2. Concentric Ring Neighborhood Kernel Construction:
    • Calculate normalized Euclidean radial distance matrices from the kernel center: r = √(x² + y²) / R, where R is the outer neighborhood radius.
    • Construct single-ring or multi-ring kernel profiles using smooth bell-shaped core functions and normalize the total kernel volume such that the sum of all elements equals 1.
  3. Fourier-Accelerated Convolution: Compute the continuous neighborhood potential field U = A * K in the frequency domain using MATLAB 2D Fast Fourier Transforms:
    U = real(ifft2(fft2(A) .* fft2(K_shifted))).
    This approach reduces spatial convolution complexity from O(N&sup4;) to O(N² log N) while naturally applying periodic boundary conditions.
  4. Gaussian Growth Mapping Formulation: Pass the potential field U through a smooth, non-linear Gaussian growth mapping function:
    G(u) = 2 × exp(-((u - μ)²) / (2 × σ²)) - 1,
    where μ represents the optimal growth center and σ defines the tolerance width, producing growth rates ranging from -1 (decay) to +1 (birth).
  5. Euler Time-Stepping & State Clipping: Advance the simulation forward in time using continuous differential Euler integration with a fractional time step dt (e.g., dt = 0.1):
    A(t + dt) = min(max(A(t) + dt × G(U), 0), 1).
  6. Creature Seeding & Parameter Presets: Configure mathematical parameter presets (radius R, growth center μ, growth width σ, time step dt) and inject localized initial state distributions to generate recognized artificial life species, including stationary solitons, crawling gliders, and self-dividing clusters.
  7. Real-Time Rendering & Morphological Analysis: Render the live continuous state field using custom perceptually uniform colormaps in MATLAB (imshow / imagesc), logging morphological metrics including creature center of mass, translational velocity, and structural stability, and recording simulation frames via VideoWriter.

Verified MATLAB Simulation Code Demonstration

Syntax-highlighted executable code demonstration for Lenia Simulation in MATLAB: A Self-Replicating Cellular Automaton:

MATLAB signal_fft_analysis.m
% Spectral FFT Analysis & Signal Filtering
clc; clear; close all;

Fs = 1000; T = 1/Fs; L = 1500; t = (0:L-1)*T;
S = 0.7*sin(2*pi*50*t) + sin(2*pi*120*t);
X = S + 2*randn(size(t));

% Compute Fast Fourier Transform (FFT)
Y = fft(X);
P2 = abs(Y/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
f = Fs*(0:(L/2))/L;

fprintf('FFT Spectral Analysis Computed Successfully!\n');
Lenia Simulation in MATLAB: A Self-Replicating Cellular Automaton $50.00
$50.00