필터 지우기
필터 지우기

Identify a closed curve?

조회 수: 4 (최근 30일)
Jannen Paiva
Jannen Paiva 2015년 3월 23일
댓글: Image Analyst 2015년 3월 23일
If I plot a graph, is there a way for Matlab to check if its a closed curve?

답변 (2개)

Image Analyst
Image Analyst 2015년 3월 23일
Try this
if x(1) == x(end) && y(1) == y(end)
% It's closed
else
% It's not closed
end
  댓글 수: 2
Jannen Paiva
Jannen Paiva 2015년 3월 23일
sorry, I don't know if this kind is called a closed curve http://postimg.org/image/yn339fvc1/
but that's the kind, with the figure 8-ish shape, that I want to check for
Image Analyst
Image Analyst 2015년 3월 23일
I don't care if it crosses itself or not. If it's closed, then the last point will be the same as the first point. If not it's definitely not closed. Just think about it. If I draw a circle around a clock and start at 12 at the top and go around clockwise and end at 11, it's not closed. If I have a bunch of points tracing out a figure 8, then it's not closed unless the last point can be drawn connecting it to the first point. "Close" to the first point is not good enough! So I don't really understand your comment. By the way, it looks like what you have in your picture is a closed curve.

댓글을 달려면 로그인하십시오.


John D'Errico
John D'Errico 2015년 3월 23일
Once you plot it, you have a picture. Far easier is to do any analysis BEFORE you plot it. Asking to do so afterwards is an act of closing the barn door after the horse has escaped. Then you must either extract the data from the figure to do your analysis, or you must treat it as an image.
So if you are going to extract the data from the figure, just do that analysis then, BEFORE the plot ever gets generated.
Image Analyst has already shown how to do that test, unless your curve is more complex than that. For example, does it self-intersect? Only you can decide if that represents a closed curve.

카테고리

Help CenterFile Exchange에서 Specifying Target for Graphics Output에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by