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

18. A baseball is thrown with a speed of 40 meters/second at an angle of 30 degr

ID: 2088439 • Letter: 1

Question

18. A baseball is thrown with a speed of 40 meters/second at an angle of 30 degrees (0.5236 radians) above the horizon. An engineer has come up with some formulas that tell us how high the ball will travel and how fast it is going: h(t) vot sin A -0.5gt2 (this formula gives the height) v) 2vogtsin A+g'12 (this formula gives the speed) where g- 9.81 m/s2, A-0.5236 (the angle in radians), and vo- 40 m/s. Write a Matlab/Excel program that will use the equations above to display: a) The maximum height of the baseball b) The speed of the ball when it is at its maximum height c) How long it takes for the ball to reach the ground. d) The speed the ball is traveling when it hits the ground.

Explanation / Answer

The matlab code to solve the above problem is given below:

Matlab code:

clc
clear variables

% Define variables
v0 = 40; % Initial speed
A = 30; % Angle in degrees
g = 9.81; % Gravitational constant

syms t;
h = v0*t*sind(A)-0.5*g*t^2; % Height as a function of time
dh = diff(h,t); % Differential of height w.r.t time
v = (v0^2-2*v0*g*t*sind(A)+g^2*t^2)^0.5; % Velocity of the ball

t_h_max = double(solve(dh == 0)); % Time at which the ball reaches its maximum height
t_h_0 = double(solve(h == 0)); % Time at which the ball reaches the ground

h_max = double(subs(h,t,t_h_max)); % Maximum height

v_h_max = double(subs(v,t,t_h_max)); % Velocity at maximum height

t_h_0 = t_h_0(2); % Time taken by ball to reach ground

v_h_0 = double(subs(v,t,t_h_0)); % Velocity when ball reaches the ground

fprintf("a) Maximum height reached by the ball is: %d ",h_max);
fprintf("b) Speed of the ball when it is at its maximum height is: %d ",v_h_max);
fprintf("c) Time taken by the ball to reach the ground is: %d ",t_h_0);
fprintf("d) Speed of the ball when it reaches the ground is: %d ",v_h_0);

% End of matlab code

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