25 December 2011

A program in FORTRAN to calculate the velocity and height of a projectile

Given its initial height, initial velocity, and constant acceleration. Variables used are:
HGT0: initial height
HGT: height at any time
VELC0: initial vertical velocity
VELC: vertical velocity at any time
ACCL: vertical acceleration
TIME: time elapsed since projectile was launched

Input: none
Output: VELC, HGT
REAL HGT0, HGT, VELC0, VELC, ACCL, TIME
ACCL = -9.807
HGT0 = 100.0
VELC0 = 90.0
TIME = 4.3
HGT = 0.5*ACCL*TIME**2+VELC0*TIME+HGT0
VELC=ACCL*TIME+VELC0
PRINT*, ‘AT TIME’, TIME, ‘THE VERTICAL VELOCITY IS’, VELC
PRINT*, ‘AND THE HEIGHT IS’, HGT
END

2 comments:

Post a Comment