Question

In: Computer Science

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++

Solutions

Expert Solution

Solution :

Following is the C++ code for the problem :

#include <iostream>
#include <cmath>

using namespace std;

const double PI = 3.141592654, g = -9.81 ;
const int N=20;

float time_of_flight(float v,float angle)
{
    float time=fabs((2*v*sin((angle*PI)/180))/g);
    return time;
}
int main()

{
    
    float launch_angle, Vo,tof,tf[20],y[20];
    Vo=40.0;
    launch_angle=30;
    tof=time_of_flight(Vo,launch_angle);
    cout<<"The time of flight is : "<<tof<<endl;
    float increment=tof/20;

    cout<<"Following are the position of projectile at N(20) different time intervals"<<endl;
    cout<<"  Time\t\tHeight"<<endl;
    for(int i=0;i<N-1;i++)
    {
    if(i==0)
    tf[i]=increment;
    else
    {
        tf[i]=tf[i-1]+increment;
    }
    y[i]=Vo*sin(launch_angle*PI/180)*tf[i]+0.5*g*tf[i]*tf[i];
    cout<< tf[i]<<"        "<<y[i]<<endl;
    }
    return 0;
}

Code demo :

Output :


Related Solutions

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
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.
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 from ground level at angle θ and speed v_0 into a headwind...
A projectile is launched from ground level at angle θ and speed v_0 into a headwind that causes a constant horizontal acceleration of magnitude a opposite the direction of motion. Find an expression in terms of a and g for the launch angle that gives maximum range. The answer is θ = 45 - (1/2)tan^-1(a/g) The problem that I'm having is I have no idea how to get to that answer. Please do the problem and tell me where you...
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) A small projectile is launched from the ground and lands on the ground at the...
(a) A small projectile is launched from the ground and lands on the ground at the same height. Assuming linear air resistance, compute the time that the projectile travels under the following conditions: launch speed v0 = 4.00 m/s launch angle θ = 30.0 degrees retarding constant k = 1.00 1/s You may use the perturbation method (b) Compute the horizontal distance that the projectile travels.
Consider a projectile launched at a height h feet above the ground and at an angle...
Consider a projectile launched at a height h feet above the ground and at an angle θ with the horizontal. If the initial velocity is v0 feet per second, the path of the projectile is modeled by the parametric equations x = t(v0 cos(θ)) and y = h + (v0 sin(θ))t − 16t2. The center field fence in a ballpark is 10 feet high and 400 feet from home plate. The ball is hit h = 3 feet above the...
An object is launched from 2.3 meters above the ground with a 60 degree angle with...
An object is launched from 2.3 meters above the ground with a 60 degree angle with the horizontal the ball collides with the earth at a distance of 20.5 meters A) Calculate the maximum height B) Calculate the initial speed. C) Calculate the speed before impact
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT