How I spent my day the wrong way

13 Sep

It was beautiful this afternoon. Should have rollerskied. Played around with FreeMat instead:

% speed.txt is data parsed from the .gpx xml
data = dlmread(‘speed.txt’); % open tab delimited file
elevation = data(:,3);
for i=1:length(elevation);
if elevation(i) > 255
break;
end;
end;
speed = data(i:length(data),2);
speed = speed(speed ~=0); % dump any zeros
sigma = std(speed); % get standard deviation
speed(speed > sigma*4)=[]; % dump all too fast
speed(speed < sigma/4)=[]; % dump all too slow

Do you really want to know what this is? Speed data from the last time I climbed my big hill (Grefsenkollen).

I always start skiing hard once I get past a fork in the road at 255 meters elevation. So I pull the data from beyond that point into my sample. GPS units (perhaps particularly the iPhone) will collect bad data, so I then weed out the obviously wrong readings before drawing any conclusions. In the above code I use a crude statistical method for cleanup.

Here’s what the slope looks like (y-axis is elevation in meters, x is distance in kilometers) :

What says the oracle about the last time I was up this:

–> mean(speed)
ans =
11.5603
–> max(speed)
ans =
16.4100

These are my best numbers yet. But if I keep the nerdy stuff up, they won’t stay there.

Postscript: It doesn’t look good to publicly forget elementary school math. There’s obviously an easier, more reliable way of calculating average speed, wholly unaffected by junk GPS position data:

–> totalTime = 33.600- 24.833; %Time after the 255m mark in minutes
–> totalDistance = 6.73 – 5.046; %Distance after the 255m mark in km
–> timeCoeff = totalTime / 60;
–> kmph = totalDistance / timeCoeff
kmph =
11.5250

Got lucky, though, the first estimate wasn’t too far off the real average.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: