Processing GPS data to velocity

25 ビュー (過去 30 日間)
marwardo
marwardo 2017 年 9 月 11 日
コメント済み: Daniel 2024 年 10 月 8 日
Hi
For an AUV project I'm doing we need to calculate the speed from the GPS coordinates. In order to calculate the speed we need to calculate the distance between the GPS coordinates. Since there is only a short distance between the points (less than 100m) I wan't to calculate it using the Euclidean distance between the points.
The issue is I have two single row arrays (1x21) whith all the latitude and longitude coordinates from the GPS and I'm not sure how to combine the to arrays to get a new array with the distances in it? - Can I use the pdist2(X,Y) command?
I have tried with pdist2(lat,lon,'euclidean') where lat and lon is the 1x21 arrays which just returns a single number When I try with lat and lon as 21x1 array it gives me a 21x21 array - I'm not sure I completely understands the pdist2(x,y) command?
Sorry if I'm touching on something that has been discussed in here before, but I have bin searching for several hours and I have not really gotten any further...
Best regards and thanks

採用された回答

Star Strider
Star Strider 2017 年 9 月 11 日
The pdist2 function is overkill for what you want to do. I don’t know what format your latitude and longitude arrays are (I assume decimal degrees rather than ‘d:m:s’). If so, the hypot function would work best.
Example
LatLon = sortrows(rand(21,2),1)'*100; % Create (2x21) Data Array (Decimal Degrees)
Time = rand(21,1)*10; % Sampling Times
dLatLon = diff(LatLon'); % Convert To (21x2) & Take Successive Differences
DistDeg = hypot(dLatLon(:,1), dLatLon(:,2)); % Distance (Degree Differences)
d2m = 4E+7/360; % Degrees-To-Metres Conversion (Approximate)
DistMtr = DistDeg * d2m; % Distance (Metre Differences)
dTime = diff(Time); % Sampling Time Differences
Velocity = DistMtr ./ dTime; % Velocity (Metres/Time Unit)
Something like that should work.
  2 件のコメント
marwardo
marwardo 2017 年 9 月 11 日
Thanks alot! :-D That was just the framework I needed to get over the bump. Got it all up and running now.
Star Strider
Star Strider 2017 年 9 月 11 日
As always, my pleasure!
Congratulations!

サインインしてコメントする。

その他の回答 (1 件)

Jeppe Rasmussen
Jeppe Rasmussen 2018 年 8 月 28 日
Just be very careful.
The longitude degrees coresponds to very varying meters depending on the latitude you are positioned.
At equator a degree longitude corresponds to roughly 111000 meters. Here in North Europe (54 degrees North) 1 degree longitude corresponds to 65576 meter. Latitude does not vay that much.
You can use:
To calculate conversion factor for the longitude degrees depending on your location
  1 件のコメント
Daniel
Daniel 2024 年 10 月 8 日
Code snippet above does not seem right. d2m is not constant by latitude and also varies depending on how much of the diff comes from a latitude difference and how much comes from a longitude difference.
dLatLon = diff(LatLon');
does not produce distance arc in degrees.

サインインしてコメントする。

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by