Question: MatLab Programming Question- A basket player throws a ball at a velocity of v0 ft/s at an angle of theta degrees standing 14 feet measured
MatLab Programming Question-
A basket player throws a ball at a velocity of v0 ft/s at an angle of theta degrees standing 14 feet measured horizontally from the basket which is 12 ft above the ground. The initial horizontal velocity is given by vx= v0*cosd(theta) ( the d signifies that the angle is specified in degrees, otherwise use cos(theta) if theta is in radians. And the initial vertical velocity is given by vy= v0*sind(theta). The distance traveled horizontally is given by x= vx*t where t is time in seconds. The distance travelled vertically is given by y= 7+vy*t g*t2 where g= acceleration due to gravity which can be taken to be 32.2 ft/s^2. Plot the trajectory of the ball, ie. y vs. x. What is the value of y when x is 15 ft? Will it hit the basket? How far will the ball travel horizontally before it hits the ground? theta and v0 are given in the table below.
My code:
%% Problem 3 x = 14; % x-displacement theta = 55.99; % This is the degree in non-specificed degree/radians v0 = 26.78; % This is the inital velocity. g = 32.2; % This is the gravity constant. vx = v0*cosd(theta); vy=v0*sind(theta); time = 0:x/vx:2; x = vx*time; y=7+vy*time-(1/2)*g*time.^2; plot(x,y) grid on;
What am I missing / doing wrong???
Thanks!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
