Using MATLAB
The range of an object shot at an angle θ (with respect to x-axis), with the initial velocity of V0 (in the absence of air resistance), is calculated by the following formula: range=(Vo^2/g)(sin(2theta)) where (0<=theta<=pi/2) And the trajectory of object is given by: h=tan(theta).x-(g/2Vo^2*cos^2(theta)).x^2 .Where h is the height of the object at each x location and g = 9.81 m/s2.
a) Using π/8 increment size for the angle and V0 = 10 m/s, plot the trajectories of the object in one figure with respect to x.
Hint: follow these steps:
1) For each value of θ find the range.
2) Create x as a vector starting from 0 to the computed range.
3) Compute h using θ and x from steps 1 and 2.
4) Plot h as a function of x.
5) Use hold on for the next plot (Use different colors for the plots and don’t forget to put legends and labels).
b)Create a vector for θ including 100 equally-spaced elements, and determine at which angles the maximum and minimum ranges occurs.
c)What is the max. height of the object at the angle determined in part b.
%get the initial velocity
v0=input(‘Enter the initial velocity’)
Theta=0:pi/100:pi/2;
g=9.81;
% calculate the range
Range=(v^2/g)*(sin(2*theta));
maxRange=0;
in=0;
% find the maximum range
for i=1:length(Range)
if Range>max Range
maxRange=Range;
in=I;
end
end
% find the maximu angle
Get Answers For Free
Most questions answered within 1 hours.