How to compare data from two different data systems y1,x1 and y2,x2?
3 views (last 30 days)
Show older comments
Hello dear community,
I want to compare data from two different data systems y1,x1 and y2,x2.
First you see a plot:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/298813/image.png)
The Values are (for example)
Red plot is a "Motor 1" Line and have y1,x1 values: (41,0.1),(40,0.2),(40,0.3),(41,0.4),(39,0.5),....,(42,n).
The cyan line/points are "Trajectory" Line and have y2,x2 values: (43,0.29),(40,0.38),(41,0,49),(40,0.78),....,(41,n).
I want to compare this values (with true positive/false negative methods) and have to find out, how far away is a y2 value from y1 value. The problem is, there are different x points, so how it is possible to analyze both data arrays?
Thank you very much in advice!
Sincerely yours, Nik
0 Comments
Answers (1)
Walter Roberson
on 23 May 2020
You can use pdist2() to find the distance from each x1/y1 point to each x2/y2 point, and then use min() . Or you can use knnsearch to find the 1 point in x2/y2 that is closest toeach x1/y1 point.
But... then what?
Sometimes what people do in these kinds of situations is to interp1(x2, y2, x1) to find the value in x2/y2 that would be "predicted" for x1, and from there you can compare to the actual y1 value to make some kind of determination.
1 Comment
See Also
Categories
Find more on Scatter Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!