How to predict future position of vehicle (GPS data) by previous data

6 views (last 30 days)
How to predict future position of vehicle (GPS data) by previous data. I have those values in .csv file. I need to predict future optimal point by using previous data.

Accepted Answer

Walter Roberson
Walter Roberson on 16 May 2017
With the information given, we are justified in guessing that the vehicles are motorized stilts. That assumption made, we can re-interpret the latitude and longitude as being the centroids of a body, and then apply gait analysis techniques, and use the information so gained to predict future position.
Or we could guess that the vehicles are constrained by mechanical systems and that there is periodic motion. We could then do eigenvalue analysis to try to deduce the modes of the mechanical system in order to predict future behavior.
Or we could guess that the vehicles are part of a weight + springs system and do ODE analysis with a mass matrix.
Or we could do System Identification.
Or we could do neural network timeseries analysis.
Or we could just guess that really all we need is about the last 4 readings, and use those to calculate current velocity and acceleration and assume that it will stay constant for the period for which prediction is to be done. This approach is probably the only one that can be really justified.
  22 Comments
Manoj Pai
Manoj Pai on 23 May 2017
Edited: Manoj Pai on 23 May 2017
For how many inputs(lat, long) does it considers for compilation? Can we also plot on google map?
Walter Roberson
Walter Roberson on 23 May 2017
The following will try to calculate an intersection down to single samples.
fid = fopen('FirstFile.csv', 'rt');
latlong1 = cell2mat( textscan(fid, '%f,%f', 'HeaderLines', 1, 'CollectOutput', 1) );
fclose(fid);
if isempty(latlong1)
error('FirstFile is empty, cannot fit')
end
fid = fopen('SecondFile.csv', 'rt');
latlong2 = cell2mat( textscan(fid, '%f,%f', 'HeaderLines', 1, 'CollectOutput', 1) );
fclose(fid);
if isempty(latlong2)
error('SecondFile empty, cannot fit');
end
lat1 = latlong1(:,1);
lon1 = latlong1(:,2);
lat2 = latlong2(:,1);
lon2 = latlong2(:,2);
degree = max(3, min(length(lat1,1),length(lat2,1))-1);
if degree < 3
fprintf(2, 'Warning: One of the files has less than 4 samples, dropping down to degree %d fitting', degree);
end
coeffs1 = polyfit(lat1, lon1, degree); %and ignore the warning
coeffs2 = polyfit(lat2, lon2, degree); %and ignore the warning
intersect_poly = coeffs1 - coeffs2;
intersect_lat = roots(intersect_poly);
intersect_lat(imag(intersect_lat) ~= 0) = []; %remove imaginary intersections
if isempty(intersect_lat) && degree == 0 && abs(intersect_poly) < 1e-4
intersect_lat = lat1;
intersect_long - lon1;
else
intersect_lon = polyval(coeffs1, intersect_lat);
end
if isempty(intersect_lon)
error('paths do not intersect');
end
scatter(lat1, lon1, 'r*');
hold on
scatter(lat2, lon2, 'gs');
scatter(intersect_lat,intersect_lon, 'b^')
"Can we also plot on google map?"

Sign in to comment.

More Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!