Question
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 projectiles initial
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 projectiles initial position, v0 is the projectiles initial speed, is the initial firing angle of the projectile, and g is the gravitational acceleration which is -9.81 m/s2 near Earths 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).
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