I want to calculate mean trajectory using Dynamic Time Warping.
18 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
x-axis is number of data point an y-axis is longitude.
I want to mean line from aligned singal. but it only returns dist 45.812772.
how can i use this number to calculate mean line?
and trajectory data concist of longitude, latitude.
In this example, I used only longitude data.
how to use both data while using DTW to get mean trajecotory?
2 commentaires
Walter Roberson
le 28 Août 2022
What is the difference between this and https://www.mathworks.com/matlabcentral/answers/1789165-how-to-use-dynamic-time-warping-dtw-to-multiple-trajectories?s_tid=srchtitle ?
Réponses (1)
Balavignesh
le 5 Oct 2023
Hi Sierra,
As per my understanding, you would like to plot mean trajectory using Dynamic Time Warping (DTW).
I assume that you have data points of trajectories consisting of latitude and longitude values.
I would suggest you to create an empty matrix 'distance' to store pairwise distances between all trajectories. You could iterate over all pairs of trajectories and compute their 'DTW' distance based on the latitude and longitude coordinates using the 'dtw' function and store in the 'distance' matrix.
% for i = 1:N
% for j = i+1:N
% dist(i, j) = dtw([lat(:, i), lon(:, i)], [lat(:, j), lon(:, j)]);
You could then compute the mean trajectory by finding the trajectory with the minimum average distance to all other trajectories by calculating the mean of each row in the 'distance' matrix and fincing the index of minimum mean distance.
Kindly have a look at the following documentation links to have more information on:
- 'dtw' function: https://www.mathworks.com/help/signal/ref/dtw.html
- 'find' function: https://in.mathworks.com/help/matlab/ref/find.html
Hope that helps!
Balavignesh.
0 commentaires
Voir également
Catégories
En savoir plus sur AI for Signals dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!