



CODE GIVEN
% Create a program to plot the motion of the ping pong ball with drag.
% The program will take inputs for velocity in m/s and angle of launch.
% note that with a high speed camera I estmated a launch speed for a ping
% pong ball could be 30 m/s.
vel=30; %m/s
angle=60;
% convert the degrees into radians so MATLAB likes it
angle=angle*pi/180;
% set initial values (time, distance, mass, gravity, drag)
x(1)=0; % meters
y(1)=.01; % meters
time(1)=0; % seconds
mass=.00247; %kg ping pong ball .00247 Kg
g=-9.8; % m/sec^2
c=-0.0005; % coefficient of drag with density and area in this constant
index=1; % so I can load an array for plotting
% start to increment the motion and define it component forces
velx=vel*cos(angle);
VelocityX(1)=velx;
vely=vel*sin(angle);
VelocityY(1)=vely;
% set a time step and variable for height
deltaTime=.001; % seconds
height=y(1);
while height>=0 % check that the ball has not hit ground yet
index=index+1; % setup and index
% *******************************************************
% break velocity into its components
% *******************************************************
% *******************************************************
% use an if/else statement to check to see if the ball is moving
% down (negative). If it is, then drag has an opposite sign
% as gravity in the acceleration formula. Otherwise gravity
% and drag have the same sign. Calculate the new acceleration in the y.
% *******************************************************
% *******************************************************
% Now calculate the acceleration in the x .
% *******************************************************
% *****************************************************
% calculate the new velocity at the end of the time step
% this will have X and Y components, so you need a variable
% for each. One is velFinalX and the other is velFinalY.
% *******************************************************
% ******************************************************
% Get a new velocity vector and angle given the X and Y
% The velocity is the variable "vel" and angle is "angle"
%*******************************************************
% now save my values at this time step
time(index)=time(index-1)+deltaTime;
VelocityX(index)=velFinalX;
VelocityY(index)=velFinalY;
% and distance numbers
distX=velx*deltaTime;
distY=vely*deltaTime;
% save distance values
x(index)=x(index-1)+distX;
y(index)=y(index-1)+distY;
height=y(index);
end
plot(x,y)
title('distance traveled by ping pong ball in meters')
xlabel('horixontal distance traveled (meters)')
ylabel('vertical distance traveled (meters)')
Solution:---
clc
clear all
close all
format long
x=0;
y=0;
t=0;
i=1;
v0=100;
th=pi/4;
cd=0.6;
g=9.81;
while(y(i)>=0)
t=t+0.001;
x(i+1)=v0*cos(th)*t-0.5*cd*t^2;
y(i+1)=v0*sin(th)*t-0.5*cd*t^2-0.5*g*t^2;
i=i+1;
end
y=y(1:end-1);
x=x(1:end-1);
plot(x,y);
xlabel('horizontal distance travelled');
ylabel('vertical distance travelled');

Thanks.
CODE GIVEN % Create a program to plot the motion of the ping pong ball with...
Two thin hollow plastic spheres, about the size of a ping-pong ball with masses ( 0.004 kg) have been rubbed with wool. Sphere 1 has a charge -4 × 10-9 C and is at location < 0.47, -0.29, 0 > m. Sphere 2 has a charge -9 × 10-9 C and is at location < -0.42, 0.43, 0> m. It will be useful to draw a diagram of the situation, including the relevant vectors. (a) What is the relative position...
Two thin hollow plastic spheres, about the size of a ping-pong ball with masses (m1=m2= 0.005 kg) have been rubbed with wool. Sphere 1 has a charge q1= -8 × 10-9 C and is at location < 0.24, -0.2, 0 > m. Sphere 2 has a charge q2= -8 × 10-9 C and is at location < -0.36, 0.35, 0> m. It will be useful to draw a diagram of the situation, including the relevant vectors. (i) If the two...
1) A ping pong ball is drawn at random from an urn consisting of balls numbered 4 through 9. A player wins $1 if the number on the ball is odd and loses $1 if the number is even. Let x be the amount of money a player will win/lose when playing this game, where x is negative when the player loses money. (a) Construct the probability distribution table for this game. Round your answers to two decimal places. Outcome...
Two thin hollow plastic spheres, about the size of a ping-pong ball with masses (m1=m2= 0.008 kg) have been rubbed with wool. Sphere 1 has a charge q1= -9 × 10-9 C and is at location < 0.39, -0.28, 0 > m. Sphere 2 has a charge q2= -2 × 10-9 C and is at location < -0.31, 0.47, 0> m. It will be useful to draw a diagram of the situation, including the relevant vectors. a/ What is the...
I want Matlab code related to 14.35.
14.35 A Monte Carlo analysis can be used for optimization. For example, the trajectory of a ball can be computed with 2 |(P14.35) x+yo 2 cos20o y=(tan0o)x where y the height (m), Go = the initial angle (radians), the initial velocity (m/s), g 9.81 m/s, and yo vo = 25 m/s, and Oo = 50", determine the maximum height and the corresponding x distance (a) analytically with calcu- lus and (b) numerically with...
JavaFX programming (Not Javascript) Using the code from BallPane.java and BounceBallControl.java create a "Pong for One" game - a rectangular paddle moves back and forth via mouse drag along the bottom of the pane; the bottom of the paddle should be about 1/2 the diameter of the ball off the bottom. If the ball connects with the paddle, then it bounces at a 90 degree angle back into the pane space. If the ball misses the paddle, then the score...
(c) The ball is at its maximum height after _____
seconds.
(d) The maximum height of the ball is ______ meters
(e) The ball traveled a total horizontal distance of _______
meters.
(ROUND TO TWO DECIMAL PLACES)
A baseball player throws a baseball with an initial speed of 155 feet per second at an angle of 23 to the horizontal. The ball leaves his hand at a height of 6 feet. (a) Find parametric equations that describe the position of...
Please help with Q1 a)b)c).
Question 1: In the lectures we considered simple projectile motion. Here we extend the description to include air resistance. For macroscopic objects in air, the dynamics equations including air resistance may be written V and ^- where m is the mass of the object, g is the acceleration due to gravity, y is the vertical direction, C is a dimensionless drag coefficient, A is the cross-sectional area of the object, pa 1.2kg/m3 is the density...
THE EXPERIMENT The speed "." of a ball as it leaves the spring gun will be measured by projecting the ball horizontally (0-0) from a table top at a distance H above the floor. The gun is then elevated at a known angle 8. The position of the target is calculated using the measured value of v. calculated time of flight, and the equations of motion. A successful prediction with the projectile hitting the target means that the following concepts...
MATLAB,
please provide code script
Objective: Create a function file that animates projectile motion defined by the following equations in a subplot. Your function should accept user inputs of launch speed and launch angle. The output of your function will be a top subplot that displays height (y) as a function of x. The bottom subplot should display the vertical velocity while the projectile is in motion. A video of what your animation should look like is posted with this...