Identify a closed curve?
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
If I plot a graph, is there a way for Matlab to check if its a closed curve?
0 Kommentare
Antworten (2)
Image Analyst
am 23 Mär. 2015
Try this
if x(1) == x(end) && y(1) == y(end)
% It's closed
else
% It's not closed
end
2 Kommentare
Image Analyst
am 23 Mär. 2015
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
am 23 Mär. 2015
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.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Specifying Target for Graphics Output finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!