From physics, the trajectory of a projectile with initial velocity v_0 and initi
ID: 3825246 • Letter: F
Question
From physics, the trajectory of a projectile with initial velocity v_0 and initial angle theta x = nu_x t y = n u_y t - 1/2 gt^2 nu_x = nu_0 cos theta nu_y = nu_0 sin theta where x is the horizontal displacement form the original position, y is the vertical displacement from the original position, nu_x is the velocity in the horizontal dimension, nu_y is the velocity in the vertical direction, g is the acceleration due to gravity and, t is the time in seconds. (a) Use the built-in function roots to determine the time of the object's flight. Calculate how far the object traveled. (b) Use built-in Matlab functions to determine the maximum height of the object and the time at which the object reaches the maximum height. (c) Use Matlab to plot the trajectory of an object with initial velocity of 100 ft/s, and initial angle of 35 degree. Include the plot(s) in your word document.Explanation / Answer
y1 = input('Enter initial height (meters):2.1336');
r1 = [0, y1]; % Initial vector position
speed = input('Enter initial speed (m/s):40');
theta = input('Enter initial angle (degrees):30');
v1 = [speed*cos(theta*pi/180), ...
speed*sin(theta*pi/180)]; % Initial velocity
r = r1; v = v1; % Set initial position and velocity
Cd = 1.2; % Drag coefficient (dimensionless)
grav = 9.81; % Gravitational acceleration (m/s^2)
mass = 0.14; % Mass of projectile (kg)
air_const = -Cd*mass; % Air resistance constant
tau = input('Enter timestep, tau (sec):0.5'); % (sec)
maxstep = 1000; % Maximum number of steps
for istep=1:maxstep
%* Record position (computed and theoretical) for plotting
xplot(istep) = r(1); % Record trajectory for plot
yplot(istep) = r(2);
t = (istep-1)*tau; % Current time
xNoAir(istep) = r1(1) + v1(1)*t;
yNoAir(istep) = r1(2) + v1(2)*t - 0.5*grav*t^2;
accel = air_const*norm(v)*v; % Air resistance
accel(2) = accel(2)-grav; % Gravity
r = r + tau*v; % Euler step
v = v + tau*accel;
%* If ball reaches ground (y<0), break out of the loop
if( r(2) < 0 )
xplot(istep+1) = r(1); % Record last values computed
yplot(istep+1) = r(2);
break; % Break out of the for loop
end
end
fprintf('Maximum range is %g meters ',r(1));
fprintf('Time of flight is %g seconds ',istep*tau);
clf; figure(gcf);
xground = [0 max(xNoAir)]; yground = [0 0];
plot(xplot,yplot,'+',xNoAir,yNoAir,'-',xground,yground,'-');
legend('Euler method','Theory (No air) ');
xlabel('Range (m)'); ylabel('Height (m)');
title('Projectile motion');
or
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.