Rolldown Calculator V2.0 - Calculate your CDA with android phones [works this time]

How the math works, in case people want to check it out or duplicate it themselves (iVersion?)

High level: Each run gets looked at, point-by-point. For each sample, it looks like your velocity now versus the velocity of the point before. This gives you your acceleration. From that, we can compute the forces present. Since the slope is known (this was difficult, but I’m very happy with my solution), we can calculate the sum of the drag forces. Once we have that sum, we store the point (velocitySquared,estimated drag forces) in a array.

Once we’ve gone through all the points in all the runs, we get a large array mapping from velocity squared to estimated drag forces. We know that in the real world, the equation looks like:
D = NormalForceCrr + 0.5rhoCdaVelocitySquared.
Since we’ve got these plotted as (VelocitySquared,D), we can do a linear regression and look at the slope of the line. The chart, when exported to excel, look like this:
http://farm9.staticflickr.com/8013/7174598141_3537551971_z.jpg

So we end up as y = mx + b. Since the x-axis here is v^2, then we can actually say that y = D = NormalForceCrr* + 0.5rhoCdaVelocitySquared, by setting m = **0.5rho*Cda** and b = NormalForceCrr *

In the example above, we have:
m = 0.51.13cda, which solves to Cda = 0.271
and
b = NormalForceCrr = 9.8massCrr = 9.891*Crr, which solves to Crr = 0.009

So that’s the basics of how it gets solved.

Some may remember that I was having a horrible time getting reliable elevation data. Since knowing the slope of the hill is vitally important to figuring out how much of a sample’s acceleration was due to drag vs due to the slope, I went through a ton of iterations, before settling on a linear regression method. Basically, in order to find the slope at a given distance d, I do a linear regression on the set of (distance,elevation) points for all the points within 50 meters of the requested distance. This results in a nice stable slope that filters out the run-to-run or even sample-to-sample noise that comes with GPS elevation data.
http://farm9.staticflickr.com/8023/7174636935_520d47f273.jpg

Here’s the complete source code to the current version of the app: It’s pretty nasty and full of commented-out test code, but if someone really cares about the math, that’d be the place to look:https://sites.google.com/...tredirects=0&d=1
Another note: because it uses code from another project, the actual app (RolldownCalculator.java) won’t compile. CdaLib, however, will.