Data treatment: How to use exponential regression types of functions to approximate to a specific model (tobler's hiking function)
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Rúben Ricardo
el 1 de Ag. de 2022
Comentada: William Rose
el 9 de Ag. de 2022
I have a code which i read a gpx file and obtain the values of Latitude, Longitude and Elevation in matrix A.
route = gpxread('Patrulha_Quinta_das_Lameirinhas_relogio.gpx');
A=[route.Latitude;route.Longitude;route.Elevation];
A=A';
Then i made a filter to consider the consecutive 10 to 10 seconds. This was to remove possible outliers.
B=A(1:10:end,:);
tempo=length(B);
in my project i want to study the behaviour of velocity with different types of terrain and different intervals of slope.
Distance, velocity and slope were calculated by this for cicle
for i=1:length(B)
if i<length(B)
deltaLat(i,:)=(B(i+1,1)-B(i,1))*60*1852; % diferença das latitudes
deltaLon(i,:)=(B(i+1,2)-B(i,2))*60*1852; % diferença das longitudes
deltaZ(i,:)=B(i+1,3)-B(i,3);
end
end
x=deltaLat;
y=deltaLon;
z=deltaZ;
distancia=sqrt(x.^2+y.^2+z.^2);
% total distance travelled
sum(distancia);
% velocity in each instance (10 to 10 seconds)
velocidade=distancia/10;
% mean velocity of all track
velocidade_media=sum(distancia)/length(A);
% slope (%)
declive=(z./distancia)*100;
Then i organized my data velocidade(velocity) and declive(slope) data in 4 intervals of slope: >10%, 0-10%, -10% - 0%, < -10% in oder to calculate the mean of velocity in each interval of slope.
R=[velocidade,declive];
v_mean_10_plus= mean(velocidade(declive > 10));
v_mean_0_10 = mean(velocidade(declive <= 10 & declive >= 0));
v_mean_10_0 = mean(velocidade(declive < 0 & declive >= -10));
v_mean_10_minus = mean(velocidade(declive < -10));
figure
dec_0_plus=declive(declive>=0);
dec_0_minor=declive(declive<0);
vel_0_plusP=velocidade(declive>=0);
vel_0_minor=velocidade(declive<0);
My question is how can I treat my raw data in order to get to a semehant version of Tobler's Hiking Function (exponential model) (Figure below). I've tried a few options like polyfit, fit, but it doesnt work for my project.
I appreciate your consideration.
Respuesta aceptada
William Rose
el 8 de Ag. de 2022
You have
deltaLat(i,:)=(B(i+1,1)-B(i,1))*60*1852; % diferença das latitudes
deltaLon(i,:)=(B(i+1,2)-B(i,2))*60*1852; % diferença das longitudes
The equation for deltaLat convert the latitude difference from degres of latitude to meters, using the conversion factor
1 degee of latitude=60*1852 meters.
This is correct. However, for deltaLon, the correct conversion is
1 degee of latitude=60*1852*cos(Lat) meters.
Quinta Das Lameirinhas is at latitude 39.33 N, therefore cos(Lat)=0.7735. Therefore deltaLon should be
deltaLon(i,:)=(B(i+1,2)-B(i,2))*60*1852*0.7735; % diferença das longitudes
To make a plot like Tobler's model:
Find the mean slope for the difference sets of data:
d_mean_10_plus= mean(declive(declive > 10));
d_mean_0_10 = mean(declive(declive <= 10 & declive >= 0));
d_mean_10_0 = mean(declive(declive < 0 & declive >= -10));
d_mean_10_minus = mean(declive(declive < -10));
Combine the mean slopes into a vector, and combine the mean velocities into a vector. This will make plotting easier.
x=[d_mean_10_plus, d_mean_0_10, d_mean_10_0, d_mean_10_minus];
y=[v_mean_10_plus, v_mean_0_10, v_mean_10_0, v_mean_10_minus];
Plot the data:
plot(x,y,'rs');
grid on; xlabel('Declive'); ylabel('Velocidade');
See how that works. Good luck.
4 comentarios
William Rose
el 9 de Ag. de 2022
@Rúben Ricardo, thnak you for describing your work. It sounds interesting. Good luck!
Más respuestas (0)
Ver también
Categorías
Más información sobre Matched Filter and Ambiguity Function en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!