source("diffQuot.R") computePower <- function(distance, speed, altitude, m) { dh_dx = diffQuot(distance,altitude); #slope dv_dx = diffQuot(distance,speed); # param eta = 0.975; rho = 1.2; A = 0.7; c_d = 0.4; cdA = c_d*A; Iw = 0.14; rw = 0.33; g = 9.81; b0 = 0.091; b1 = 0.0087; mu = 0.004; power = 1/eta * (m*g*dh_dx + 0.5*rho*cdA*speed^2 + b0 + b1*speed + (m + Iw/(rw^2))*speed*dv_dx + mu*m*g) * speed }