Ball Collision Simulation

バージョン 1.4.0.0 (14.9 KB) 作成者: Ligong Han
This is a simple physics engine for simulating sphere collision.
ダウンロード: 1.2K
更新 2015/1/16

ライセンスの表示

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)

引用

Ligong Han (2024). Ball Collision Simulation (https://www.mathworks.com/matlabcentral/fileexchange/41032-ball-collision-simulation), MATLAB Central File Exchange. 取得済み .

MATLAB リリースの互換性
作成: R2012a
すべてのリリースと互換性あり
プラットフォームの互換性
Windows macOS Linux
カテゴリ
Help Center および MATLAB AnswersPhysics についてさらに検索
タグ タグを追加

Community Treasure Hunt

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

Start Hunting!
バージョン 公開済み リリース ノート
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