How to attribute intersection points between poly and lineseg to poly
Show older comments
I'm trying to plot an animal's trajectory from a set of coordinates as a line segment. I want to see how many coordinates are plotted inside a circular zone vs outside. I think that coordinates which intersect with the circle are being counted as both inside and outside, but I would like them to be strictly counted as inside. This is what I have so far:
[in,out] = intersect(circle_poly,trajectory);
plot(circle_poly)
hold on
plot(in(:,1),in(:,2),'b',out(:,1),out(:,2),'r')
legend('Polygon','Inside','Outside','Location','NorthWest')
num_frames_in = numel([in]) %count num elements/frames in polygon
num_frames_out = numel([out]) %count num element/frames outside polygon
total_frames = num_frames_in + num_frames_out
Any help would be really appreciated since I'm new to Matlab!

1 Comment
yanqi liu
on 18 Feb 2022
yes,sir,may be upload your data to analysis
Answers (2)
Categories
Find more on Line Plots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!