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

MATLAB HELP ! From elementary physics and Homework #1, we know that the distance

ID: 1720175 • Letter: M

Question

MATLAB HELP !

From elementary physics and Homework #1, we know that the distance a projectile travels when fired from, eg, a cannon depends on both the initial velocity v and the launch angle theta: x(t) = v tcos(theta) y(t) = v t sin(theta) - 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. Self check: It lands really, really, close to the cannon after x. 7xx7 seconds

Explanation / Answer

MATLAB Code:

First write a function called f.m as follows

function f = y(t)
v = 13.5; a = (89*pi)/180; g = 9.8;
f = v*t*sin(a) - 0.5*g*t.^2;   

save f.m in MATLAB path

Now we have to find zero of y(t) near 2 because from the plot of y(t) there is a sign change of y(t) near 2

fun = @f; %function
to = 1.5; % initial point
t = fzero(fun,to); % finding zero of y(t)
v = 13.5; a = (89*pi)/180; g = 9.8;
x= v*t*cos(a); % finding range at zero value

Results:

t = 2.7547

x = 0.6490