I want to calculate mean trajectory using Dynamic Time Warping.
19 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
Walter Roberson
2022 年 8 月 28 日
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 ?
回答 (1 件)
Balavignesh
2023 年 10 月 5 日
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 件のコメント
参考
カテゴリ
Help Center および File Exchange で AI for Signals についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!