Skip to content

bethel-physics/hw_projectiles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

hw_projectiles

Homework for Garcia Ch. 2, projectile motion

Contents

GUI Tutorial (in class)

Follow the GUI tutorial to create a 4-function calculator GUI! Add your calculator GUI files to github.

Problem 1 (in class)

Complete the function in projectiles.m to compute the trajectory of a projectile under the influence of gravity alone using the Euler, Euler-Cromer, and Midpoint methods. Using the initial conditions that are provided as inputs and computed already, implement a time step loop that updates the position and velocity of the projectile.

  • Calculate the position analytically to compare to your numerical method
  • Calculate Euler, Euler-Cromer, and Midpoint method updates for position and velocity at each time step, depending on which method was given as a function argument.
  • Store horizontal and vertical positions for plotting
  • Break the time step loop when the particle hits the ground
  • Plot the trajectory of the projectile (y vs x position) for the analytical solution and the chosen numerical solution on the same graph in different styles.

Test the code for the initial conditions and parameters of Garcia Figure 2.2 (x0 = y0 = 0, v0 = 15 m/s, θ0=45°, τ = 0.1 s, no drag). The final function input parameter can be used to control the numerical method; such as 1 = Euler, 2 = Euler-Cromer, 3 = Midpoint.

Execute this command in the Command Window to test using Method 1 (whatever that is for you):

>> projectiles(0, 15, 45, 0, 0.1, 1)

Problem 2 (homework)

Wrap your program in a GUI! The GUI can be as creative as you'd like, but should prompt the user to enter initial conditions and choose a calculation method. A basic functional GUI is shown below.

  • Test the code for the different methods using the same initial conditions and parameters.
  • What conclusions can be drawn about the performance of the different methods? Write your answer in a commented paragraph at the end of projectiles.m.

Problem 3 (homework)

Add the option to include an air resistance force on the projectile. This term will modify the net force (and acceleration) on the projectile. Thus, the net force on the projectile becomes:

Here, ρ = density of air = 1.2 kg/m3, Cd = drag coefficient = 0.35 for a baseball, A = cross-sectional area of the projectile (R = 0.037 m for a baseball), and m = projectile mass = 0.145 kg for a baseball.

Test your program for the launch of a baseball with the following initial conditions (x0 = y0 = 0, v0 = 55 m/s, θ0 = 45°, τ = 0.1 s).

Display your results as a figure with two subplots: one subplot displays the projectile trajectory (x vs. y); the other subplot displays the projectile velocity magnitude versus time.

Problem 4 (homework)

The drag coefficient for a baseball actually varies with velocity. Modify your program to account for a drag coefficient that varies with velocity according to the table shown. Use linear interpolation to determine the drag coefficient for speeds between values in the table. Test your conditions for the same initial conditions and parameters as in Problem #1.

Display your results as a figure with two subplots: one subplot displays the projectile trajectory (x vs. y); the other subplot displays the projectile velocity magnitude versus time.

v (m/s) Cd
0 0.5
11 0.5
22 0.5
33 0.4
44 0.28
55 0.23
55+ 0.23

About

Homework for Garcia Ch. 2, projectile motion

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages