I want to calculate mean trajectory using Dynamic Time Warping.

20 visualizzazioni (ultimi 30 giorni)
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?

Risposte (1)

Balavignesh
Balavignesh il 5 Ott 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:
Hope that helps!
Balavignesh.

Community Treasure Hunt

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

Start Hunting!

Translated by