Ball Collision Simulation

Version 1.4.0.0 (14,9 ko) par Ligong Han
This is a simple physics engine for simulating sphere collision.
1,2K téléchargements
Mise à jour 16 jan. 2015

Afficher la licence

This matlab function simply simulates the collision of balls. Each ball has three properties: radius, mass and charge quantity. The program detects possible collisions in each frame.
Examples:
>>SphereCollider([1.25 1 0;1.25 1 0],[-5 0 0;1.25 0 0],[3 0 0;0 0 0],...
'g',0,'debug','off','t',25)
>>SphereCollider('g',0,'debug','off')
>>SphereCollider([1 1 0],[0 0 0],[0 0 0],...
'GravityVec',[0 -1 0],'GroundPoint',[0 -10 0],...
'g',1,'dt',0.025,'debug','on','t',20)
>>SphereCollider([0.5 1 0],[-5 0 0],[0 1.15 0],...
'sphere',[2 0 0 0],'GravitySrc',[10 0 0 0],...
'G',-1,'g',0,'debug','off','t',300)
The movement of walls is defined by anonymous functions of time. The corresponding input argument is a cell that contains handles of such functions,
{...
{@(t) vx, @(t) vy, @(t) vz},... velocity of the first wall
{@(t) vx, @(t) vy, @(t) vz},... velocity of the second wall
...
}
For example:
f1 = @(t) 0.2*heaviside(t)-0.2*heaviside(t-20);
f2 = @(t) 0;
v = {{f1,f2,f2}};
SphereCollider([1 1 0;1 1 0;1 1 0],[0 4 0;0 -4 0;-4 0 0],[2 -2 0;1 1 0;2 4 0],'sphere',[2 0 0 0],'g',0,'debug','off','t',250,'sphere_velocity',v)

Citation pour cette source

Ligong Han (2024). Ball Collision Simulation (https://www.mathworks.com/matlabcentral/fileexchange/41032-ball-collision-simulation), MATLAB Central File Exchange. Récupéré le .

Compatibilité avec les versions de MATLAB
Créé avec R2012a
Compatible avec toutes les versions
Plateformes compatibles
Windows macOS Linux
Catégories
En savoir plus sur Physics dans Help Center et MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Version Publié le Notes de version
1.4.0.0

- problems with parameter assignment fixed
- new demos added
- I include IdealGasSimulation.m in this submittion

1.3.0.0

- new feature added, walls can move now
- added demos

1.2.0.0

minor bug fixes

1.0.0.0