4.0

4.0 | 8 ratings Rate this file 11 Downloads (last 30 days) File Size: 4.32 KB File ID: #20759
image thumbnail

Billiards

by Peter van Alem

 

17 Jul 2008 (Updated 29 Oct 2011)

Simulation of elastic collisions of balls of different sizes.

| Watch this File

File Information
Description

Purely elastic collisions.

MATLAB release MATLAB 7.12 (2011a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (8)
18 Jul 2008 Guillaume Jacquenot

Nice program
However you do not exploit MatLab matrix computation abilities: You should avoid as much as possible "for" loop, which are really time consuming. In your case, Have a look to the meshgrid command. I bet you can remove all "for" loops except for the plot command.

You can also add a test to analyze the number input argument such as
if nargin == 0
    NumberOfBalls = 10
end

The function normr is not a standard function, which people may not have with standard MatLab

You should also recommend the maximum number of balls, and alert in case of huge number.

18 Jul 2008 Jack Fowley

Works very nice. Great simulation!

20 Jul 2008 jichao zhao

that is excellent job. many thanks for sharing

01 Aug 2008 Francesco Pozzi

I like your simulation. I would appreciate if you could comment the code more extensively, use better the vectorization, follow the hints of Guillaume Jacquenot.

Perhaps you could insert a button to start and to stop the simulation, ask the user to choose the speed or other parameters (you could make a graphical user interface, a gui).

21 Aug 2008 Seungho Choi

What a shammy progrram :P
U are king wang jjang

16 Jan 2010 Rob Campbell

Nice effect. Downside is that code is somewhat confusingly laid out and it would benefit from vectorizing.

21 Aug 2010 mohamed

it is nice program but when stops simulation
thanks

01 Nov 2011 Sahrul Hidayat

nice simulation, but difficult to stop. Thanks

Please login to add a comment or rating.
Updates
16 Oct 2008

Some commentary is used to improve the code.

29 Oct 2011

Two and three dimensional simulation, more use of vectorization and a minor bug is fixed.

Tag Activity for this File
Tag Applied By Date/Time
chemistry Peter van Alem 22 Oct 2008 10:10:41
physics Peter van Alem 22 Oct 2008 10:10:41
billiards Peter van Alem 22 Oct 2008 10:10:41
pool Peter van Alem 22 Oct 2008 10:10:41
elastic Peter van Alem 22 Oct 2008 10:10:41
balls Peter van Alem 22 Oct 2008 10:10:41
collision Peter van Alem 22 Oct 2008 10:10:41
snooker Peter van Alem 22 Oct 2008 10:10:41
collision Max Repupilli 11 Apr 2009 21:50:44

Contact us at files@mathworks.com