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 CenterMATLAB Answers에서 Physics에 대해 자세히 알아보기

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