4.0

4.0 | 8 ratings Rate this file 56 downloads (last 30 days) File Size: 2.21 KB File ID: #20759

Billiards

by Peter van Alem

 

17 Jul 2008 (Updated 16 Oct 2008)

Code covered by BSD License  

Simulation of elastic collisions of balls of different sizes

Download Now | Watch this File

File Information
Description

Purely elastic collisions. Acknowledgement: Fu-Kwun Hwang

Acknowledgements
This submission has inspired the following:
Confined
MATLAB release MATLAB 7.1.0 (R14SP3)
Zip File Content  
Other Files Billiards.m,
license.txt
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (7)
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

23 Jul 2008 Marco Pittaluga

Thank you for this program... i’m finding inspiration from your idea

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

28 Apr 2009 PXlab  
Please login to add a comment or rating.
Updates
16 Oct 2008

Some commentary is used to improve the code.

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
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com