Answered step by step
Verified Expert Solution
Question
1 Approved Answer
When an object with negligible air resistance is launched with a velocity magnitude vo from an initial height yo at an angle in a
When an object with negligible air resistance is launched with a velocity magnitude vo from an initial height yo at an angle in a gravitational field of acceleration a, it will follow a parabolic arc. The vertical displacement y of the object is related to the horizontal displacement x of the object by the relation Vo.y y=yo+ -x- VO,x Vox where where the subscripts x and y identify the x- and y-directions, respectively, and a is the magnitude of the gravitational acceleration. The initial velocity of the object in the x- and y-directions, Vox and voy, respectively, are related to the launch angle through the relations VO,x = Vo Cos (0) and vo.y = vo sin(0) Write a script that calculates the trajectory of an object launched at three different launch angles, 0 = [20, 40, 60]. The object is thrown at vo = 20 m/s from an initial height of yo = 200 cm above the earth's surface and the object cannot fall through the surface of the earth. Gravitational acceleration near Earth's surface is approximately a = 9.81 m/s. Your script should do the following: Define a vector of 250 evenly-spaced x values for which you will calculate the object's trajectory. This vector should represent x values from 0 meters to 40 meters and be called x. Your object trajectories should be stored in the rows of a matrix called Traj, with the first row representing the trajectory for # = 20, and so on. The values stored in Traj should represent vertical displacements with units of meters. . Since it is physically meaningless for the object to fall through the surface of the earth, set any elements of Traj that repesent objects that have fallen through the surface of the earth to 0. There are many ways to do this. The most straightforward is probably to write this code in MATLAB then inspect the Traj matrix to figure out which elements represent objects that have fallen through the surface of the earth and replacing those elements with 0. A faster way to do this leverages the find function, which I recommend you try if you are looking for a challenge. Store the maximum vertical displacement for each launch angle to a column vector called maxy. The first element should be the max displacement for 0 = 20, and so on. 1% Define constants 2 v0 = 20; 3 ye = 200 / 100; 4 a = 9.81; 17 5 angles = [20, 40, 60]; % Launch angles in degrees 6 X = linspace(0, 40, 250); % Vector of x values (0 to 40 meters) 7 8 % Initialize matrices 9 Traj zeros(length(angles), length(x)); % Matrix to store trajectories 10 maxy= zeros (length(angles), 1); 11 12% Calculate trajectories for each angle i=1:length(angles) 13 for 14 15 16 18 19 20 21 22 23 24 25 26 end = % Initial velocity (m/s) % Initial height (converted to meters) % Gravitational acceleration (m/s^2) theta = deg2rad (angles (i)); % Convert angle to radians vex = V0 * cos (theta); * voy = V0 sin(theta); % Column vector to store max vertical displacements = % Initial velocity in the x-direction % Initial velocity in the y-direction % Calculate vertical displacement using the given formula Traj(i, :) = y + (vy / vex) * x - 0.5 * a * (x / vox).^2; % Set elements that have fallen through the surface to 0 Traj(i, Traj(i, :) < 0) = 0; % Find and store the maximum vertical displacement maxy(i) max(Traj(i, :)); 27 28 % Display the maximum vertical displacements for each angle 29 disp('Maximum Vertical Displacements: '); 30 disp(maxy); 31 32 % Plot the trajectories 33 figure; 34 hold on; 35 for i=1:length(angles) 36 plot(x, Traj(i, :), 'DisplayName', ['\theta 37 end 38 xlabel('Horizontal Displacement (m)'); 39 ylabel('Vertical Displacement (m)'); 48 title('Trajectory of Object Launched at Different Angles'); 41 legend ('Location', 'northwest'); 42 grid on; 43 hold off; ^^ = num2str (angles (i)) degrees']); Is maxy correct? The submission must contain a variable named maxY.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started