一連の座標から動物の軌跡を線分としてプロットしようとしています。円形ゾーンの内側と外側にプロットされた座標の数を確認したい。円と交差する座標は内外両方にカウントされていると思いますが、厳密には内にカウントしてほしいです。これは私がこれまでに持っているものです:
[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
私はMatlabが初めてなので、どんな助けも本当に感謝しています!