3dpcp/.svn/pristine/67/67b16845a4533699b4869e44b61c389c316a8d3d.svn-base

30 lines
565 B
Text
Raw Normal View History

2012-09-16 12:33:11 +00:00
function output = recordingtime_gps(input, ref)
[input_m, input_n] = size(input);
[ref_m, ref_n] = size(ref);
output = zeros(ref_m, input_n);
for i = 1 : ref_m
upper_index = find(input(:,1) > ref(i,1));
upper = input(upper_index(1),:);
if(upper_index(1) > 1)
lower = input((upper_index(1)-1),:);
else
lower = upper;
end
diff = upper - lower;
if(diff(1) == 0)
rel_time = 0;
else
rel_time = (ref(i,1) - lower(1,1)) / diff(1);
end
output(i,:) = lower + rel_time .* diff;
end