interpolating between two GPS coordinates along a route

i have a list of GPS location (in radians) and the distance between the points.below is a sample.
im looking for some code that takes in these points and then outputs the coordinates every nth meter along the route made up buy the original coordinates like the image below. i can do it manually but its going to take me forever to do it that way. the blue is the original points and the orange is the calculated points. cheers
Latitude (RADS), Longitude (RADS), Distance
0.931551651 -0.107583317
0.9315531 -0.107581519 11.4961248
0.931554758 -0.107580734 10.98943551
0.931556695 -0.107581222 12.49570506
0.931558231 -0.107579913 10.98978352
0.931559837 -0.10757925 10.54793658
0.931561495 -0.107577854 11.83483865
0.931563013 -0.107576109 11.74320718
0.931564601 -0.107574695 11.46957061
0.931565858 -0.10757281 10.75576164
0.931567499 -0.107570908 12.72383288
0.93156961 -0.107568028 17.36393271
0.931570867 -0.107566213 10.58034306
0.931572036 -0.107564345 10.30144535
0.931574166 -0.107561134 18.26903627
0.931575353 -0.107559266 10.38265136
0.931576609 -0.107557364 10.79998651
0.931578005 -0.107555723 10.87558531
0.931579367 -0.107554013 10.85094742

 채택된 답변

KSSV
KSSV 2017년 3월 20일
clear all ; clc
data = [0.931551651 -0.107583317 0
0.9315531 -0.107581519 11.4961248
0.931554758 -0.107580734 10.98943551
0.931556695 -0.107581222 12.49570506
0.931558231 -0.107579913 10.98978352
0.931559837 -0.10757925 10.54793658
0.931561495 -0.107577854 11.83483865
0.931563013 -0.107576109 11.74320718
0.931564601 -0.107574695 11.46957061
0.931565858 -0.10757281 10.75576164
0.931567499 -0.107570908 12.72383288
0.93156961 -0.107568028 17.36393271
0.931570867 -0.107566213 10.58034306
0.931572036 -0.107564345 10.30144535
0.931574166 -0.107561134 18.26903627
0.931575353 -0.107559266 10.38265136
0.931576609 -0.107557364 10.79998651
0.931578005 -0.107555723 10.87558531
0.931579367 -0.107554013 10.85094742] ;
x = data(:,1) ;nx = length(x) ;
y = data(:,2) ; ny = length(y) ;
%%Get resolution
x0 = min(x) ; x1 = max(x) ;
N = 100 ;
xi = linspace(x0,x1,N) ;
yi = interp1(x,y,xi) ;
%%plot
plot(x,y,'r')
hold on
plot(xi,yi,'.k')

댓글 수: 1

thank you so much, that great, but its not 100% right. it almost works but not quite. you can see that the distance between the blue points changes. i need them to be the same the whole time.thanks again

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

John Michael de Mesa
John Michael de Mesa 2018년 10월 23일

0 개 추천

when you interpolate coordinates, do you get the 2 previous coordinates, or the future?
Walter Roberson
Walter Roberson 2018년 10월 23일

0 개 추천

Look in the File Exchange for John D'Errico contribution for points along a curve. https://www.mathworks.com/matlabcentral/fileexchange/34874-interparc

카테고리

질문:

2017년 3월 20일

답변:

2018년 10월 23일

Community Treasure Hunt

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

Start Hunting!

Translated by