Single Particle Gas Simulation

Live Script that simulates an ideal gas composed of a single particle moving in between converging walls.
2 Downloads
Updated 23 May 2024

View License

If you compress or pull on a gas in a container, the gas behaves like a spring. This well known fact reflects countless (by a human) collisions of molecules with the container walls and is a basis for counting the number of molecular degrees of freedom at a given temperature with simple macroscopic observations revealing the quantum nature of their submicroscopic degrees of freedom. [1] But what if it was a single particle gas?
This Live Script simulates a single particle moving freely between a fixed wall and a plunger as the plunger compresses or expands the available volume. The collision times and changing particle velocity and plunger position are calculated explicitly and the average pressure, internal energy, and work done on the gas are calculated as functions of volume.
For elastic collisions with the plunger, the pressure-volume relationship is as expected for adiabatic compression. For inelastic collisions conserving the particle speed, the pressure-volume relationship is that expected for isothermal compression. Collisions with intermediate energy transfer result in intermediate thermodynamic relationships.
This script may interest students and instructors of physics and other fields. The script containers sliders so the user may adjust various parameters and explore.

Cite As

Duncan Carlsmith (2024). Single Particle Gas Simulation (https://www.mathworks.com/matlabcentral/fileexchange/166386-single-particle-gas-simulation), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2024a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

SingleParticleGasSimulation folder

Version Published Release Notes
1.0.0