Write a function that accepts variable number of arguments W
Write a function that accepts variable number of arguments
Write a function that returns multiple arguments
Use fprintf (or sprintf) for formated output to the screen
Review physics of a projectile trajectory with no air resistance
Instructions
Write a Matlab function called work09.m that computes the maximum horizontal and vertical distance of a projectile and the total travel time, given the firing angle and initial velocity. Also, accept a third optional parameter that adjusts the gravitational constant (g = 9.8065 m2/s default). The angle input is degrees from horizontal, and velocity is m/s. You may need to consult a physics textbook or a reputable web resource such as https://en.wikipedia.org/wiki/Projectile_motion.
Your function must do the following:
Use nargin to determine whether there is an optional g parameter given
Calculate the correct vertical and horizontal distances, and total travel time
Have sufficiently detailed comments in the appropriate location in the function such that typing help work09 would completely describe how to use your function
Use appropriate formatting for output information to the screen
Sample Output (four possibilities shown)
xm = 22.2621
ym = 4.3483
tm = 1.883
ans = 22.2621
Solution
have a class that holds an \"error\" function that will format some text. I want to accept a variable number of arguments and then format them using printf.
Example:
The Error method should take in the parameters, call printf/sprintf to format it and then do something with it. I don\'t want to write all the formatting myself so it makes sense to try and figure out how to use the existing formatting.
