Question

In: Computer Science

Q.3. Projectile Motion (30) A projectile is launched at 40.0 m/s at an angle 30 degree...

Q.3. Projectile Motion (30) A projectile is launched at 40.0 m/s at an angle 30 degree from ground to ground. o Write a function that will return the time of flight based on V_{0} and theta. o Find N time split (suppose N=20) and put those time in Tf[]. o Calculate the height y of the projectile for those time and put them in Y[].

Language C++ code

Solutions

Expert Solution

In this program, we have to calculate time of flight for the given projectile, split this time of flight into twenty equally spaced points in time, find the height y of the projectile at these points.

The program will have three functions:

1.) time_of_flight() : this function calulcate the time of filglt of the projectile with this formula :

2.) time_split() : this function splits the time of flight into N equally spaced points and stores them in an array

3.) calc_Y() : this function calculate y at given time points and stores them into another array Y[]. The height formula is

program:

#include <iostream>
#include <math.h>
#include <iomanip>
using namespace std;

float time_of_flight(float v0, float theta){
return 2*v0*sin(theta)/9.81;
}

void time_split(float t_flight,int N,float tf[]){
float t_split = (float)t_flight/N;
for(int i = 1; i<=N; i++)
tf[i-1] = t_split*i;
}

void calc_Y(float v0, float theta, int N, float tf[], float Y[]){
float v0_y = v0*sin(theta);
for(int i = 0; i<N; i++)
Y[i] = v0_y*tf[i] - 0.5*9.81*tf[i]*tf[i];
}

int main(){
float v0 = 40, theta = (float)30*M_PI/180;
float t_flight = time_of_flight(v0,theta);
float tf[20];
time_split(t_flight,20,tf);
float Y[20];
calc_Y(v0,theta,20,tf,Y);
cout<<"time\t\tY\n";
for(int i = 0; i<20; i++){
cout<<fixed<<setprecision(5)<<tf[i]<<"\t\t"<<Y[i]<<endl;
}
}

output:


Related Solutions

A projectile is launched at 40.0 m/s at an angle 30 degree from ground to ground....
A projectile is launched at 40.0 m/s at an angle 30 degree from ground to ground. o Write a function that will return the time of flight based on V_{0} and theta. o Find N time split (suppose N=20) and put those time in Tf[]. o Calculate the height y of the projectile for those time and put them in Y[]. C++
A projectile is launched with an initial speed of 40.0 m/s at 60.0 degrees above the...
A projectile is launched with an initial speed of 40.0 m/s at 60.0 degrees above the horizontal. It hits the ground at the same height it was launched from. Neglect air resistance. a) What is the projectile's smallest speed as it moves through air? b) What is the projectile's smallest magnitude of acceleration as it moves through air? c) What is the projectile's speed 1.00 second after launch? d) What is the magnitude of the projectile's displacement 1.00 second after...
A projectile is launched with a speed of 45 m/s at an angle of 35 degrees...
A projectile is launched with a speed of 45 m/s at an angle of 35 degrees above the horizontal from the top of a wall. The projectile lands 250m from the base of the wall. a.) Determine the height of the wall. b.) Determine the impact velocity of the projectile
A projectile is launched with an initial speed of 60 m/s at an angle of 35°...
A projectile is launched with an initial speed of 60 m/s at an angle of 35° above the horizontal. The projectile lands on a hillside 4.0 s later. Neglect air friction. (a) What is the projectile's velocity at the highest point of its trajectory? m/s (b) What is the straight-line distance from where the projectile was launched to where it hits its target? m
A projectile (with mass 300g) is launched with an initial speed of 30 m/s at an...
A projectile (with mass 300g) is launched with an initial speed of 30 m/s at an angle of 32 degrees above the horizontal from the edge of a 20 m tall cliff. At the point in the trajectory where the projectile was at its maximum height, a 25g projectile is launched straight up into the first projectile. The smaller mass is traveling at 300 m/s and the two objects stick together. Calculate the percentage increase in height and total horizontal...
A projectile launched from ground level lands 2.44 s later on a level field 40.0 m...
A projectile launched from ground level lands 2.44 s later on a level field 40.0 m away from the launch point. How many degrees is the projectile above the horizontal?
A 30 kg projectile is launched from the ground at an initial velocity of 300 m/s...
A 30 kg projectile is launched from the ground at an initial velocity of 300 m/s at an angle of 45 degrees above the horizontal. If air resistance is ignored, determine the following: a. The projectile's speed at 2000 meters above the ground. b. The total amount of energy the object has at 3000 m. c. The maximum height of the projectile. d. The maximum distance the projectile travels horizontally.
MATLAB question The range of a projectile launched at velocity V and angle q is R=2...
MATLAB question The range of a projectile launched at velocity V and angle q is R=2 V2 sin(q) cos(q) Find the range if V=20m/s and q=30 degrees (5 pts) If the uncertainty in the launch angle q = 30 +/- 2 degrees, what is the uncertainty of the range What should the accuracy of the launch angle have be to keep the uncertainty of the range to within 5%.
A baseball is hit 40 m/s at an angle of 30 degree. A 5 m high...
A baseball is hit 40 m/s at an angle of 30 degree. A 5 m high fence is 125 m away. Does it go over the fence?
A shell is launched at angle 62° above the horizontal with initial speed 30 m/s. It...
A shell is launched at angle 62° above the horizontal with initial speed 30 m/s. It follows a typical projectile-motion trajectory, but at the top of the trajectory, it explodes into two pieces of equal mass. One fragment has speed 0 m/s immediately after the explosion, and falls to the ground. How far from the launch-point does the other fragment land, assuming level terrain and negligible air resistance?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT