Info

この質問は閉じられています。 編集または回答するには再度開いてください。

How to draw linear lines on a set of data and find which line has the most points on it?

1 回表示 (過去 30 日間)
NIKHIL PATIL
NIKHIL PATIL 2016 年 6 月 23 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
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
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
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.

この質問は閉じられています。

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by