Info
此问题已关闭。 请重新打开它进行编辑或回答。
How to draw linear lines on a set of data and find which line has the most points on it?
1 次查看(过去 30 天)
显示 更早的评论
I have a set of error-data and this error increases per inch (distance). But this data is not perfectly linear. I want to draw a number of linear lines on the plotted graph and then check which line has the most data points on it or near to it. How should i do it? The data for this is
inch (distance)=[0 1 2 3 4 5 6 7 8 9 10 11 12 13 14--------25 26 27]; error=[-5.5494 -6.7142 -4.2772 -4.4059 -3.7628 -4.2873 -3.2144 -2.058 -2.1906 -2.3534 -1.5007 -1.9778 -1.4085 0 0.6107 1.2219 2.0251 0.9636 1.98 2.1989 3.052 4.5974 3.4878 4.3893 4.8776 3.4843 2.5935];
The plotted graph is attached herewith.
Thanks in advance
1 个评论
Guillaume
2016-6-23
Why don't you want to do a least square fit rather than come up with your own fitting algorithm?
回答(1 个)
KSSV
2016-6-23
1. You can use knnsearch to find how many points are closer to a given points. 2. You can use find(x<xmin & x>xmax) to know points lying between [xmin, xmax].
Hope you got the gist.
0 个评论
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!