VBA The projectile motion equations arexx0v0cost yy0v0sint05

VBA

The projectile motion equations are,x=x0+v0*cos()*t, y=y0+v0*sin()*t+0.5*g*t^2

where x and y are the current position at time t, x0 and y0 are the projectile’s initial position, v0 is the projectile’s initial speed, is the initial firing angle of the projectile, and g is the gravitational acceleration which is -9.81 m/s2 near Earth’s surface.

The user (me) will input the initial x-position (m), y-position (m), speed (m/s), the firing angle (in degrees) in cells F2-F5 on Sheet2.

Create a run button that executes a macro named problem2. This macro solves the following problem:

• Obtain the input data from cells F2-F5.

• Using a Do While loop (not a For loop nor a Do Until loop), calculate the x- and y-position of the projectile every 0.1 seconds and output the time, x-position, and y- position to columns A, B, and C until the projectile hits the ground. The first entries for the time, x-position, and y-position should be in cells A2, B2, and C2.

For example, if the initial x-position is 10 m, the initial y-position is 20 m, the initial speed is 100 m/s and the firing angle is 30o, the first five lines of output should similar to the data below:

If the last y-position output to the workbook is negative, remove the data from that entire row (the projectile will not enter the ground).

Solution

Given data:

A project mentioned equeations are :x=x0+v0*cos()*t, y=y0+v0*sin()*t+0.5*g*t^2

where X and Y are current possitions at time T

the projectile’s initial positionS are X0 AND Y0

V0 Is the initial speed

the initial firing angle of the projectile is

g is the gravitational acceleration which is -9.81 m/s2

input the initial x-position (m), y-position (m), speed (m/s), the firing angle (in degrees) in cells F2-F5 on Sheet2

x- and y-position of the projectile every 0.1 seconds and output the time, x-position, and y- position to columns A, B, and C until the projectile hits the ground. The first entries for the time, x-position, and y-position should be in cells A2, B2, and C2.

:x=x0+v0*cos()*t, y=y0+v0*sin()*t+0.5*g*t^2

x=10+(-9.81 m/s2)

y=20+(-9.81 m/s2)*60+0.5

VBA The projectile motion equations are,x=x0+v0*cos()*t, y=y0+v0*sin()*t+0.5*g*t^2 where x and y are the current position at time t, x0 and y0 are the projectil

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site