How to Rearrange Circular Data Sequentially

My data plots as follows:
The data jumps from bottom end to top end, back and forth, creating jagged lines in the line-plot.
What I want to happen (I created a mock-up) is:
Where the each successive data point in the closest distance-wise to the previous point. I assume I would have to loop through all points and check which is the closest in euclidean space and go to the next point.
I'm a beginner with MATLAB and I'm having trouble implementing this and any help is appreciated.
My data is attached to the post.

 채택된 답변

the cyclist
the cyclist 2015년 3월 11일

0 개 추천

One possibility would be to calculate the convex hull using the convhull command, and plot that along with the X,Y points.

댓글 수: 1

Brian Vu
Brian Vu 2015년 3월 13일
편집: Brian Vu 2015년 3월 13일
Thanks for all your replies. This method more or less solved this problem. Do you happen to know how to spline this points together without creating a closed shape? I was attempting vector valued splines and only recently when I rearranged the data did I see that it attempts to close the shape (links all points together).
EDIT: I know my question is VERY vague but what I have is :
and I do not want the spline to fully close - I want it to spline bit by bit and then simply end without "looping" back on itself.

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

추가 답변 (2개)

the cyclist
the cyclist 2015년 3월 11일

0 개 추천

What command are you using to make the plot? It is defaulting to putting in a connecting line, but do you really need that at all? Maybe you could just use the X's, such as
plot(X,Y,'.')
or
scatter(X,Y)
the cyclist
the cyclist 2015년 3월 11일

0 개 추천

You could calculate the four-quadrant inverse tangent of your X,Y coordinates, sort them in that order, and plot them as you did in your example.

카테고리

도움말 센터File Exchange에서 Spline Postprocessing에 대해 자세히 알아보기

질문:

2015년 3월 11일

편집:

2015년 3월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by