<meta http-equiv="refresh" content="1; url=/nojavascript/"> A Modeling Example: Counting Ping Pong Balls | CK-12 Foundation
Skip Navigation
You are reading an older version of this FlexBook® textbook: Engineering: An Introduction to Solving Engineering Problems with Matlab Go to the latest version.

6.2: A Modeling Example: Counting Ping Pong Balls

Difficulty Level: At Grade Created by: CK-12

Suppose you have a cylinder of height h with base diameter b (perhaps an empty pretzel jar), and you wish to know how many ping-pong balls of diameter d have been placed inside the cylinder. How could you determine this? This problem, along with the strategy for computing the lower bound on the number of ping-pong balls, is adapted from Starfield (1994).

A lower bound for this problem is found as follows. Define the following variables:

  • N_L-Lower bound on the number of balls that fit into the cylinder.
  • V_{cyl}-The volume of the cylinder.
  • V_{cube}-The volume of a cube that encloses a single ball.

V_{cyl} & = h\pi(\tfrac{b}{2})^2 \\V_{cube} & = d^3

The lower bound N_L is found by dividing the volume of the cylinder by the volume of the cube enclosing a single ball:

N_L = \tfrac{V_{cyl}}{V_{cube}}

Exercise 11

You are given the following values:

  • d = 1.54\;\mathrm{in}
  • b = 8\;\mathrm{in}
  • h = 14 \;\mathrm{in}

Type commands at the command line prompt to compute N_L.

Exercise 12

Create an m-file to solve Exercise 11.

To complicate your problem, suppose that you have not been given values for d, b, and h. Instead you are required to estimate the number of ping pong balls for many different possible combinations of these variables (perhaps 50 or more combinations). How can you automate this computation?

One way to automate the computation of N_L for many different combinations of parameter values is to use a for loop. The following exercises ask you to develop several different ways that for loops can be used to automate these computations.

Exercise 13

Add a for loop to your m-file from Exercise 12 to compute N_L for b = 8 \;\mathrm{in}, h = 14 \;\mathrm{in}, and values of d ranging from 1.0 \;\mathrm{in} to 2.0 \;\mathrm{in}.

Exercise 14

Modify your m-file from Exercise 13 to plot N_L as a function of d for b = 8 \;\mathrm{in} and h = 14 \;\mathrm{in}.

Exercise 15

Modify your m-file from Exercise 13 to compute N_L for d = 1.54 \;\mathrm{in} and various values of b and h.

Image Attributions




Date Created:

Feb 23, 2012

Last Modified:

Sep 15, 2014
Files can only be attached to the latest version of None


Please wait...
Please wait...
Image Detail
Sizes: Medium | Original

Original text