gyrojet.frink

View or download gyrojet.frink in plain text format


/** Program to calculate Gyrojet projectile accelerations from raw data.

    See my full article at:
    http://futureboy.us/blog/gyrojet.html
*/


readings = [[0 ft,       0 ft/s],
 [1 ft,      105 ft/s],
 [3 ft,      192 ft/s],
 [5 ft,      290 ft/s],
 [8 ft,      421 ft/s],
 [13 ft,     566 ft/s],
 [18 ft,     787 ft/s],
 [23 ft,     985 ft/s]]

sumt = 0 s
size = length[readings]
var d2
var v2
for i = 0 to size-2
{
   [d1, v1] = readings@i
   [d2, v2] = readings@(i+1)

   vavg = (v1+v2)/2
   deltat = (d2-d1)/vavg
   deltav = v2-v1
   a = deltav/deltat
   sumt = sumt+deltat

   println["<TR><TD CLASS=\"right\">" + (d1->ft) + "<TD CLASS=\"right\">" + (v1 -> ft/s)]
   println["<TR><TD COLSPAN=2><TD CLASS=\"right\">" + format[deltat,ms,1] + "<TD CLASS=\"right\">" + format[sumt, ms,1] + "<TD CLASS=\"right\"><B>" + (format[a,gee,0]) + "</B>"]   
}

println["<TR><TD CLASS=\"right\">" + (d2->ft) + "<TD CLASS=\"right\">" + (v2 -> ft/s) + "<TD CLASS=\"right\">"]


View or download gyrojet.frink in plain text format


This is a program written in the programming language Frink.
For more information, view the Frink Documentation or see More Sample Frink Programs.

Alan Eliasen was born 17536 days, 5 hours, 55 minutes ago.