Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

3. 2426 (version 343) Write a MATLAB function named my_shot The function will ha

ID: 3750367 • Letter: 3

Question

3. 2426 (version 343) Write a MATLAB function named my_shot The function will have four inputs and one return value oThe first input will be an angle (a, in degrees) o The second input will be a velocity value (v, in m/s) The third input will be a value for gravity (g, in m/s/s) The fourth input will be a value for the ending time (tmax, in seconds) The return value of the function should be a single value that is the maximum y value. . To determine the return value: generate a list of 200 equally spaced time values (t) from 0 to tmax ogenerate the corresponding y values using this equation vsin(a)t -gt o return the maximum y value 2 Notes: Example Test Case : Y=my-shot(45, 20, 9.81, 4); results in Y-10.1935 · DO NOT include test cases.

Explanation / Answer

Program

function max_shot = my_shot(a, v, g, t)
t = linspace(0, t, 200) % generate equally spaced numbers for t
y = v * sin(a) * t - 0.5 * g * t.^2 % calculating the value of y
Y = max(y) % finding max from all y

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote