User Tools

Site Tools


gibson:teaching:summer-2017:techcamp:computer-homerun

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
gibson:teaching:summer-2017:techcamp:computer-homerun [2017/07/17 19:59]
gibson [Hitting a home run on a computer]
gibson:teaching:summer-2017:techcamp:computer-homerun [2017/07/18 07:27] (current)
gibson
Line 6: Line 6:
 <code matlab> <code matlab>
 function hitball(v, theta) function hitball(v, theta)
 +% simulate trajectory of a baseball hit with speed v (m/s) and angle (degrees)
 +% make a plot and determine if it clears the 17 ft outfield fence at 3
 +
   x = 0.0;      % horizontal position of home plate, meters   x = 0.0;      % horizontal position of home plate, meters
   y = 1.0;      % height of ball over strike zone   y = 1.0;      % height of ball over strike zone
Line 50: Line 53:
 </​code>​ </​code>​
  
-Now you can try different speeds $v$ and angles $\theta$ by just typing ​+Now you can try different speeds $v$ and angles $\theta$ by calling the ``hitball`` function at the Matlab prompt. For example, to compute the trajectory for $v=20$ and $\theta = 70^\circ$, type
  
 <code matlab> <code matlab>
gibson/teaching/summer-2017/techcamp/computer-homerun.1500346756.txt.gz ยท Last modified: 2017/07/17 19:59 by gibson