How to predict future position of vehicle (GPS data) by previous data
조회 수: 7 (최근 30일)
이전 댓글 표시
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.
댓글 수: 0
채택된 답변
Walter Roberson
2017년 5월 16일
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
Walter Roberson
2017년 5월 23일
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?"
추가 답변 (0개)
참고 항목
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!