i have number of points that have (x,y) .then i define a line and i want to realize which points are under the line?

2 views (last 30 days)
Mili Kian
Mili Kian on 18 Apr 2020
Commented: Mili Kian on 24 Apr 2020
i have number of points that have (x,y) .then i define a line and i want to realize which points are under the line?
i write this :
....
r=[0 10 15 20 30];
t=[10 10 15 10 10];
f= line(r,t)
axis([0,30,0,20]);
d=(eldof(:,10))& (eldof(:,11)) <= f
then all of points are zero
why??

Accepted Answer

Image Analyst
Image Analyst on 18 Apr 2020
You need to call polyfit:
coefficients = polyfit(r, t, 1);
or you can call fitPolynomialRansac if you want the line to go exactly through the points on the bottom of your plot.
Then you have to get some x values and get a digital vector of line values. You can use your r locations, or you can use more or less than that. Then see which values are less than the y value of the line. For the same r points
yLine = polyval(coefficients, r);
belowLine = t < yLine; % A logical index vector.
  2 Comments
Image Analyst
Image Analyst on 20 Apr 2020
Those points are just a grid:
I'm not sure what to do either. Can you draw the line on there that you want to detect if some point is below that line, and repost your picture with the line indicated?

Sign in to comment.

More Answers (1)

Mili Kian
Mili Kian on 21 Apr 2020
i want to see the effect of topoghraphy
  2 Comments

Sign in to comment.

Tags

Community Treasure Hunt

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

Start Hunting!