MATLAB Answers

Why isn't the velocity logged correctly when using the GPS tracking with MATLAB Mobile in an Android phone?

5 views (last 30 days)
It is sought to obtain both the position and velocity data in MATLAB using the mobile sensing from an Android phone. Although the resulting timeseries show reliable values for the sensed position data (latitude, longitude and altitude), the sensed velocity is sometimes wrongly recorded as zero.
Why isn't the velocity logged correctly when using the GPS tracking with MATLAB Mobile in an Android phone?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 14 Jun 2021
The Android documentation states that the position in terms of the latitude, the longitude and the altitude can be reliably sensed and provided to the user, see the following API definitions along with their short documentation,
However, the API functions in Android for the computation of the altitude 'getAltitude()' and the computation of the velocity 'getSpeed()' do not guarantee sensing reliably these quantities, and if such a sensing is deemed impossible then a value of zero is returned, see for instance the API documentation of function 'getSpeed',
where it is mentioned the following,
"Get the speed if it is available, in meters/second over ground.If this location does not have a speed then 0.0 is returned."
A workaround in the latter case would be to use the position data and compute the velocity in the following manner,
 
wgs84 = wgs84Ellipsoid
lat1 = Position.latitude(1:end-1);
lon1 = Position.longitude(1:end - 1);
lat2 = Position.latitude(2:end);
lon2 = Position.longitude(2:end);
dist = distance(lat1, lon1, lat2, lon2, wgs84);
sp = dist ./ seconds(dt);
Please note that the velocity might have deviations from the actual one because the values of the position are not continuously sensed. In this case, smoothing functions in MATLAB can be used in order to obtain a smoother response in terms of the post-computed velocity, see the following documentation page for more information,

More Answers (0)

Tags

No tags entered yet.

Community Treasure Hunt

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

Start Hunting!