# ENGR112 HW5 FZero whileS19.docx - Week 5 Homework Name...

• 13
• 100% (2) 2 out of 2 people found this document helpful

This preview shows page 1 - 4 out of 13 pages.

Week 5 Homework ENGR 112 Fzero while Name: Yuanbo Jiang Lab Time ECampus Names of people you worked with: N/A Websites you used: - intersections-between-two-functions Approximately how many hours did it take you to complete this assignment (to nearest whole number)? 9 By writing or typing your name below you affirm that all of the work contained herein is your own, and was not copied or copied and altered. Yuanbo Jiang Note: Failure to sign this page will result in a 50-point penalty. Failure to list people you worked with may result in no grade for this homework. Failure to fill out hours approximation will result in a 10-point penalty. Turn .zip files to Canvas or your assignment will not be graded
Week 5 Homework ENGR 112 Fzero while Learning Objectives: More practice with for loops and if statements More practice with using functions as inputs to other functions More practice writing functions Homework Guidelines: 1) Whenever you create a function, you must decide what goes into the function and what goes into the calling script. For example, do you pass gravity in as a variable or do you just set it in the function? Document your choices. 2) There is more than one right way to answer these homework problems. If you come up with a different answer than your fellow classmates, discuss the relative merits of each answer (is it clear? Is it more/less generalizable?) Specific Coding Notes: Debugging: Set a break point at the first line of your function file. This way, you can see what happens in the function file. First, check that the parameters that got passed in have the values you expect. Second, make sure the output variable(s) are set correctly. Grading Checkpoints Criteria Component No Yes [20%] Comments and Pseudocode Declared units on all variables? English description of problem at top? Comments outlining your steps? [10%] Output formatting Used fprintf() to make complete sentences (when required)? Correct units on answers? Correct number of decimal places? [70%] Functionality Script computes correct value(s)? Correctly converted units in script when needed?
Week 5 Homework ENGR 112 Fzero while Problem 1 From elementary physics and Homework #1, we know that the distance a projectile travels when fired from a cannon depends on both the initial velocity v and the launch angle θ: x ( t )= vt cos ( θ ) y ( t )= v t sin ( θ ) 1 2 gt 2 where x(t) and y(t) are the distances traveled in x and y, respectively, after time t has passed (g is gravity, g = 9.8 meters/second 2 ). Assume an initial velocity of 13.5 meters per second and an angle of 89 degrees above the ground. Use fzero to find the time and x location where the projectile hits the ground . Print the time and location to 4 decimal places.