Closed curve fitting of scatter plot data

10 views (last 30 days)
Mariah Smith
Mariah Smith on 19 Feb 2016
Answered: Niko Lay on 28 Aug 2017
I'm trying to find the best fit closed curve to a scatter plot. I have no clue where to start. The points come from GPS coordinates that are sequential so just doing plot(x,y) will not give me what I need. Here are a couple examples of what the data could look like (black dots) and the type of curve I'm trying to produce. It could make any arbitrary shape. Also since the dataset comes from GPS coordinates of a paths continually taken, the path could potentially overlap itself. In essence, I'm trying to get the "average route" taken from a plot of the same route taken continuously.

Answers (2)

Niko Lay
Niko Lay on 28 Aug 2017
I had the same problem and solved it using polar coordinates instead of cartesian.
Transform coordinates to polar coordinates (cart2pol) then your curve is no more closed. This curve you can fit and after fiting tranform the coordinates from polar back to cartesian coordinates.

Walter Roberson
Walter Roberson on 19 Feb 2016
If you have R2014b or later, try boundary()

Community Treasure Hunt

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

Start Hunting!