Comparing data sets with similar trends

7 ビュー (過去 30 日間)
Andrew Luce
Andrew Luce 2020 年 2 月 6 日
コメント済み: Guillaume 2020 年 2 月 9 日
Hello,
I was wondering if there was a way to compare the two data sets I have below represented by the graphs. I created this random path between points (1,1) and (10,10) (the orange line) . Through some other things, I was able to get a line that is similarly shaped to orange one. The data is represented by the blue line. Ignoring the rotation for now, is there a mathmateical way to disern the similarity in the trend in the data or the shape of the lines?
Thank you
Andrew
Capture.PNG
  2 件のコメント
the cyclist
the cyclist 2020 年 2 月 6 日
Can you upload that data that are being plotted, in a MAT file?
If those data are stored in vectors x1 and y1 for the orange line, and x2,y2 for the blue line, then a simple metric would be
D = sum((x1-x2).^2 + (y1-y2).^2);
which is just the sum of squared distance between each point.
If there are not an equal number of points in each line, it will be a bit trickier.
And if your response is "that won't work because <this reason>", then your reason will be a clue about how to improve the metric.
Andrew Luce
Andrew Luce 2020 年 2 月 7 日
I actually do not have the data on these specfic lines anymore. However, I have another set with the same deal. P is esstinally is the orange line and Coordinates_scaled is the blue line. Both lines do have different number of coordiates

サインインしてコメントする。

回答 (1 件)

Guillaume
Guillaume 2020 年 2 月 6 日
It depends on what you call similar.
If I understood correctly, here you could transform your path in a vector of left and right turns and compare the two vectors. If they're identical the graphs are similar.
  2 件のコメント
Andrew Luce
Andrew Luce 2020 年 2 月 7 日
Thank you for your response, what do you mean a vector of left and right turns?
Guillaume
Guillaume 2020 年 2 月 9 日
What I meant is that your random walk is a series of left and right turns. So, you could transform each graph into a vector of left and right symbols. For example, P in your Lines.mat would be:
>> getturns(P) %simple function I've written
ans =
'RLRRLLLRRRLLRLLRLRRL'
If you build the same vector for each graph, they'll be identical (in that they describe the same sequence of right and left turns) if the vectors are identical.
Except, that your second graph CoordinatesScaled is not a series of left and right turns, your turns have some 45 degrees bevels, so my idea is not applicable.

サインインしてコメントする。

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by