Answer To: Homework 5: Write one MATLAB program and make use of the MATLAB’s menu function that creates three...
Akriti answered on Apr 17 2021
Problem 2.zip
Problem 2/Ball_Trajectory.m
% Problem 2
%Number of bounces:
N=5;
%Number of points of interest between bounces:
PI=10;
%Velocity reducing factor
VRF=0.8;
%Acceleration of gravity, m/s^2:
g=9.81;
%Initial velocity of the ball, m/s:
V_0=20;
%Initial angle of trajectory, deg:
Alpha=25;
%Initial angle of trajectory, deg:
Theta=30;
V=zeros(N+1,4);
V(1,1)=V_0;
for r=1:N
%Projection of the Initial velocity to X axis, m/s:
V(r,2)=V(r,1)*cosd(Alpha)*sind(Theta);
%Projection of the Initial velocity to Y axis, m/s:
V(r,3)=V(r,1)*sind(Alpha)*sind(Theta);
%Projection of the Initial velocity to Z axis, m/s:
V(r,4)=V(r,1)*cosd(Theta);
%The ball initial velocities after each bounce, m/s:
V(r+1,1)=V(r,4)*VRF;
end
%Time beteween bounces, s:
T_b=2*V(1:N,4)/g;
%Increment of time, s:
IT=T_b/PI;
T=zeros(N,PI+1);
for k=1:N
for m=1:PI+1
T(k,m+1)=T(k,m)+IT(k);
end
end
%X coordinate of the ball due to time, m:
XD=zeros(N,PI+1);
for k=1:N
for m=1:PI+1
XD(k,m)=T(k,m)*V(k,2);
...